From efea899ccbf713bb5b255f58636db1cfb3f0472c Mon Sep 17 00:00:00 2001 From: Daniele Fucini Date: Mon, 26 Oct 2026 17:31:03 +0100 Subject: [PATCH] Pause dunst while the screen is locked; add notification history keys screen-lock holds notifications until unlock, and M-S-l now goes through loginctl lock-session so it uses the same locker. M-S-n pops dunst history, M-C-n closes all notifications. --- .config/xmonad/xmonad.hs | 4 +++- .local/bin/screen-lock | 16 ++++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/.config/xmonad/xmonad.hs b/.config/xmonad/xmonad.hs index 2d6ce2d..ea81435 100644 --- a/.config/xmonad/xmonad.hs +++ b/.config/xmonad/xmonad.hs @@ -118,7 +118,9 @@ myConfig = logHook = myLogHook } `additionalKeysP` [ ("M-b", sendMessage ToggleStruts), - ("M-S-l", spawn "slock"), + ("M-S-l", spawn "loginctl lock-session"), + ("M-S-n", spawn "dunstctl history-pop"), + ("M-C-n", spawn "dunstctl close-all"), ("", unGrab *> spawn ("scrot " ++ myScreenshotDir ++ myScreenshotName)), ("S-", unGrab *> spawn ("scrot -s " ++ myScreenshotDir ++ myScreenshotName)), ("M-S-", unGrab *> spawn ("scrot -u " ++ myScreenshotDir ++ myScreenshotName)), diff --git a/.local/bin/screen-lock b/.local/bin/screen-lock index 70f6284..b0d79bb 100755 --- a/.local/bin/screen-lock +++ b/.local/bin/screen-lock @@ -3,12 +3,24 @@ image=/usr/share/backgrounds/arch_1920x1080.png +# Hold notifications while locked; dunst shows them on unlock. A signal to this +# script is passed on to i3lock, as the old exec did. +was_paused=$(dunstctl is-paused 2>/dev/null) +dunstctl set-paused true 2>/dev/null +trap 'kill "$pid" 2>/dev/null' INT TERM HUP + # -n: stay in the foreground, as xss-lock needs to see when the screen is unlocked. # --indicator keeps the ring (and the layout text) visible before typing. # The layout's default spot (dx:dy+30) falls inside the ring: put it below. -exec i3lock -n -i "$image" -F -c 000000ff \ +i3lock -n -i "$image" -F -c 000000ff \ -e -f --indicator --keylayout 0 \ --layout-pos='ix:iy+r+40' --layout-color=ffffffff \ --layout-size=24 \ --time-color=ffffffff --date-color=ffffffff --date-str='%A, %d %B' \ - --ring-color=1793d1ff --line-uses-ring "$@" + --ring-color=1793d1ff --line-uses-ring "$@" & +pid=$! +# A trapped signal interrupts the first wait; the second waits for i3lock to exit. +wait "$pid" +wait "$pid" 2>/dev/null + +[ "$was_paused" = true ] || dunstctl set-paused false 2>/dev/null