aboutsummaryrefslogtreecommitdiff
path: root/sway/commands
diff options
context:
space:
mode:
authorRonan Pigott <ronan@rjp.ie>2022-11-16 15:50:34 -0700
committerSimon Ser <contact@emersion.fr>2022-11-26 09:48:58 +0100
commit28fda4c0d38907fab94dc7d82c9dcf0754748b4e (patch)
treed7c9147d8d0716c66fdf04dd49255028cc6ec834 /sway/commands
parent30ad4dc4a5a41ce7c7aa85096a6e18f374172983 (diff)
launcher: export X startup ids and use them for workspace matching
Diffstat (limited to 'sway/commands')
-rw-r--r--sway/commands/exec_always.c11
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) {
setenv("XDG_ACTIVATION_TOKEN", token, 1);
}
+static void export_startup_id(struct launcher_ctx *ctx) {
+ const char *token = launcher_ctx_get_token_name(ctx);
+ setenv("DESKTOP_STARTUP_ID", token, 1);
+}
+
struct cmd_results *cmd_exec_process(int argc, char **argv) {
struct cmd_results *error = NULL;
char *cmd = NULL;
+ bool no_startup_id = false;
if (strcmp(argv[0], "--no-startup-id") == 0) {
- sway_log(SWAY_INFO, "exec switch '--no-startup-id' not supported, ignored.");
+ no_startup_id = true;
--argc; ++argv;
if ((error = checkarg(argc, argv[-1], EXPECTED_AT_LEAST, 1))) {
return error;
@@ -74,6 +80,9 @@ struct cmd_results *cmd_exec_process(int argc, char **argv) {
if (ctx) {
export_xdga_token(ctx);
}
+ if (ctx && !no_startup_id) {
+ export_startup_id(ctx);
+ }
execlp("sh", "sh", "-c", cmd, (void *)NULL);
sway_log_errno(SWAY_ERROR, "execlp failed");
_exit(1);