The xscreensaver man page includes a nice perl script which you can use to accomplish the same thing. So here is "watchx.pl" script:
#!/usr/bin/perlThen, using dbus-send, you can set status in empathy.. I use the following scripts "empathy-away.sh":
my $blanked = 0;
open (IN, "xscreensaver-command -watch |");
while () {
if (m/^(BLANK|LOCK)/) {
if (!$blanked) {
system "/usr/local/bin/empathy-away.sh";
$blanked = 1;
}
} elsif (m/^UNBLANK/) {
system "/usr/local/bin/empathy-avail.sh";
$blanked = 0;
}
}
#!/bin/bashand "empathy-avail.sh":
USER=`whoami`
service=`qdbus | grep $USER | sed -e "s/ //g"`
path=`echo $service | sed -e "s/\./\//g"`
dbus-send --dest=$service /$path org.freedesktop.Telepathy.Connection.Interface.SimplePresence.SetPresence string:"away" string:"Away from keyboard"
#!/bin/bash
USER=`whoami`
service=`qdbus | grep $USER | sed -e "s/ //g"`
path=`echo $service | sed -e "s/\./\//g"`
dbus-send --dest=$service /$path org.freedesktop.Telepathy.Connection.Interface.SimplePresence.SetPresence string:"available" string:"Available"
NOTE: This is designed for one empathy account.. and that account name containing the users login name. Works on ubuntu lucid. Also - that dbus-send command is all on one line.
And to have it launch at login... create the following "watchx.desktop" file and place it in /etc/xdg/autostart:
[Desktop Entry]
Type=Application
Exec=/usr/local/bin/watchx.pl
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name[en_US]=Watch screen saver
Name=Watch screen saver
Comment[en_US]=Watch screen saver
Comment=Watch screen saver
You can make your avail/offline scripts much simpler by using `mc-tool`. For example this will make all accounts offline:
ReplyDeletemc-tool list | while read ACC; do mc-tool request $ACC offline; done