The scroll bars can now be hidden

This commit is contained in:
Scoopta 2019-11-18 13:42:40 -08:00
parent 7573eecb02
commit c85f6a7209
2 changed files with 19 additions and 1 deletions

View File

@ -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("--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("--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("--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); exit(0);
} }
@ -290,6 +291,12 @@ int main(int argc, char** argv) {
.flag = NULL, .flag = NULL,
.val = 'e' .val = 'e'
}, },
{
.name = "hide-scroll",
.has_arg = no_argument,
.flag = NULL,
.val = 'b'
},
{ {
.name = NULL, .name = NULL,
.has_arg = 0, .has_arg = 0,
@ -314,8 +321,9 @@ int main(int argc, char** argv) {
char* terminal = NULL; char* terminal = NULL;
char* password_char = "false"; char* password_char = "false";
char* exec_search = NULL; char* exec_search = NULL;
char* hide_scroll = NULL;
int opt; 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) { switch(opt) {
case 'h': case 'h':
print_usage(argv); print_usage(argv);
@ -379,6 +387,9 @@ int main(int argc, char** argv) {
case 'e': case 'e':
exec_search = "true"; exec_search = "true";
break; break;
case 'b':
hide_scroll = "true";
break;
} }
} }
@ -512,6 +523,9 @@ int main(int argc, char** argv) {
if(exec_search != NULL) { if(exec_search != NULL) {
map_put(config, "exec_search", exec_search); map_put(config, "exec_search", exec_search);
} }
if(hide_scroll != NULL) {
map_put(config, "hide_scroll", hide_scroll);
}
gtk_init(&argc, &argv); gtk_init(&argc, &argv);

View File

@ -520,6 +520,7 @@ void wofi_init(struct map* config) {
terminal = map_get(config, "term"); terminal = map_get(config, "term");
char* password_char = map_get(config, "password_char"); char* password_char = map_get(config, "password_char");
exec_search = strcmp(config_get(config, "exec_search", "false"), "true") == 0; 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(); modes = map_init_void();
window = gtk_window_new(GTK_WINDOW_TOPLEVEL); window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
@ -567,6 +568,9 @@ void wofi_init(struct map* config) {
gtk_widget_set_name(scroll, "scroll"); gtk_widget_set_name(scroll, "scroll");
gtk_container_add(GTK_CONTAINER(outer_box), scroll); gtk_container_add(GTK_CONTAINER(outer_box), scroll);
gtk_widget_set_size_request(scroll, width, height); 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(); inner_box = gtk_flow_box_new();
gtk_flow_box_set_max_children_per_line(GTK_FLOW_BOX(inner_box), 1); gtk_flow_box_set_max_children_per_line(GTK_FLOW_BOX(inner_box), 1);