Make wmenu-run behave like dmenu_run - wmenu - 🔧 fork of wmenu
(HTM) git clone git@git.drkhsh.at/wmenu.git
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit a0df7959f9182a87a833d0a7f653f5ac8a2b5d0e
(DIR) parent 0fa9c359493b35ef0dda3b64f121fbe333f90f1a
(HTM) Author: NAHTAIV3L <rbeckettvt@gmail.com>
Date: Sun, 2 Jun 2024 21:49:46 -0400
Make wmenu-run behave like dmenu_run
Diffstat:
M wmenu-run.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
---
(DIR) diff --git a/wmenu-run.c b/wmenu-run.c
@@ -39,7 +39,8 @@ static void activation_token_done(void *data, struct xdg_activation_token_v1 *ac
menu_destroy(exe->menu);
setenv("XDG_ACTIVATION_TOKEN", token, true);
- execlp(exe->name, exe->name, NULL);
+ char* cmd[] = {"/bin/sh", "-c", exe->name, NULL};
+ execvp(cmd[0], (char**)cmd);
fprintf(stderr, "Failed to execute selection: %s\n", strerror(errno));
free(exe->name);
@@ -52,13 +53,9 @@ static const struct xdg_activation_token_v1_listener activation_token_listener =
};
static void exec(struct menu *menu) {
- if (!menu->sel) {
- return;
- }
-
struct executable *exe = calloc(1, sizeof(struct executable));
exe->menu = menu;
- exe->name = strdup(menu->sel->text);
+ exe->name = strdup(menu->input);
struct xdg_activation_v1 *activation = context_get_xdg_activation(menu->context);
struct xdg_activation_token_v1 *activation_token = xdg_activation_v1_get_activation_token(activation);