aboutsummaryrefslogtreecommitdiff
path: root/dunstifyIDs.sh
diff options
context:
space:
mode:
Diffstat (limited to 'dunstifyIDs.sh')
-rwxr-xr-xdunstifyIDs.sh9
1 files changed, 7 insertions, 2 deletions
diff --git a/dunstifyIDs.sh b/dunstifyIDs.sh
index 1b795e3..0dcd77f 100755
--- a/dunstifyIDs.sh
+++ b/dunstifyIDs.sh
@@ -1,5 +1,10 @@
#!/bin/sh
-# Obtain an id from ~/.config/dunst/dunstifyIDs by grepping a word. For using with dunstify for replaceable notifications.
+# Obtain an id from ~/.config/dunst/dunstifyIDs by grepping a word.
+# Use with dunstify for autoreplacing notifications by string identifier.
-cat $HOME/.config/dunst/dunstifyIDs | grep $1 | awk '{print $2}'
+configFile="$HOME/.config/dunst/dunstifyIDs"
+[ ! -f "$configFile" ] && dunstify "'$configFile' missing!" && exit 1
+id="$(grep "$1" <"$configFile" | awk '{print $2}')"
+[ -z "$id" ] && dunstify "'$1' ID not set in '$configFile'" && exit 1
+echo "$id"