Skip to content

Commit

Permalink
feat: exit with 1 when paused for is-paused (#1378)
Browse files Browse the repository at this point in the history
feat: exit with `1` when paused for `is-paused`
  • Loading branch information
cwrau authored Sep 26, 2024
1 parent e7ddf50 commit c1cc6d1
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions dunstctl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ show_help() {
notification with given ID
history-rm ID Remove the notification from
history with given ID.
is-paused Check if pause level is greater than 0
is-paused [-e|--exit-code] Check if pause level is greater than 0, optionally with exit code instead of text output
set-paused true|false|toggle Set the pause status
get-pause-level Get the current pause level
set-pause-level level Set the pause level
Expand Down Expand Up @@ -117,7 +117,20 @@ case "${1:-}" in
fi
;;
"is-paused")
property_get paused | ( read -r _ _ paused; printf "%s\n" "${paused}"; )
exit=false
case "${2:-}" in
-e | --exit-code)
exit=true
;;
esac
property_get paused | {
read -r _ _ paused
if [ "$exit" = "false" ]; then
printf "%s\n" "${paused}"
elif [ "${paused}" = "false" ]; then
exit 1
fi
}
;;
"set-paused")
[ "${2:-}" ] \
Expand Down

0 comments on commit c1cc6d1

Please sign in to comment.