From 99d5bf64bca5daa70e3e8c5a4d63a257ba7e6fb8 Mon Sep 17 00:00:00 2001 From: Ronan Pigott Date: Thu, 28 Oct 2021 17:51:44 -0700 Subject: 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. --- server.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'server.c') diff --git a/server.c b/server.c index a5d87b04..1d31abc6 100644 --- a/server.c +++ b/server.c @@ -244,6 +244,17 @@ fdm_client(struct fdm *fdm, int fd, int events, void *data) const char *cwd = (const char *)p; p += cdata.cwd_len; LOG_DBG("CWD = %.*s", cdata.cwd_len, cwd); + /* XDGA token */ + const char *token = NULL; + if (cdata.xdga_token) { + + CHECK_BUF_AND_NULL(cdata.token_len); + token = (const char *)p; p += cdata.token_len; + LOG_DBG("XDGA = %.*s", cdata.token_len, token); + } else { + LOG_DBG("No XDGA token"); + } + /* Overrides */ for (uint16_t i = 0; i < cdata.override_count; i++) { struct client_string arg; @@ -303,7 +314,7 @@ fdm_client(struct fdm *fdm, int fd, int events, void *data) instance->terminal = term_init( conf != NULL ? conf : server->conf, - server->fdm, server->reaper, server->wayl, "footclient", cwd, + server->fdm, server->reaper, server->wayl, "footclient", cwd, token, cdata.argc, argv, &term_shutdown_handler, instance); if (instance->terminal == NULL) { -- cgit v1.3