Last active
May 5, 2023 15:33
-
-
Save iwishiwasaneagle/f6ce7445146c222d894372e6a1287540 to your computer and use it in GitHub Desktop.
A simple persistent counter for binding to hotkeys.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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