From 15dafd4bca4e8e5477985d5b942754c3e8213d95 Mon Sep 17 00:00:00 2001 From: Alan Orth Date: Thu, 30 Sep 2021 18:57:16 +0300 Subject: [PATCH] sway/config: Launch swayidle and kanshi from systemd Launch swayidle and kanshi from systemd user session instead of via sway's config. This way they bind to the sway-session target and s- tart/stop automatically when sway is started/stopped. As a bonus, they don't get launched again when you reload sway. See: https://github.com/swaywm/sway/wiki/Systemd-integration --- sway/config | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/sway/config b/sway/config index 5d45e4b..3815e16 100644 --- a/sway/config +++ b/sway/config @@ -51,9 +51,6 @@ output * bg /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill # # You can get the names of your outputs by running: swaymsg -t get_outputs -# Manage outputs with kanshi -exec_always pkill kanshi; exec kanshi - # Wayland overlay bar for sound and brightness level exec mkfifo $SWAYSOCK.wob && tail -f $SWAYSOCK.wob | wob @@ -61,13 +58,10 @@ exec mkfifo $SWAYSOCK.wob && tail -f $SWAYSOCK.wob | wob # # Example configuration: # -set $lock_bg ~/Downloads/3121px-Jerusalem-2013-Temple_Mount-Dome_of_the_Rock-Detail_01.jpg - -exec swayidle \ - timeout 300 'swaylock -c 000000 -i $lock_bg' \ - timeout 600 'swaymsg "output * dpms off"' \ - resume 'swaymsg "output * dpms on"' \ - before-sleep 'swaylock -c 000000 -i $lock_bg' +# exec swayidle -w \ +# timeout 300 'swaylock -f -c 000000' \ +# timeout 600 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' \ +# before-sleep 'swaylock -f -c 000000' # # This will lock your screen after 300 seconds of inactivity, then turn off # your displays after another 300 seconds, and turn your screens back on when @@ -275,3 +269,6 @@ bar { } include /etc/sway/config.d/* + +# Start sway-session.target, to which kanshi.service and swayidle.service bind. +exec_always "systemctl --user import-environment; systemctl --user start sway-session.target"