diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2020-03-09 17:47:10 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2020-03-09 17:47:10 +0000 |
| commit | 25792a7e8cd6bd1aa1486f08e8af6770d170da09 (patch) | |
| tree | c5ca7810b19817c3741f97622e26751e670c54ea /client.c | |
| parent | term: init: no need to roundtrip (diff) | |
server/client: add XDG_SESSION_ID to the default socket path
This allows multiple foot servers to run in multiple sessions.
Diffstat (limited to 'client.c')
| -rw-r--r-- | client.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -135,10 +135,13 @@ main(int argc, char *const *argv) } else { bool connected = false; + const char *xdg_session_id = getenv("XDG_SESSION_ID"); const char *xdg_runtime = getenv("XDG_RUNTIME_DIR"); if (xdg_runtime != NULL) { - snprintf(addr.sun_path, sizeof(addr.sun_path), "%s/foot.sock", xdg_runtime); + if (xdg_session_id == NULL) + xdg_session_id = "<no-session>"; + snprintf(addr.sun_path, sizeof(addr.sun_path), "%s/foot-%s.sock", xdg_runtime, xdg_session_id); if (connect(fd, (const struct sockaddr *)&addr, sizeof(addr)) == 0) connected = true; else |
