From aab5d73c0f64b24226700460c27a0457e6c8c2b3 Mon Sep 17 00:00:00 2001 From: Bruno Carlin Date: Tue, 11 Feb 2025 15:23:05 +0100 Subject: [PATCH] feat(sway): enable a sway-session systemd target when sway starts --- sway/.config/sway/config | 4 ++++ systemd/.config/systemd/user/sway-session.target | 6 ++++++ 2 files changed, 10 insertions(+) create mode 100644 systemd/.config/systemd/user/sway-session.target diff --git a/sway/.config/sway/config b/sway/.config/sway/config index 28f7c01..89677af 100644 --- a/sway/.config/sway/config +++ b/sway/.config/sway/config @@ -310,3 +310,7 @@ for_window [class="^kitty$" instance="^meta$"] move scratchpad, scratchpad show #exec --no-startup-id nextcloud for_window [shell="xwayland"] title_format "%title [xwayland]" + +exec "systemctl --user import-environment {,WAYLAND_}DISPLAY SWAYSOCK; systemctl --user start sway-session.target" +exec swaymsg -t subscribe '["shutdown"]' && systemctl --user stop sway-session.target + diff --git a/systemd/.config/systemd/user/sway-session.target b/systemd/.config/systemd/user/sway-session.target new file mode 100644 index 0000000..30151b3 --- /dev/null +++ b/systemd/.config/systemd/user/sway-session.target @@ -0,0 +1,6 @@ +[Unit] +Description=sway compositor session +Documentation=man:systemd.special(7) +BindsTo=graphical-session.target +Wants=graphical-session-pre.target +After=graphical-session-pre.target