From 4b6644bc68bcca289f5f357ea29cbf913ee84921 Mon Sep 17 00:00:00 2001 From: Daniil Tsivinsky Date: Sat, 23 Oct 2021 21:57:30 +0300 Subject: [PATCH] Add do-not-disturb module --- bin/dnd | 8 ++++++++ config/waybar/config | 7 +++++++ config/waybar/style.css | 1 + 3 files changed, 16 insertions(+) create mode 100755 bin/dnd diff --git a/bin/dnd b/bin/dnd new file mode 100755 index 0000000..c5482b4 --- /dev/null +++ b/bin/dnd @@ -0,0 +1,8 @@ +#! /bin/bash +# Copied from https://github.com/Alexays/Waybar/wiki/Module:-Custom#dunst + +COUNT=$(dunstctl count waiting) +ENABLED= +DISABLED= +if [ $COUNT != 0 ]; then DISABLED=" $COUNT"; fi +if dunstctl is-paused | grep -q "false" ; then echo $ENABLED; else echo $DISABLED; fi diff --git a/config/waybar/config b/config/waybar/config index d3fd17b..30835ec 100644 --- a/config/waybar/config +++ b/config/waybar/config @@ -4,6 +4,7 @@ "modules-right": [ "custom/weather", "custom/pacman-updates", + "custom/dnd", "pulseaudio", "sway/language", "network", @@ -43,6 +44,12 @@ "on-click": "alacritty -e sudo pacman -Syu", "tooltip": false }, + "custom/dnd": { + "exec": "$HOME/dotfiles/bin/dnd", + "on-click": "dunstctl set-paused toggle", + "restart-interval": 0, + "tooltip": false + }, "pulseaudio": { "tooltip": false, "format-muted": "MUTE" diff --git a/config/waybar/style.css b/config/waybar/style.css index 541ee0b..1c965ed 100644 --- a/config/waybar/style.css +++ b/config/waybar/style.css @@ -38,6 +38,7 @@ window#waybar { color: @primary; } +#custom-dnd, #custom-player, #custom-weather, #custom-pacman-updates,