aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands/exec_always.c
diff options
context:
space:
mode:
authorLibravatar Ronan Pigott <ronan@rjp.ie>2022-11-18 20:05:24 -0700
committerLibravatar Simon Ser <contact@emersion.fr>2022-11-26 10:29:59 +0100
commit97423ca9c79b4aa273b5d156299bc6a7c8428dc0 (patch)
tree6392bca40f386ab8a8b022109d9c393fcf9a43f6 /sway/commands/exec_always.c
parentlauncher: fudge the interface a bit (diff)
downloadsway-97423ca9c79b4aa273b5d156299bc6a7c8428dc0.tar.gz
sway-97423ca9c79b4aa273b5d156299bc6a7c8428dc0.tar.zst
sway-97423ca9c79b4aa273b5d156299bc6a7c8428dc0.zip
launcher: export xdga tokens and use them for workspace matching
(cherry picked from commit 30ad4dc4a5a41ce7c7aa85096a6e18f374172983)
Diffstat (limited to 'sway/commands/exec_always.c')
-rw-r--r--sway/commands/exec_always.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sway/commands/exec_always.c b/sway/commands/exec_always.c
index 13deb9e3..2dfba7ff 100644
--- a/sway/commands/exec_always.c
+++ b/sway/commands/exec_always.c
@@ -27,6 +27,11 @@ struct cmd_results *cmd_exec_validate(int argc, char **argv) {
27 return error; 27 return error;
28} 28}
29 29
30static void export_xdga_token(struct launcher_ctx *ctx) {
31 const char *token = launcher_ctx_get_token_name(ctx);
32 setenv("XDG_ACTIVATION_TOKEN", token, 1);
33}
34
30struct cmd_results *cmd_exec_process(int argc, char **argv) { 35struct cmd_results *cmd_exec_process(int argc, char **argv) {
31 struct cmd_results *error = NULL; 36 struct cmd_results *error = NULL;
32 char *cmd = NULL; 37 char *cmd = NULL;
@@ -66,6 +71,9 @@ struct cmd_results *cmd_exec_process(int argc, char **argv) {
66 close(fd[0]); 71 close(fd[0]);
67 if ((child = fork()) == 0) { 72 if ((child = fork()) == 0) {
68 close(fd[1]); 73 close(fd[1]);
74 if (ctx) {
75 export_xdga_token(ctx);
76 }
69 execlp("sh", "sh", "-c", cmd, (void *)NULL); 77 execlp("sh", "sh", "-c", cmd, (void *)NULL);
70 sway_log_errno(SWAY_ERROR, "execlp failed"); 78 sway_log_errno(SWAY_ERROR, "execlp failed");
71 _exit(1); 79 _exit(1);