Add script to easily send replaceable notifys
This commit is contained in:
16
tree/.local/bin/notify-set
Executable file
16
tree/.local/bin/notify-set
Executable 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"
|
||||||
Reference in New Issue
Block a user