Repository: rukshn/pomodoro Branch: master Commit: f93a9371209b Files: 4 Total size: 4.5 KB Directory structure: gitextract_p8e7traa/ ├── LICENSE ├── README.md ├── notification.ogg └── pomodoro.sh ================================================ FILE CONTENTS ================================================ ================================================ FILE: LICENSE ================================================ The MIT License (MIT) Copyright (c) 2016 Rukshan Ranatunge Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: README.md ================================================ # Pomodoro A simple pomodoro shell script ![Screenshot](http://i.imgur.com/P53pj9z.png) *How you see notifications* ![Screenshot](http://i.imgur.com/CQUuaBI.png) ## How to use You can either copy the code to your ~/.bashrc file or simply run source pomodoro.sh && pomo There after pomo ## Options pomo [option][message] Options -v version -h help screen -l long break -s short break -d duration in minutes [message] custom message to be displayed after timeout, make sure the message is under quotes ### Long breaks Long breaks are 15 minute breaks started by giving -l command, you will be notified after 15 minutes pomo -l ### Short breaks Short breaks are 5 minute breaks started by giving -s command, you will be notified after 5 minutes pomo -s ### Custom duration Sets custom duration of timer in minutes by giving -d command # 45 minute timer pomo -d 45 ## Messages Custom messages to be shown after breaks pomo -l 'time is up' pomo 'time is up' Made it during my spare time. Forkit, improve it, star it, have fun. Inspired by [this](https://twitter.com/rob_dodson/status/695864071837470720) ================================================ FILE: pomodoro.sh ================================================ #!/bin/bash # POMODORO in YA TerMINAL ;) function pomo { RED='\033[0;31m' NC='\033[0m' # No Color ORANGE='\033[0;33m' printf "${ORANGE}POMODORO in YA TERMINAL${NC}\n" if [[ "$1" == "-h" ]] || [[ "$1" == "--help" ]]; then echo "usage: pomo 25 minute cycle" echo -e " or: pomo [break]['_message_'] see options below\n" echo "Options:" echo " d: timer duration in minutes" echo " s: 05 minute break" echo " l: 15 minute break" echo " message: Your message to display" return fi if [[ "$1" == "-v" ]] || [[ "$1" == "--version" ]]; then echo -e "${ORANGE}POMODORO TIMER BY RUKSHAN" echo " v: 1.0.0.1" echo " twitter: @justruky" echo " blog: rukshn.github.io" echo -e " email: arkruka[@]gmail.com" return fi TITLE="POMODORO TIMER" MESSAGE="" ICON="face-cool" BEEP="_alarm 400 200" TIMER=1500 while : do case "$1" in -d | --duration) TIMER=$(($2*60)) shift 2 ;; -l | --long-break) MESSAGE="Long is break over, back to work" TIMER=900 shift ;; -s | --short-break) MESSAGE="Short is break over, back to work" TIMER=300 shift ;; -*) echo "Error: Unknown option: $1" >&2 return 1 ;; *) # No more options break ;; esac done if [ -n "$1" ]; then MESSAGE="$1" elif [ -z "$MESSAGE" ]; then MESSAGE="Time to take a break" fi echo -e "${RED}TIMER SET FOR $(($TIMER/60)) MINUTES" # LINUX users if [[ "$(uname)" == "Linux" ]]; then eval "(sleep $TIMER && notify-send '$TITLE' '$MESSAGE' --icon=$ICON && $BEEP &)" # MAC users elif [[ "$(uname)" == "Darwin" ]]; then eval "(sleep $TIMER && terminal-notifier -message '$MESSAGE' -title 'Pomodoro' --subtitle '$TITLE' && $BEEP &)" else echo "Sorry! Only Linux or Mac"; fi } _alarm() { if [[ "$(uname)" == "Linux" ]]; then paplay notification.ogg elif [[ "$(uname)" == "Darwin" ]]; then say -v bells 'beep' fi }