aboutsummaryrefslogtreecommitdiffstats
path: root/swaynag/swaynag.c
diff options
context:
space:
mode:
authorLibravatar Brian Ashworth <bosrsf04@gmail.com>2018-11-27 23:27:44 -0500
committerLibravatar Brian Ashworth <bosrsf04@gmail.com>2018-11-27 23:34:51 -0500
commit673da8326038e0deb9837fd90d9e02351783b564 (patch)
tree1546629686b2afe4c7dbae18eb4233cbf0f0b4c6 /swaynag/swaynag.c
parentMerge pull request #3175 from emersion/rename-gtk-primary-selection (diff)
downloadsway-673da8326038e0deb9837fd90d9e02351783b564.tar.gz
sway-673da8326038e0deb9837fd90d9e02351783b564.tar.zst
sway-673da8326038e0deb9837fd90d9e02351783b564.zip
Implement swaynag -B/--button-no-terminal
In `i3 4.16`, `i3-nagbar` introduces the flags `-B/--button-no-terminal` to run the action directly instead of inside a terminal. This implements the flags for swaynag for compatibility. Since swaynag does not use an equivalent to `i3-sensible-terminal`, the flags `-b/--button` only uses a terminal when the environment variable `TERMINAL` is set, otherwise it acts the same as these new flags.
Diffstat (limited to 'swaynag/swaynag.c')
-rw-r--r--swaynag/swaynag.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/swaynag/swaynag.c b/swaynag/swaynag.c
index 74e127b6..a2a0b412 100644
--- a/swaynag/swaynag.c
+++ b/swaynag/swaynag.c
@@ -49,14 +49,17 @@ static void swaynag_button_execute(struct swaynag *swaynag,
49 if (fork() == 0) { 49 if (fork() == 0) {
50 // Child of the child. Will be reparented to the init process 50 // Child of the child. Will be reparented to the init process
51 char *terminal = getenv("TERMINAL"); 51 char *terminal = getenv("TERMINAL");
52 if (terminal && strlen(terminal)) { 52 if (button->terminal && terminal && strlen(terminal)) {
53 wlr_log(WLR_DEBUG, "Found $TERMINAL: %s", terminal); 53 wlr_log(WLR_DEBUG, "Found $TERMINAL: %s", terminal);
54 if (!terminal_execute(terminal, button->action)) { 54 if (!terminal_execute(terminal, button->action)) {
55 swaynag_destroy(swaynag); 55 swaynag_destroy(swaynag);
56 exit(EXIT_FAILURE); 56 exit(EXIT_FAILURE);
57 } 57 }
58 } else { 58 } else {
59 wlr_log(WLR_DEBUG, "$TERMINAL not found. Running directly"); 59 if (button->terminal) {
60 wlr_log(WLR_DEBUG,
61 "$TERMINAL not found. Running directly");
62 }
60 execl("/bin/sh", "/bin/sh", "-c", button->action, NULL); 63 execl("/bin/sh", "/bin/sh", "-c", button->action, NULL);
61 } 64 }
62 } 65 }