diff --git a/src/main.c b/src/main.c index 17bb3ba..12fc20b 100644 --- a/src/main.c +++ b/src/main.c @@ -73,6 +73,7 @@ static void print_usage(char** argv) { printf("--parse-search\t-q\tParses the search text removing image escapes and pango\n"); printf("--version\t-v\tPrints the version and then exits\n"); printf("--location\t-l\tSets the location\n"); + printf("--no-actions\t-a\tDisables multiple actions for modes that support it\n"); exit(0); } @@ -332,6 +333,12 @@ int main(int argc, char** argv) { .flag = NULL, .val = 'l' }, + { + .name = "no-actions", + .has_arg = required_argument, + .flag = NULL, + .val = 'a' + }, { .name = NULL, .has_arg = 0, @@ -361,8 +368,9 @@ int main(int argc, char** argv) { char* insensitive = NULL; char* parse_search = NULL; char* location = NULL; + char* no_actions = NULL; int opt; - while((opt = getopt_long(argc, argv, "hfc:s:C:dS:W:H:p:x:y:nImk:t:P::ebM:iqvl:", opts, NULL)) != -1) { + while((opt = getopt_long(argc, argv, "hfc:s:C:dS:W:H:p:x:y:nImk:t:P::ebM:iqvl:a", opts, NULL)) != -1) { switch(opt) { case 'h': print_usage(argv); @@ -445,6 +453,9 @@ int main(int argc, char** argv) { case 'l': location = optarg; break; + case 'a': + no_actions = "true"; + break; } } @@ -593,6 +604,9 @@ int main(int argc, char** argv) { if(location != NULL) { map_put(config, "location", location); } + if(no_actions != NULL) { + map_put(config, "no_actions", no_actions); + } gtk_init(&argc, &argv); diff --git a/src/wofi.c b/src/wofi.c index c03bbb7..2124b80 100644 --- a/src/wofi.c +++ b/src/wofi.c @@ -60,6 +60,7 @@ static bool parse_search; static GtkAlign content_halign; static struct map* config; static enum locations location; +static bool no_actions; struct node { size_t action_count; @@ -356,7 +357,7 @@ static void expand(GtkExpander* expander, gpointer data) { static gboolean _insert_widget(gpointer data) { struct node* node = data; GtkWidget* parent; - if(node->action_count > 1) { + if(node->action_count > 1 && !no_actions) { parent = gtk_expander_new(""); g_signal_connect(parent, "activate", G_CALLBACK(expand), NULL); GtkWidget* box = create_label(node->mode, node->text[0], node->search_text, node->actions[0]); @@ -842,6 +843,7 @@ void wofi_init(struct map* _config) { location = config_get_mnemonic(config, "location", "center", 18, "center", "top_left", "top", "top_right", "right", "bottom_right", "bottom", "bottom_left", "left", "0", "1", "2", "3", "4", "5", "6", "7", "8"); + no_actions = strcmp(config_get(config, "no_actions", "false"), "true") == 0; modes = map_init_void(); window = gtk_window_new(GTK_WINDOW_TOPLEVEL);