From 28fda4c0d38907fab94dc7d82c9dcf0754748b4e Mon Sep 17 00:00:00 2001 From: Ronan Pigott Date: Wed, 16 Nov 2022 15:50:34 -0700 Subject: launcher: export X startup ids and use them for workspace matching --- sway/commands/exec_always.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'sway/commands/exec_always.c') 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); -- cgit v1.2.3-54-g00ecf