aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLibravatar sommerfeld <sommerfeld@sommerfeld.dev>2026-04-21 01:25:01 +0100
committerLibravatar sommerfeld <sommerfeld@sommerfeld.dev>2026-04-21 01:25:01 +0100
commit030848c18553283683507b78f569d457afae5319 (patch)
treed306925f5b6a2f5463508656ff731ad849ed7229
parentc1343b0e0cf1df3bd04e8ad824af4ff96369080c (diff)
downloaddotfiles-030848c18553283683507b78f569d457afae5319.tar.gz
dotfiles-030848c18553283683507b78f569d457afae5319.tar.bz2
dotfiles-030848c18553283683507b78f569d457afae5319.zip
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.
-rw-r--r--dot_config/sway/config4
-rw-r--r--dot_config/systemd/user/display-watcher.service14
-rw-r--r--dot_config/systemd/user/sway-session.target7
-rw-r--r--etc/vconsole.conf3
4 files changed, 25 insertions, 3 deletions
diff --git a/dot_config/sway/config b/dot_config/sway/config
index df05597..119849d 100644
--- a/dot_config/sway/config
+++ b/dot_config/sway/config
@@ -153,7 +153,5 @@ bar {
# ── Autostart ─────────────────────────────────────────────────────────────────
exec systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP
exec dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP
-exec mako
-exec poweralertd
exec "sleep 2 && ~/.config/sway/display-toggle.sh init"
-exec ~/.config/sway/display-watcher.sh
+exec systemctl --user start sway-session.target
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
diff --git a/etc/vconsole.conf b/etc/vconsole.conf
new file mode 100644
index 0000000..5b3f603
--- /dev/null
+++ b/etc/vconsole.conf
@@ -0,0 +1,3 @@
+# This is the fallback vconsole configuration provided by systemd.
+
+#KEYMAP=us