aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/dot_config/systemd/user/zellij-inhibit-suspend.service
diff options
context:
space:
mode:
authorLibravatar sommerfeld <sommerfeld@sommerfeld.dev>2026-05-29 11:18:14 +0100
committerLibravatar sommerfeld <sommerfeld@sommerfeld.dev>2026-05-29 11:18:14 +0100
commit0711f1b4a4045c583c63f494a61262ed1146a944 (patch)
treed58a14e6448e11de5510aedafe5cce1150a91637 /dot_config/systemd/user/zellij-inhibit-suspend.service
parent5ee66a0415e88f4fa78986c823dd1ad709524e70 (diff)
downloaddotfiles-0711f1b4a4045c583c63f494a61262ed1146a944.tar.gz
dotfiles-0711f1b4a4045c583c63f494a61262ed1146a944.tar.bz2
dotfiles-0711f1b4a4045c583c63f494a61262ed1146a944.zip
fix(suspend): only inhibit for SSH-spawned zellij sessions
A local zellij session (sway terminal, attended) shouldn't keep the laptop awake — that's the user actively in front of the machine, and normal suspend behaviour should apply. Only zellij sessions that were spawned from an SSH context need the persistent inhibit, so detach + disconnect leaves the host awake until the session ends. Use /proc/<pid>/environ to detect SSH-spawned zellij: the daemonised zellij server is exec'd by the client and Linux preserves the exec-time environment for the life of the process, so SSH_CONNECTION= survives the SSH session closing. Walk every running `zellij` pid; hold the lock as long as at least one of them has SSH_CONNECTION in its environ. The .path unit still fires on every zellij socket creation, but if no SSH-spawned zellij exists the watcher exits immediately and the service stops with no harm done — a couple of cheap process spawns per local session start, no inhibitor side-effects.
Diffstat (limited to 'dot_config/systemd/user/zellij-inhibit-suspend.service')
-rw-r--r--dot_config/systemd/user/zellij-inhibit-suspend.service6
1 files changed, 4 insertions, 2 deletions
diff --git a/dot_config/systemd/user/zellij-inhibit-suspend.service b/dot_config/systemd/user/zellij-inhibit-suspend.service
index 9e9ab40..ed15fff 100644
--- a/dot_config/systemd/user/zellij-inhibit-suspend.service
+++ b/dot_config/systemd/user/zellij-inhibit-suspend.service
@@ -1,8 +1,10 @@
[Unit]
-Description=Hold a systemd-inhibit lock while zellij sessions exist
+Description=Hold a systemd-inhibit lock while SSH-spawned zellij sessions exist
Documentation=man:systemd-inhibit(1) man:zellij(1)
# Independent of any graphical session: this is meant to run on
-# headless SSH-attached hosts too.
+# headless SSH-attached hosts too. The watcher itself decides whether
+# the current zellij activity warrants inhibiting (SSH-spawned only),
+# so a local zellij session won't keep the laptop awake.
[Service]
Type=simple