Last active
September 27, 2016 16:24
-
-
Save AlexAti/f9472a4b1e5ca9e642bad84637b5bc10 to your computer and use it in GitHub Desktop.
A simple pomodoro timer that dims the screen, for macos.
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
## A pomodoro timer that dims the screen for resting periods ## | |
# Variables and constants | |
working=25 # Minutes until next break | |
resting=5 # Minutes of rest | |
RED='\033[0;31m' | |
NOC='\033[0m' | |
# First check if the brightness command is installed or else abort script | |
hash brightness 2>/dev/null || { echo -e >&2 "${RED}ERROR${NOC}: I require the 'brightness' command, so please do 'brew install brightness' so I can work with you!"; exit 1; } | |
while true | |
do | |
# Working | |
for (( minute=1; minute<$working; minute++ )) | |
do | |
echo "Minute $minute starting... after $working you rest!" | |
sleep 60 | |
done | |
# Resting | |
brightness 0 | |
read -t $((60 * $resting)) -p "Starting $resting minute rest period (press Enter to cancel)..." | |
brightness 1 | |
echo "Done! Let´s work!" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment