diff options
author | Ronan Pigott <ronan@rjp.ie> | 2022-11-16 15:50:34 -0700 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2022-11-26 09:48:58 +0100 |
commit | 28fda4c0d38907fab94dc7d82c9dcf0754748b4e (patch) | |
tree | d7c9147d8d0716c66fdf04dd49255028cc6ec834 /sway/commands/exec_always.c | |
parent | launcher: export xdga tokens and use them for workspace matching (diff) | |
download | sway-28fda4c0d38907fab94dc7d82c9dcf0754748b4e.tar.gz sway-28fda4c0d38907fab94dc7d82c9dcf0754748b4e.tar.zst sway-28fda4c0d38907fab94dc7d82c9dcf0754748b4e.zip |
launcher: export X startup ids and use them for workspace matching
Diffstat (limited to 'sway/commands/exec_always.c')
-rw-r--r-- | sway/commands/exec_always.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/sway/commands/exec_always.c b/sway/commands/exec_always.c index 2dfba7ff..e6b09e64 100644 --- a/sway/commands/exec_always.c +++ b/sway/commands/exec_always.c | |||
@@ -32,11 +32,17 @@ static void export_xdga_token(struct launcher_ctx *ctx) { | |||
32 | setenv("XDG_ACTIVATION_TOKEN", token, 1); | 32 | setenv("XDG_ACTIVATION_TOKEN", token, 1); |
33 | } | 33 | } |
34 | 34 | ||
35 | static void export_startup_id(struct launcher_ctx *ctx) { | ||
36 | const char *token = launcher_ctx_get_token_name(ctx); | ||
37 | setenv("DESKTOP_STARTUP_ID", token, 1); | ||
38 | } | ||
39 | |||
35 | struct cmd_results *cmd_exec_process(int argc, char **argv) { | 40 | struct cmd_results *cmd_exec_process(int argc, char **argv) { |
36 | struct cmd_results *error = NULL; | 41 | struct cmd_results *error = NULL; |
37 | char *cmd = NULL; | 42 | char *cmd = NULL; |
43 | bool no_startup_id = false; | ||
38 | if (strcmp(argv[0], "--no-startup-id") == 0) { | 44 | if (strcmp(argv[0], "--no-startup-id") == 0) { |
39 | sway_log(SWAY_INFO, "exec switch '--no-startup-id' not supported, ignored."); | 45 | no_startup_id = true; |
40 | --argc; ++argv; | 46 | --argc; ++argv; |
41 | if ((error = checkarg(argc, argv[-1], EXPECTED_AT_LEAST, 1))) { | 47 | if ((error = checkarg(argc, argv[-1], EXPECTED_AT_LEAST, 1))) { |
42 | return error; | 48 | return error; |
@@ -74,6 +80,9 @@ struct cmd_results *cmd_exec_process(int argc, char **argv) { | |||
74 | if (ctx) { | 80 | if (ctx) { |
75 | export_xdga_token(ctx); | 81 | export_xdga_token(ctx); |
76 | } | 82 | } |
83 | if (ctx && !no_startup_id) { | ||
84 | export_startup_id(ctx); | ||
85 | } | ||
77 | execlp("sh", "sh", "-c", cmd, (void *)NULL); | 86 | execlp("sh", "sh", "-c", cmd, (void *)NULL); |
78 | sway_log_errno(SWAY_ERROR, "execlp failed"); | 87 | sway_log_errno(SWAY_ERROR, "execlp failed"); |
79 | _exit(1); | 88 | _exit(1); |