-
-
Save jcla1/6522769 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# computer activity data collection for http://jehiah.cz/one-two/ | |
# initially by Jehiah Czebotar. Modified by Joseph Adams | |
FILE="data/misc/activity_log/`date +%Y%m%d`.log" | |
FRONT_APP="data/misc/cron/frontApp/frontApp.applescript" | |
function log_activity() | |
{ | |
local UTC=`date "+%s,%Z"` | |
local IDLE=$((`/usr/sbin/ioreg -c IOHIDSystem | sed -e '/HIDIdleTime/!{ d' -e 't' -e '}' -e 's/.* = //g' -e 'q'` / 1000000000 )) | |
local ACTIVE_PROGRAM=$(/usr/bin/osascript $FRONT_APP) | |
echo "$UTC,$IDLE,$ACTIVE_PROGRAM" >> $FILE | |
} | |
log_activity | |
sleep 30 | |
log_activity |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tell application "System Events" | |
name of first application process whose frontmost is true | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment