Add script for displaying and toggling dunst status
This commit is contained in:
parent
e0bc6c1ea5
commit
47fb7194a5
31
arch-config/scripts/polybar/dunst-notification-display.sh
Normal file
31
arch-config/scripts/polybar/dunst-notification-display.sh
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
# checking for one argument here
|
||||||
|
if [ $# -eq 1 ]; then
|
||||||
|
# check if the argument is "toggle"
|
||||||
|
if [[ "$1" == "toggle" ]]; then
|
||||||
|
dunstctl set-paused toggle
|
||||||
|
# exit if something else is provided
|
||||||
|
else
|
||||||
|
echo "Wrong argument. Use \"toggle\""
|
||||||
|
$(exit 1); echo "$?"
|
||||||
|
fi
|
||||||
|
# reject too many arguments
|
||||||
|
elif [ $# -ge 2 ]; then
|
||||||
|
echo "Too many arguments provided"
|
||||||
|
$(exit 1); echo "$?"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# get the paused status of dunst
|
||||||
|
status="$(dunstctl is-paused)"
|
||||||
|
|
||||||
|
# if the status is false, dunst is paused
|
||||||
|
# notifications will wait until you reenable dunst
|
||||||
|
if [[ "$status" == "true" ]]; then
|
||||||
|
echo -e "\uf1f6"
|
||||||
|
# if the status returned false, dunst is running and active.
|
||||||
|
# you can recieve notifications
|
||||||
|
elif [[ "$status" == "false" ]]; then
|
||||||
|
echo -e "\uf0f3"
|
||||||
|
fi
|
Loading…
Reference in New Issue
Block a user