From 0b89b37af3ecfb5a3ee9c8cb4c8bff84c05c00f1 Mon Sep 17 00:00:00 2001 From: kraftwerk28 Date: Tue, 24 May 2022 13:51:09 +0300 Subject: [PATCH] i3-compat: use shell for spawning bar --- sway/config/bar.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sway/config/bar.c b/sway/config/bar.c index d1b342e6..065ba8fd 100644 --- a/sway/config/bar.c +++ b/sway/config/bar.c @@ -236,10 +236,14 @@ static void invoke_swaybar(struct bar_config *bar) { setenv("WAYLAND_SOCKET", wayland_socket_str, true); // run custom swaybar - char *const cmd[] = { - bar->swaybar_command ? bar->swaybar_command : "swaybar", - "-b", bar->id, NULL}; + const char *swaybarcmd = + bar->swaybar_command ? bar->swaybar_command : "exec swaybar"; + int cmdlen = snprintf(NULL, 0, "%s -b %s", swaybarcmd, bar->id) + 1; + char *full_cmd = malloc(cmdlen); + sprintf(full_cmd, "%s -b %s", swaybarcmd, bar->id); + char *const cmd[] = {"sh", "-c", full_cmd}; execvp(cmd[0], cmd); + free(full_cmd); _exit(EXIT_FAILURE); } _exit(EXIT_SUCCESS);