黒服のホームページ WIRED AGENTS FOR WIRED GODS

POMODORO

This is a script to help the user employ the Pomodoro Technique to stay productive and focused. Download the script here. Grab a tomato here.

Break times are in seconds and easily modifiable. This script was written for a Mac with plan9port, but it should be trivially portable to notify-send.

#!/usr/bin/env rc

worktime=1530
shortbreak=300
longbreak=1800

if (~ $#1 0 || ! {echo $1 | grep -s '^[0-9]*$'} || ~ $#2 0) {
	echo usage: `{basename $0} reps task [...]
	exit
}

reps=$1
shift
task=$"*

fn notify {
	st=($task^':' Cycle `{eval 'echo ''#''^$i^''.''^$j'})
	terminal-notifier \
		-sound Submarine \
		-appIcon `{dirname $0}^'/tomato.png' \
		-title Pomodoro \
		-subtitle $"st \
		-message $"*
	echo $"st
	echo $"*
}

for(i in `{seq 1 $reps}) {
	for(j in `{seq 1 4}) { 
		notify Get to work!
		sleep $worktime
		if(~ $i $reps && ~ $j 4) {
			notify Congratulations! Done!
			exit
		}
		breaktime=`{
			~ $j 4
			&& echo $longbreak
			|| echo $shortbreak
		}
		notify Break time! $breaktime seconds.
		sleep $breaktime
	}
}
	

Page generated from this template.