diff --git a/man/wofi.7 b/man/wofi.7 index 472917a..8d1ce0f 100644 --- a/man/wofi.7 +++ b/man/wofi.7 @@ -42,6 +42,9 @@ If true spaces will not be treated as part of the executable name but rather as .TP .B show_all=\fIBOOL\fR If true shows all the entries in path, this will show entries that have the same executable name, for example /bin/bash and /usr/bin/bash will be shown separately as bash instead of having one bash entry for the first one encountered, default is true. +.TP +.B print_command=\fIBOOL\fR +If true the executable that would be run will be printed to stdout instead of executing it, default is false. .SH DRUN CONFIG OPTIONS .TP diff --git a/modes/run.c b/modes/run.c index 7d83e0f..c7918fd 100644 --- a/modes/run.c +++ b/modes/run.c @@ -28,10 +28,11 @@ #include #include -static const char* arg_names[] = {"always_parse_args", "show_all"}; +static const char* arg_names[] = {"always_parse_args", "show_all", "print_command"}; static bool always_parse_args; static bool show_all; +static bool print_command; static struct mode* mode; static const char* arg_str = "__args"; @@ -46,6 +47,7 @@ void wofi_run_init(struct mode* this, struct map* config) { mode = this; always_parse_args = strcmp(config_get(config, arg_names[0], "false"), "true") == 0; show_all = strcmp(config_get(config, arg_names[1], "true"), "true") == 0; + print_command = strcmp(config_get(config, arg_names[2], "false"), "true") == 0; wl_list_init(&widgets); @@ -188,6 +190,10 @@ void wofi_run_exec(const char* cmd) { wofi_write_cache(mode, cmd); wofi_term_run(cmd); } + if(print_command) { + printf("%s\n", cmd); + exit(0); + } if(arg_run) { size_t space_count = 2; char* tmp = parse_args(cmd, &space_count);