Skip to content

Instantly share code, notes, and snippets.

@AlexAti
Last active September 27, 2016 16:24
Show Gist options
  • Save AlexAti/f9472a4b1e5ca9e642bad84637b5bc10 to your computer and use it in GitHub Desktop.
Save AlexAti/f9472a4b1e5ca9e642bad84637b5bc10 to your computer and use it in GitHub Desktop.
A simple pomodoro timer that dims the screen, for macos.
## 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