Skip to content

Instantly share code, notes, and snippets.

@iwishiwasaneagle
Last active May 5, 2023 15:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iwishiwasaneagle/f6ce7445146c222d894372e6a1287540 to your computer and use it in GitHub Desktop.
Save iwishiwasaneagle/f6ce7445146c222d894372e6a1287540 to your computer and use it in GitHub Desktop.
A simple persistent counter for binding to hotkeys.
#!/bin/bash
FILE=~/.counter
TITLE="Simple Counter"
if [ ! -f "$FILE" ];
then
echo 0 > $FILE
fi
C=$(($(cat $FILE)+1))
echo $C > $FILE
OUTPUT=$(notify-send "Counter incremented" $C -A reset='Reset counter' -a $TITLE)
if [ "$OUTPUT" == "reset" ]
then
rm $FILE
notify-send "Counter has been reset" -a $TITLE
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment