Add CLI option to hide the search bar

This feature can be useful when there are multiple types of menus, and a
search bar doesn't fit well with some of them.
2 files changed, 18 insertions(+), 2 deletions(-)

M man/wofi.1
M src/main.c
M man/wofi.1 +3 -1
@@ 118,7 118,9 @@ Sets the monitor to open on
 .TP
 .B \-r, \-\-pre\-display\-cmd
 If set, the selectable entry won't be displayed as-is, but will instead be displayed based on the output of this command, which can be anything. Suggested to use with \fB"echo %s | some_cmd"\fR or \fB"some_cmd %s"\fR, as the string gets replaced in a printf-like fashion. This will not affect the output of wofi once a selection has been done, allowing you to display something else than the original output.
-
+.TP
+.B \-j, \-\-hide\-search
+Hides the search bar.
 
 .SH CONFIGURATION
 Wofi has 3 main files used for configuration. All files are completely optional.

          
M src/main.c +15 -1
@@ 98,6 98,7 @@ static void print_usage(char** argv) {
 	printf("--search\t\t-Q\tSearch for something immediately on open\n");
 	printf("--monitor\t\t-o\tSets the monitor to open on\n");
 	printf("--pre-display-cmd\t-r\tRuns command for the displayed entries, without changing the output. %%s for the real string\n");
+  	printf("--hide-search\t\t-j\tHides the search bar\n");
 	exit(0);
 }
 

          
@@ 439,6 440,12 @@ int main(int argc, char** argv) {
 			.val = 'r'
 		},
 		{
+			.name = "hide-search",
+			.has_arg = no_argument,
+			.flag = NULL,
+			.val = 'j'
+		},
+		{
 			.name = NULL,
 			.has_arg = 0,
 			.flag = NULL,

          
@@ 476,13 483,14 @@ int main(int argc, char** argv) {
 	char* search = NULL;
 	char* monitor = NULL;
 	char* pre_display_cmd = NULL;
+  	char* hide_search = NULL;
 
 	struct wl_list options;
 	wl_list_init(&options);
 	struct option_node* node;
 
 	int opt;
-	while((opt = getopt_long(argc, argv, "hfc:s:C:dS:W:H:p:x:y:nImk:t:P::eEbM:iqvl:aD:L:w:O:GQ:o:r:", opts, NULL)) != -1) {
+	while((opt = getopt_long(argc, argv, "hfc:s:C:dS:W:H:p:x:y:nImk:t:P::eEbM:iqvl:aD:L:w:O:GQ:o:r:j", opts, NULL)) != -1) {
 		switch(opt) {
 		case 'h':
 			print_usage(argv);

          
@@ 597,6 605,9 @@ int main(int argc, char** argv) {
 		case 'r':
 			pre_display_cmd = optarg;
 			break;
+		case 'j':
+			hide_search = "true";
+			break;
 		}
 	}
 

          
@@ 792,6 803,9 @@ int main(int argc, char** argv) {
 	if(pre_display_cmd != NULL) {
 		map_put(config, "pre_display_cmd", pre_display_cmd);
 	}
+  	if(hide_search != NULL) {
+		map_put(config, "hide_search", hide_search);
+	}
 
 	struct sigaction sigact = {0};
 	sigact.sa_handler = sig;