From 3f132616feec007060f4d992bdefcdcd45f71319 Mon Sep 17 00:00:00 2001 From: Scoopta Date: Tue, 6 Aug 2024 19:39:12 -0700 Subject: [PATCH] Added the use_search_box option --- man/wofi.5 | 3 +++ src/wofi.c | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/man/wofi.5 b/man/wofi.5 index 55cb99a..4be5cd8 100644 --- a/man/wofi.5 +++ b/man/wofi.5 @@ -195,6 +195,9 @@ Specifies whether or not actions should be executed on a single click or a doubl .TP .B pre_display_exec=\fIBOOL\fR This modifies the behavior of pre_display_cmd and causes the command in question to be directly executed via fork/exec rather than through the shell. +.TP +.B use_search_box=\fIBOOL\fR +Specifies whether or not wofi should use a GtkSearchEntry or a regular GtkEntry. The search entry has a little search icon and a clear text button that the regular entry lacks. Default is true .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 ada9dc5..6727c49 100644 --- a/src/wofi.c +++ b/src/wofi.c @@ -2013,7 +2013,14 @@ void wofi_init(struct map* _config) { outer_box = gtk_box_new(outer_orientation, 0); gtk_widget_set_name(outer_box, "outer-box"); gtk_container_add(GTK_CONTAINER(window), outer_box); - entry = gtk_search_entry_new(); + + bool use_search_box = strcmp(config_get(config, "use_search_box", "true"), "true") == 0; + if(use_search_box) { + entry = gtk_search_entry_new(); + } else { + entry = gtk_entry_new(); + } + g_signal_connect(entry, "size-allocate", G_CALLBACK(widget_allocate), NULL); gtk_widget_set_name(entry, "input");