Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Tracking idletimes



Typing away merrily, Gossamer produced the immortal words:
> I want to put together a daemon to track idletime, the sort of thing
> that tells you to get up and stretch every half hour of worktime.

Make it sleep half an hour at a time then.
while :
do
  sleep $[60*30]
  do_whatever
done

> Trouble is, there's no way I can figure out to track "Last keypress in
> any virtual terminal" (I don't and can't use X) and finger is reporting
> invalid idletimes :(.

Not sure if there is a portable way to do that.  But your stated problem
doesn't require it.  If you want to restrict it to worktime, then wrap
vlock with a shell-function which does, eg:
function lockterm {
  killall -USR1 my_idle_daemon_name
  vlock -a
  killall -USR2 my_idle_daemon_name
}
and then adjust your daemon to handle the signals.

> If I run a shellscript that calls other programs, the idletime for
> that VT gets reset every time the secondary program is activated.  It
> also seems to like to report Mutt as un-idle even when it is.

What are you using to try and get 'idle time'?
-- 
--> Phil Pennock ; GAT d- s+:+ a22 C++(++++) UL++++/I+++/S+++/H+ P++@ L+++
E-@ W(+) N>++ o !K w--- O>+ M V !PS PE Y+ PGP+ t-- 5++ X+ R !tv b++>+++ DI+ D+
G+ e+ h* r y?



Messages sorted by: Reverse Date, Date, Thread, Author