Skip to content

Instantly share code, notes, and snippets.

@mariorez
Last active February 5, 2022 12:47
Show Gist options
  • Save mariorez/aabb4d72e98059e32ae1 to your computer and use it in GitHub Desktop.
Save mariorez/aabb4d72e98059e32ae1 to your computer and use it in GitHub Desktop.
# Paste this function in your ".bashrc" to enable the "pomo" command in your terminal
# POMODORO Terminal:
function pomo {
if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
echo -e "POMODORO Terminal\n"
echo "usage: pomo 25 minutes timeout"
echo -e " or: pomo [options] see options below\n"
echo "Options:"
echo " short: 05 minutes timeout"
echo " long: 15 minutes timeout"
return
fi
SLEEPTIME=1500 # 25 minutes in seconds
TITLE="POMODOR0"
SUBTITLE="Take a Break"
ICON="face-cool"
SOUND="beep -f 200 -d 1 -r 5 -n -f 300 -d 10 -r 4 -n -f 400 -d 100 -r 3"
if [ "$1" = "long" ]; then
SLEEPTIME=900 # 15 minutes in seconds
TITLE="LONG BREAK FINISHED"
SUBTITLE="Back to Work"
ICON="face-monkey"
SOUND="beep -f 1000 -r 2 -n -r 5 -l 10 --new"
elif [ "$1" = "short" ]; then
SLEEPTIME=300 # 5 minutes in seconds
TITLE="SHORT BREAK FINISHED"
SUBTITLE="Back to Work"
ICON="face-monkey"
SOUND="beep -f 1000 -r 2 -n -r 5 -l 10 --new"
fi
# LINUX users
if [ "$(uname)" == "Linux" ]; then
eval "(sleep $SLEEPTIME && notify-send '$TITLE' '$SUBTITLE' --icon=$ICON && $SOUND &)"
# MAC users
elif [ "$(uname)" == "Darwin" ]; then
eval "(sleep $SLEEPTIME && terminal-notifier -message '$SUBTITLE' -title 'Pomodoro' --subtitle '$TITLE' &)"
else
echo "Sorry! Unsupported operating system :(";
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment