Add script to easily send replaceable notifys

This commit is contained in:
2024-02-28 14:12:52 +01:00
parent 36e62c9bbf
commit fa6f170e78

16
tree/.local/bin/notify-set Executable file
View File

@ -0,0 +1,16 @@
#!/usr/bin/env bash
# Send a notification using notify-send, but also give it a name to make it easily replaceable.
ID="$1"
DIR="/tmp/notify-ids/$(whoami)"
ID_PATH="$DIR/$ID"
mkdir -p "$DIR"
REPLACE_ID="$(cat "$ID_PATH" 2>/dev/null)";
if [ -n "$REPLACE_ID" ]; then
REPLACE_ID="--replace-id=$REPLACE_ID"
fi
notify-send $REPLACE_ID --print-id "${@:2}" > "$ID_PATH"