Show the number of notifications via dunstctl

This commit is contained in:
Moritz Luedecke 2020-12-21 11:46:57 +01:00
parent 313731f0f2
commit 137361a95d
No known key found for this signature in database
GPG Key ID: 16A7C55D54A18BF9

View File

@ -23,6 +23,7 @@ show_help() {
history-pop Pop one notification from history
is-paused Check if dunst is running or paused
set-paused [true|false|toggle] Set the pause status
status [displayed|history|waiting] Show the number of notifications
debug Print debugging information
help Show this help
EOH
@ -83,6 +84,17 @@ case "${1:-}" in
property_set paused variant:boolean:"$2"
fi
;;
"status")
[ $# -eq 1 ] || [ "${2}" = "displayed" ] || [ "${2}" = "history" ] || [ "${2}" = "waiting" ] \
|| die "Please give either 'displayed', 'history', 'waiting' or none as status parameter."
if [ $# -eq 1 ]; then
property_get waiting | ( read -r _ _ waiting; printf " Waiting: %s\n" "${waiting}" )
property_get displayed | ( read -r _ _ displayed; printf " Currently displayed: %s\n" "${displayed}" )
property_get history | ( read -r _ _ history; printf " History: %s\n" "${history}")
else
property_get ${2} | ( read -r _ _ notifications; printf "%s\n" "${notifications}"; )
fi
;;
"help"|"--help"|"-h")
show_help
;;