diff --git a/src/main.c b/src/main.c index 591ef78..cb4738b 100644 --- a/src/main.c +++ b/src/main.c @@ -67,6 +67,7 @@ static void print_usage(char** argv) { printf("--term\t\t-t\tSpecifies the terminal to use when running in a term\n"); printf("--password\t-P\tRuns in password mode\n"); printf("--exec-search\t-e\tMakes enter always use the search contents not the first result\n"); + printf("--hide-scroll\t-b\tHides the scroll bars\n"); exit(0); } @@ -290,6 +291,12 @@ int main(int argc, char** argv) { .flag = NULL, .val = 'e' }, + { + .name = "hide-scroll", + .has_arg = no_argument, + .flag = NULL, + .val = 'b' + }, { .name = NULL, .has_arg = 0, @@ -314,8 +321,9 @@ int main(int argc, char** argv) { char* terminal = NULL; char* password_char = "false"; char* exec_search = NULL; + char* hide_scroll = NULL; int opt; - while((opt = getopt_long(argc, argv, "hfc:s:C:dS:W:H:p:x:y:nimk:t:P::e", opts, NULL)) != -1) { + while((opt = getopt_long(argc, argv, "hfc:s:C:dS:W:H:p:x:y:nimk:t:P::eb", opts, NULL)) != -1) { switch(opt) { case 'h': print_usage(argv); @@ -379,6 +387,9 @@ int main(int argc, char** argv) { case 'e': exec_search = "true"; break; + case 'b': + hide_scroll = "true"; + break; } } @@ -512,6 +523,9 @@ int main(int argc, char** argv) { if(exec_search != NULL) { map_put(config, "exec_search", exec_search); } + if(hide_scroll != NULL) { + map_put(config, "hide_scroll", hide_scroll); + } gtk_init(&argc, &argv); diff --git a/src/wofi.c b/src/wofi.c index 113a628..2036180 100644 --- a/src/wofi.c +++ b/src/wofi.c @@ -520,6 +520,7 @@ void wofi_init(struct map* config) { terminal = map_get(config, "term"); char* password_char = map_get(config, "password_char"); exec_search = strcmp(config_get(config, "exec_search", "false"), "true") == 0; + bool hide_scroll = strcmp(config_get(config, "hide_scroll", "false"), "true") == 0; modes = map_init_void(); window = gtk_window_new(GTK_WINDOW_TOPLEVEL); @@ -567,6 +568,9 @@ void wofi_init(struct map* config) { gtk_widget_set_name(scroll, "scroll"); gtk_container_add(GTK_CONTAINER(outer_box), scroll); gtk_widget_set_size_request(scroll, width, height); + if(hide_scroll) { + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll), GTK_POLICY_EXTERNAL, GTK_POLICY_EXTERNAL); + } inner_box = gtk_flow_box_new(); gtk_flow_box_set_max_children_per_line(GTK_FLOW_BOX(inner_box), 1);