Created
April 5, 2012 02:38
-
-
Save ryo1kato/2307584 to your computer and use it in GitHub Desktop.
Watch screensaver activity and log
This file contains hidden or 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/bash | |
# watch screensaver's lock/unlock activity and log | |
log=$HOME/usr/var/log/screensaver.log | |
DIE () { | |
touch $log | |
echo "ERROR: $*" | tee -a $log >&2 | |
} | |
# c.f. http://people.gnome.org/~mccann/gnome-screensaver/docs/gnome-screensaver.html#gs-intro | |
dbuswatch="type='signal',interface='org.gnome.ScreenSaver',member='ActiveChanged'" | |
touch $log | |
dbus-monitor "$dbuswatch" | while read line | |
do | |
case $line in | |
boolean*) | |
datetime=`date +%Y%m%d-%H:%M:%S` | |
echo "$datetime ActiveChanged: $line" >> $log | |
;; | |
*) | |
continue | |
;; | |
esac | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment