├── .SRCINFO ├── LICENSE ├── PKGBUILD ├── README.md ├── notification.wav └── potato.sh /.SRCINFO: -------------------------------------------------------------------------------- 1 | # Generated by mksrcinfo v8 2 | # Sat Apr 21 11:34:03 UTC 2018 3 | pkgbase = potato 4 | pkgdesc = A pomodoro timer for the shell 5 | pkgver = 6 6 | pkgrel = 1 7 | url = https://github.com/Bladtman242/potato 8 | arch = any 9 | license = MIT 10 | depends = alsa-utils 11 | source = potato.sh 12 | source = notification.wav 13 | source = LICENSE 14 | md5sums = 3d5707d4194f205502fa2c2778252b90 15 | md5sums = b01bacb54937c9bdd831f4d4ffd2e31c 16 | md5sums = 1ddcbd2862764b43d75fb1e484bf8912 17 | 18 | pkgname = potato 19 | 20 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Bladtman242 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /PKGBUILD: -------------------------------------------------------------------------------- 1 | pkgname=potato 2 | pkgver=6 3 | pkgrel=1 4 | pkgdesc="A pomodoro timer for the shell" 5 | arch=('any') 6 | url="https://github.com/Bladtman242/potato" 7 | license=('MIT') 8 | depends=('alsa-utils') 9 | source=('potato.sh' 10 | 'notification.wav' 11 | 'LICENSE') 12 | md5sums=('3d5707d4194f205502fa2c2778252b90' 13 | 'b01bacb54937c9bdd831f4d4ffd2e31c' 14 | '1ddcbd2862764b43d75fb1e484bf8912') 15 | package() { 16 | install -D $srcdir/potato.sh $pkgdir/usr/bin/$pkgname 17 | install -D -m644 $srcdir/LICENSE $pkgdir/usr/share/licenses/$pkgname/LICENSE 18 | install -D $srcdir/notification.wav $pkgdir/usr/lib/$pkgname/notification.wav 19 | } 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # potato 2 | 3 | A pomodoro timer for the shell. 4 | 5 | ## Credits 6 | Notification sound (notification.wav, originally 7 | zapsplat\_mobile\_phone\_notification\_003.mp3 decoded and saved as wav with 8 | mpg123) 9 | obtained from [zapsplat.com](https://www.zapsplat.com/) under Creative Commons 10 | CC0. 11 | 12 | -------------------------------------------------------------------------------- /notification.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bladtman242/potato/04225e444d2e169900b09c9774dfd02a0af22dce/notification.wav -------------------------------------------------------------------------------- /potato.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | WORK=25 4 | PAUSE=5 5 | INTERACTIVE=true 6 | MUTE=false 7 | 8 | show_help() { 9 | cat <<-END 10 | usage: potato [-s] [-m] [-w m] [-b m] [-h] 11 | -s: simple output. Intended for use in scripts 12 | When enabled, potato outputs one line for each minute, and doesn't print the bell character 13 | (ascii 007) 14 | 15 | -m: mute -- don't play sounds when work/break is over 16 | -w m: let work periods last m minutes (default is 25) 17 | -b m: let break periods last m minutes (default is 5) 18 | -h: print this message 19 | END 20 | } 21 | 22 | play_notification() { 23 | aplay -q /usr/lib/potato/notification.wav& 24 | } 25 | 26 | while getopts :sw:b:m opt; do 27 | case "$opt" in 28 | s) 29 | INTERACTIVE=false 30 | ;; 31 | m) 32 | MUTE=true 33 | ;; 34 | w) 35 | WORK=$OPTARG 36 | ;; 37 | b) 38 | PAUSE=$OPTARG 39 | ;; 40 | h|\?) 41 | show_help 42 | exit 1 43 | ;; 44 | esac 45 | done 46 | 47 | time_left="%im left of %s " 48 | 49 | if $INTERACTIVE; then 50 | time_left="\r$time_left" 51 | else 52 | time_left="$time_left\n" 53 | fi 54 | 55 | while true 56 | do 57 | for ((i=$WORK; i>0; i--)) 58 | do 59 | printf "$time_left" $i "work" 60 | sleep 1m 61 | done 62 | 63 | ! $MUTE && play_notification 64 | if $INTERACTIVE; then 65 | read -d '' -t 0.001 66 | echo -e "\a" 67 | echo "Work over" 68 | read 69 | fi 70 | 71 | for ((i=$PAUSE; i>0; i--)) 72 | do 73 | printf "$time_left" $i "pause" 74 | sleep 1m 75 | done 76 | 77 | ! $MUTE && play_notification 78 | if $INTERACTIVE; then 79 | read -d '' -t 0.001 80 | echo -e "\a" 81 | echo "Pause over" 82 | read 83 | fi 84 | done 85 | --------------------------------------------------------------------------------