Added the single_click config option

This commit is contained in:
Scoopta 2022-07-13 21:36:38 -07:00
parent 49d41d0497
commit a3a8f3c3f9
2 changed files with 7 additions and 3 deletions

View File

@ -186,6 +186,9 @@ Specifies the layer to open on. The options are background, bottom, top, and ove
.TP .TP
.B copy_exec=\fIPATH\fR .B copy_exec=\fIPATH\fR
Specifies the executable to pipe copy data into. $PATH will be scanned, this is not passed to a shell and must be an executable. Default is wl-copy. Specifies the executable to pipe copy data into. $PATH will be scanned, this is not passed to a shell and must be an executable. Default is wl-copy.
.TP
.B single_click=\fIBOOL\fR
Specifies whether or not actions should be executed on a single click or a double click. Default is false.
.SH CSS SELECTORS .SH CSS SELECTORS
Any GTK widget can be selected by using the name of its CSS node, these however might change with updates and are not guaranteed to stay constant. Wofi also provides certain widgets with names and classes which can be referenced from CSS to give access to the most important widgets easily. \fBwofi\fR(7) contains the current widget layout used by wofi so if you want to get into CSS directly using GTK widget names look there for info. Any GTK widget can be selected by using the name of its CSS node, these however might change with updates and are not guaranteed to stay constant. Wofi also provides certain widgets with names and classes which can be referenced from CSS to give access to the most important widgets easily. \fBwofi\fR(7) contains the current widget layout used by wofi so if you want to get into CSS directly using GTK widget names look there for info.

View File

@ -105,6 +105,7 @@ static pthread_t mode_thread;
static bool has_joined_mode = false; static bool has_joined_mode = false;
static char* copy_exec = NULL; static char* copy_exec = NULL;
static char* pre_display_cmd = NULL; static char* pre_display_cmd = NULL;
static bool single_click = false;
static struct map* keys; static struct map* keys;
@ -583,7 +584,7 @@ static gboolean _insert_widget(gpointer data) {
gtk_expander_set_label_widget(GTK_EXPANDER(parent), box); gtk_expander_set_label_widget(GTK_EXPANDER(parent), box);
GtkWidget* exp_box = gtk_list_box_new(); GtkWidget* exp_box = gtk_list_box_new();
gtk_list_box_set_activate_on_single_click(GTK_LIST_BOX(exp_box), FALSE); gtk_list_box_set_activate_on_single_click(GTK_LIST_BOX(exp_box), single_click);
g_signal_connect(exp_box, "row-activated", G_CALLBACK(activate_item), NULL); g_signal_connect(exp_box, "row-activated", G_CALLBACK(activate_item), NULL);
gtk_container_add(GTK_CONTAINER(parent), exp_box); gtk_container_add(GTK_CONTAINER(parent), exp_box);
for(size_t count = 1; count < node->action_count; ++count) { for(size_t count = 1; count < node->action_count; ++count) {
@ -1620,8 +1621,8 @@ void wofi_init(struct map* _config) {
char* monitor = map_get(config, "monitor"); char* monitor = map_get(config, "monitor");
char* layer = config_get(config, "layer", "top"); char* layer = config_get(config, "layer", "top");
copy_exec = config_get(config, "copy_exec", "wl-copy"); copy_exec = config_get(config, "copy_exec", "wl-copy");
pre_display_cmd = map_get(config, "pre_display_cmd"); pre_display_cmd = map_get(config, "pre_display_cmd");
single_click = strcmp(config_get(config, "single_click", "false"), "true") == 0;
keys = map_init_void(); keys = map_init_void();
@ -1792,7 +1793,7 @@ void wofi_init(struct map* _config) {
gtk_widget_set_valign(inner_box, valign); gtk_widget_set_valign(inner_box, valign);
gtk_widget_set_name(inner_box, "inner-box"); gtk_widget_set_name(inner_box, "inner-box");
gtk_flow_box_set_activate_on_single_click(GTK_FLOW_BOX(inner_box), FALSE); gtk_flow_box_set_activate_on_single_click(GTK_FLOW_BOX(inner_box), single_click);
GtkWidget* wrapper_box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); GtkWidget* wrapper_box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
gtk_box_set_homogeneous(GTK_BOX(wrapper_box), TRUE); gtk_box_set_homogeneous(GTK_BOX(wrapper_box), TRUE);