diff --git a/.config/sxhkd/sxhkdrc b/.config/sxhkd/sxhkdrc index 844e6e6..4d361f8 100644 --- a/.config/sxhkd/sxhkdrc +++ b/.config/sxhkd/sxhkdrc @@ -32,6 +32,8 @@ super + bracketright lmc mute_toggle super + backslash lmc deaf_toggle +super + bracketleft + dnd toggle super + shift + l keymap_toggle diff --git a/.local/bin/etc/statusbar/volume b/.local/bin/etc/statusbar/volume index 93e04e4..9de82f0 100755 --- a/.local/bin/etc/statusbar/volume +++ b/.local/bin/etc/statusbar/volume @@ -20,5 +20,11 @@ else mic="^c#dfdfdf^  " fi +if [ -f ~/.local/state/dnd_mode.lock ]; then + notifications="^c#ff0000^  " +else + notifications="^c#dfdfdf^  " +fi + vol=$(printf %3s $vol | tr ' ' ' ') -printf "^b#282828^%s%s^d^" "$mic" "$vol_info" +printf "^b#282828^%s%s%s^d^" "$mic" "$vol_info" "$notifications" diff --git a/.local/bin/etc/sxhkd/dnd/dnd b/.local/bin/etc/sxhkd/dnd/dnd new file mode 100755 index 0000000..679d104 --- /dev/null +++ b/.local/bin/etc/sxhkd/dnd/dnd @@ -0,0 +1,42 @@ +#!/bin/sh + +# Script to easily manage a do not disturb mode for dunst + +case "$1" in + start) + # notify-send -u low "dunst" "Do not disturb started" + dunstctl history-clear + dunstctl rule dnd_low enable + dunstctl rule dnd_normal enable + dunstctl rule sound_normal disable + touch ~/.local/state/dnd_mode.lock + pkill -RTMIN+4 $STATUSBAR + paplay ~/.local/bin/etc/sxhkd/dnd/notifications_disabled.mp3 ;; + stop) + # notify-send -u low "dunst" "Do not disturb stopped" + dunstctl rule dnd_low disable + dunstctl rule dnd_normal disable + dunstctl rule sound_normal enable + hist_size=$(dunstctl history | jq '.data[0] | length') + for i in `seq $hist_size`; do + dunstctl history-pop + done + rm ~/.local/state/dnd_mode.lock + pkill -RTMIN+4 $STATUSBAR + paplay ~/.local/bin/etc/sxhkd/dnd/notifications_enabled.mp3 ;; + toggle) + if [ -f ~/.local/state/dnd_mode.lock ]; then + dnd stop + else + dnd start + fi ;; + *) cat << EOF +dnd: dunst interface to manage a do-not-disturb-mode. + +Allowed options: + start Enable do-not-disturb-mode + stop Disable do-not-disturb-mode + toggle Toggle sound + +EOF +esac diff --git a/.local/bin/etc/sxhkd/dnd/notifications_disabled.mp3 b/.local/bin/etc/sxhkd/dnd/notifications_disabled.mp3 new file mode 100644 index 0000000..ae2f421 Binary files /dev/null and b/.local/bin/etc/sxhkd/dnd/notifications_disabled.mp3 differ diff --git a/.local/bin/etc/sxhkd/dnd/notifications_enabled.mp3 b/.local/bin/etc/sxhkd/dnd/notifications_enabled.mp3 new file mode 100644 index 0000000..31739c5 Binary files /dev/null and b/.local/bin/etc/sxhkd/dnd/notifications_enabled.mp3 differ diff --git a/.local/bin/tools/dnd_start b/.local/bin/tools/dnd_start deleted file mode 100755 index e9b218c..0000000 --- a/.local/bin/tools/dnd_start +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -notify-send -u low "dunst" "Do not disturb started" -dunstctl history-clear -dunstctl rule dnd_low enable -dunstctl rule dnd_normal enable -dunstctl rule sound_normal disable diff --git a/.local/bin/tools/dnd_stop b/.local/bin/tools/dnd_stop deleted file mode 100755 index e14b6b6..0000000 --- a/.local/bin/tools/dnd_stop +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -dunstctl rule dnd_low disable -dunstctl rule dnd_normal disable -dunstctl rule sound_normal enable -hist_size=$(dunstctl history | jq '.data[0] | length') -for i in `seq $hist_size`; do - dunstctl history-pop -done -notify-send -u low "dunst" "Do not disturb stopped"