foot/client: implement xdga client activation

This is an application of the xdg activation protocol that will allow
compositors to associate new foot toplevels with the command that
launched them.

footclient receives an activation token from the launcher which the
compositor can use to track application startup. It passes the token
to the foot server, which then activates the new window with the token
to complete the startup sequence.
This commit is contained in:
Ronan Pigott 2021-10-28 17:51:44 -07:00
parent 347e79f8a1
commit 99d5bf64bc
9 changed files with 51 additions and 11 deletions

7
main.c
View file

@ -160,6 +160,10 @@ main(int argc, char *const *argv)
static const int foot_exit_failure = -26;
int ret = foot_exit_failure;
/* XDG startup notifications */
const char *token = getenv("XDG_ACTIVATION_TOKEN");
unsetenv("XDG_ACTIVATION_TOKEN");
/* Startup notifications; we don't support it, but must ensure we
* don't pass this on to programs launched by us */
unsetenv("DESKTOP_STARTUP_ID");
@ -530,7 +534,8 @@ main(int argc, char *const *argv)
goto out;
if (!as_server && (term = term_init(
&conf, fdm, reaper, wayl, "foot", cwd, argc, argv,
&conf, fdm, reaper, wayl, "foot", cwd, token,
argc, argv,
&term_shutdown_cb, &shutdown_ctx)) == NULL) {
goto out;
}