diff --git a/rootfs/usr/libexec/sway-systemd b/rootfs/usr/libexec/sway-systemd new file mode 100755 index 0000000..b44bde5 --- /dev/null +++ b/rootfs/usr/libexec/sway-systemd @@ -0,0 +1,23 @@ +#!/bin/sh + +export XDG_CURRENT_DESKTOP=sway +export XDG_SESSION_DESKTOP="${XDG_SESSION_DESKTOP:-sway}" +export XDG_SESSION_TYPE=wayland + +systemctl --user import-environment \ + SWAYSOCK \ + XDG_CURRENT_DESKTOP \ + XDG_SESSION_DESKTOP \ + XDG_SESSION_TYPE \ + WAYLAND_DISPLAY + +systemctl --user reset-failed +systemctl --user start sway-session.target + +shutdown() { + systemctl --user stop sway-session.target +} + +trap shutdown INT TERM +swaymsg -t subscribe '["shutdown"]' +shutdown