From ffd352074f7da9a9df7d9f3a8bb3f479d0c97504 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Sun, 22 Dec 2024 03:58:13 +0100 Subject: [PATCH] Inhibit swaync when session is locked --- home/.config/hypr/hypridle.conf | 11 +++++------ .../lock.target.wants/swaync-inhibit-lock.service | 1 + home/.config/systemd/user/swaync-inhibit-lock.service | 11 +++++++++++ .../systemd/user/swaync-inhibit-unlock.service | 11 +++++++++++ .../unlock.target.wants/swaync-inhibit-unlock.service | 1 + 5 files changed, 29 insertions(+), 6 deletions(-) create mode 120000 home/.config/systemd/user/lock.target.wants/swaync-inhibit-lock.service create mode 100644 home/.config/systemd/user/swaync-inhibit-lock.service create mode 100644 home/.config/systemd/user/swaync-inhibit-unlock.service create mode 120000 home/.config/systemd/user/unlock.target.wants/swaync-inhibit-unlock.service diff --git a/home/.config/hypr/hypridle.conf b/home/.config/hypr/hypridle.conf index df583f6..7feb48c 100644 --- a/home/.config/hypr/hypridle.conf +++ b/home/.config/hypr/hypridle.conf @@ -1,8 +1,8 @@ general { - unlock-cmd = killall -s SIGUSR1 hyprlock && dunstctl set-paused false - before_sleep_cmd = loginctl lock-session && dunstctl set-paused true && sleep 2 + unlock-cmd = killall -s SIGUSR1 hyprlock + before_sleep_cmd = loginctl lock-session ignore_dbus_inhibit = false ignore_systemd_inhibit = false; } @@ -10,16 +10,15 @@ general { # Warn about going idle (5 mins) listener { timeout = 300 - # use hyprland notifications, in case dunst notifs are paused or whatever + # use hyprland notifications, in case regular notifs are paused or whatever on-timeout = hyprctl notify 0 10000 "rgb(ff0000)" "fontsize:20 System going idle in 10 seconds..." on-resume = hyprctl dismissnotify 1 } -# Lock the session & disable dunst notifications +# Lock the session listener { timeout = 310 - on-timeout = loginctl lock-session && dunstctl set-paused true - on-resume = dunstctl set-paused false + on-timeout = loginctl lock-session } # Turn off the screen after another 50s diff --git a/home/.config/systemd/user/lock.target.wants/swaync-inhibit-lock.service b/home/.config/systemd/user/lock.target.wants/swaync-inhibit-lock.service new file mode 120000 index 0000000..bf1d322 --- /dev/null +++ b/home/.config/systemd/user/lock.target.wants/swaync-inhibit-lock.service @@ -0,0 +1 @@ +/home/itsdrike/.config/systemd/user/swaync-inhibit-lock.service \ No newline at end of file diff --git a/home/.config/systemd/user/swaync-inhibit-lock.service b/home/.config/systemd/user/swaync-inhibit-lock.service new file mode 100644 index 0000000..8361f71 --- /dev/null +++ b/home/.config/systemd/user/swaync-inhibit-lock.service @@ -0,0 +1,11 @@ +[Unit] +Description=Inhibit swaync notifications on lock dbus event (using systemd-lock-handler) +Requisite=swaync.service +Before=lock.target + +[Service] +ExecStart=/usr/bin/swaync-client --inhibitor-add screen-locker +Type=oneshot + +[Install] +WantedBy=lock.target diff --git a/home/.config/systemd/user/swaync-inhibit-unlock.service b/home/.config/systemd/user/swaync-inhibit-unlock.service new file mode 100644 index 0000000..6b36c81 --- /dev/null +++ b/home/.config/systemd/user/swaync-inhibit-unlock.service @@ -0,0 +1,11 @@ +[Unit] +Description=Uninhibit swaync notifications on unlock event +Requisite=swaync.service +After=unlock.target + +[Service] +ExecStart=/usr/bin/swaync-client --inhibitor-remove screen-locker +Type=oneshot + +[Install] +WantedBy=unlock.target diff --git a/home/.config/systemd/user/unlock.target.wants/swaync-inhibit-unlock.service b/home/.config/systemd/user/unlock.target.wants/swaync-inhibit-unlock.service new file mode 120000 index 0000000..5bf3a7d --- /dev/null +++ b/home/.config/systemd/user/unlock.target.wants/swaync-inhibit-unlock.service @@ -0,0 +1 @@ +/home/itsdrike/.config/systemd/user/swaync-inhibit-unlock.service \ No newline at end of file