From 030848c18553283683507b78f569d457afae5319 Mon Sep 17 00:00:00 2001 From: sommerfeld Date: Tue, 21 Apr 2026 01:25:01 +0100 Subject: sway: manage mako, poweralertd, display-watcher via systemd user units Replace sway exec launches with a sway-session.target that BindsTo graphical-session.target and Wants mako, poweralertd, and a new display-watcher.service. Services now get restart-on-failure, journal integration, and clean shutdown when sway exits. --- dot_config/systemd/user/display-watcher.service | 14 ++++++++++++++ dot_config/systemd/user/sway-session.target | 7 +++++++ 2 files changed, 21 insertions(+) create mode 100644 dot_config/systemd/user/display-watcher.service create mode 100644 dot_config/systemd/user/sway-session.target (limited to 'dot_config/systemd/user') diff --git a/dot_config/systemd/user/display-watcher.service b/dot_config/systemd/user/display-watcher.service new file mode 100644 index 0000000..6ab3e40 --- /dev/null +++ b/dot_config/systemd/user/display-watcher.service @@ -0,0 +1,14 @@ +[Unit] +Description=Auto-toggle sway display layout on external plug/unplug +PartOf=graphical-session.target +After=graphical-session.target +ConditionEnvironment=SWAYSOCK + +[Service] +Type=simple +ExecStart=%h/.config/sway/display-watcher.sh +Restart=on-failure +RestartSec=2s + +[Install] +WantedBy=sway-session.target diff --git a/dot_config/systemd/user/sway-session.target b/dot_config/systemd/user/sway-session.target new file mode 100644 index 0000000..ba1d37b --- /dev/null +++ b/dot_config/systemd/user/sway-session.target @@ -0,0 +1,7 @@ +[Unit] +Description=sway compositor session +Documentation=man:systemd.special(7) +BindsTo=graphical-session.target +Wants=graphical-session-pre.target mako.service poweralertd.service display-watcher.service +After=graphical-session-pre.target +StopWhenUnneeded=yes -- cgit v1.2.3-70-g09d2