~~~
*NIX OS
Need two files (can be combined :D)
[activewin.sh]
#!/bin/sh # src = http://pastebin.com/FE14Kwqj WIN_ID=`xprop -root | grep "_NET_ACTIVE_WINDOW(WINDOW)"| cut -d ' ' -f 5` WIN_NAME=`xwininfo -id $WIN_ID | head -n 2 | tail -n 1` echo $WIN_NAME | cut -c 32-
[tracker.sh]
#!/bin/sh SAVE_TO=$HOME/Log/ # or wherever else :P while true; do (date; sh /path/to/getactivewin.sh; sleep 1) \ >>$SAVE_TO/activity-`/bin/date "+%Y%m%d"`.log; done
OK, then append this line in $HOME/.profile
nohup /full/path/to/tracker.sh &
Now, logout & login back to activate it.
- It'll log every second (change the sleep to some other number)
- The output can & should be massage a bit :D
No comments:
Post a Comment