Last active
March 5, 2021 04:01
-
-
Save sokolovvs/ba8cc7e109434efd3d6911f8c7c3729e to your computer and use it in GitHub Desktop.
Simple timer (shell scripts, uses notify-send)
This file contains 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
#!/usr/bin/env bash | |
function help() { | |
echo "Please, run this script with one argument." | |
echo "Examples:" | |
echo "1) $0 1h" | |
echo "2) $0 30m" | |
echo "3) $0 125s" | |
echo "4) $0 1h <your message>" | |
echo "5) $0 30m <your message>" | |
echo "6) $0 125s <your message>" | |
} | |
if [[ $# -gt 0 ]] | |
then | |
if [[ $1 =~ ^[1-9]*[0-9]*[h|m|s]$ ]] | |
then | |
sleep $1 && | |
notify-send --urgency normal \ | |
--expire-time=10000 \ | |
-i /usr/share/icons/hicolor/48x48/apps/unity-datetime-panel.png \ | |
"Timer" "$2" | |
else | |
help | |
fi | |
else | |
help | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment