From a3a8f3c3f959dae7e30ba33a23ee0737ada17b52 Mon Sep 17 00:00:00 2001 From: Scoopta Date: Wed, 13 Jul 2022 21:36:38 -0700 Subject: [PATCH] Added the single_click config option --- man/wofi.5 | 3 +++ src/wofi.c | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/man/wofi.5 b/man/wofi.5 index fb4846f..33685dd 100644 --- a/man/wofi.5 +++ b/man/wofi.5 @@ -186,6 +186,9 @@ Specifies the layer to open on. The options are background, bottom, top, and ove .TP .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. +.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 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. diff --git a/src/wofi.c b/src/wofi.c index 7385086..f462ad0 100644 --- a/src/wofi.c +++ b/src/wofi.c @@ -105,6 +105,7 @@ static pthread_t mode_thread; static bool has_joined_mode = false; static char* copy_exec = NULL; static char* pre_display_cmd = NULL; +static bool single_click = false; static struct map* keys; @@ -583,7 +584,7 @@ static gboolean _insert_widget(gpointer data) { gtk_expander_set_label_widget(GTK_EXPANDER(parent), box); 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); gtk_container_add(GTK_CONTAINER(parent), exp_box); 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* layer = config_get(config, "layer", "top"); copy_exec = config_get(config, "copy_exec", "wl-copy"); - pre_display_cmd = map_get(config, "pre_display_cmd"); + single_click = strcmp(config_get(config, "single_click", "false"), "true") == 0; keys = map_init_void(); @@ -1792,7 +1793,7 @@ void wofi_init(struct map* _config) { gtk_widget_set_valign(inner_box, valign); 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); gtk_box_set_homogeneous(GTK_BOX(wrapper_box), TRUE);