Skip to content

Instantly share code, notes, and snippets.

@wouter-veeken
Last active March 26, 2024 10:01
Show Gist options
  • Select an option

  • Save wouter-veeken/f5ca0cc6270fdcb92bb459786243b6d5 to your computer and use it in GitHub Desktop.

Select an option

Save wouter-veeken/f5ca0cc6270fdcb92bb459786243b6d5 to your computer and use it in GitHub Desktop.
Super lightweight pomodoro timer script, modified for Mac from https://github.com/sayanarijit/pomo. Just copy/paste into your `.bashrc` or equivalent.
# pomodoro timer (pomo <minutes> <message>)
function pomo() {
arg1=$1
shift
args="$*"
min=${arg1:?Example: pomo 15 Take a break}
sec=$((min * 60))
msg="${args:?Example: pomo 15 Take a break}"
for ((sec=min*60; sec>0; sec--)); do
((sec_left=sec%60))
((min_left=sec/60))
printf "%02d:%02d\r" $min_left $sec_left
sleep 1
done
printf "\n"
afplay /System/Library/Sounds/Glass.aiff && printf "$msg"
# say "$msg" # Uncomment this line to speak custom message instead of playing Glass.aiff
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment