1# Script to enforce a 10 minute break every half hour from typing - 
2# Written for someone (Uwe Hollerbach) with Carpal Tunnel Syndrome.
3
4# If you type for more than 20 minutes straight, the script rings
5# the bell after every character until you take a 10 minute break.
6
7# Author: Don Libes, NIST
8# Date: Feb 26, '95
9
10spawn $env(SHELL)
11set start [clock seconds]	;# when we started our current typing period
12set stop [clock seconds]	;# when we stopped typing
13
14set typing 1200		;# twenty minutes, max typing time allowed
15set notyping 600	;# ten minutes, min notyping time required
16
17interact -nobuffer -re . {
18    set now [clock seconds]
19
20    if {$now-$stop > $notyping} {
21	set start [clock seconds]
22    } elseif {$now-$start > $typing} {
23	send_user "\007"
24    }
25    set stop [clock seconds]
26}
27