From a6b3a973bb3eac7740068b03917afaf8b84886b2 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Wed, 17 Mar 2021 14:46:39 +0100 Subject: [PATCH] sxhkd, polybar, dunst: Add setting no disturb mode By invoking key combination fn+F9 (XF86Search button), we can quiet dunst notifications. This change will be picked up by polybar and a small do not disturb symbol is shown in the top bar (a tiny moon). Both scripts are very simple and make use of a temporary file, so a little brittle but workable. --- polybar/.config/polybar/config | 9 ++++++++- sxhkd/.config/sxhkd/sxhkdrc | 3 +++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/polybar/.config/polybar/config b/polybar/.config/polybar/config index ac48e9a..5174185 100644 --- a/polybar/.config/polybar/config +++ b/polybar/.config/polybar/config @@ -59,7 +59,7 @@ module-margin-left = 2 modules-left = sxhkdmode workspaces pomo papersdue modules-center = music date -modules-right = networkspeed mail weather archupdates cpu temp volume battery +modules-right = dunstpaused networkspeed mail weather archupdates cpu temp volume battery ; do not use offsets for the bar, would only work with override-redirect ; and will mess up tray https://github.com/polybar/polybar/issues/1355 tray-position = right @@ -250,6 +250,13 @@ format-prefix = " " interval = 120 format-underline = ${colors.primary} +[module/dunstpaused] +type = custom/script +exec = sed -e 's/true/⏾/' -e 's/false//' /tmp/dunstpaused +exec-if = [ -f /tmp/dunstpaused ] +tail = true +format-underline = ${colors.primary} + [module/mail] type = custom/script exec = echo "$( [ $(systemctl --user --property=ActiveState show mbsync.timer) = 'ActiveState=active' ] && echo "" || echo "" ) $(notmuch count tag:inbox and tag:unread)" diff --git a/sxhkd/.config/sxhkd/sxhkdrc b/sxhkd/.config/sxhkd/sxhkdrc index 9c46761..c199b87 100644 --- a/sxhkd/.config/sxhkd/sxhkdrc +++ b/sxhkd/.config/sxhkd/sxhkdrc @@ -25,6 +25,9 @@ XF86AudioMute XF86Audio{LowerVolume,RaiseVolume} control-volume {down, up} +XF86Search + dunstctl set-paused toggle && echo "$(dunstctl is-paused)" > /tmp/dunstpaused + # Open terminal emulator (the variable gets set in sh module basic env vars) super + Return $TERMINAL