I've been trying to writie a script (or at one time even reprogramming the application) which plays a song while a screensaver is running. I understand that GNOME 3 doesn't really have that much support for screensavers, but I like them so much as to not let them go.
At first I tried changing the command in the desktop file for the screensaver. I made it execute a script file with these lines:
Code: Select all
/usr/lib/xscreensaver/le_screensaver -root &
play /usr/share/sounds/le_music.ogg &
I have also tried using a script that's similar to the one I found in the FAQs section of the GNOME website.
Code: Select all
#!/usr/bin/perl -w
#gnome
my $cmd = "dbus-monitor --session \"type='signal',interface='org.gnome.ScreenSaver',member='ActiveChanged\"";
open (IN, "$cmd |") or die "Couldn't run dbus-monitor.\n";
print("dbus-monitor started.\n");
#kde
# my $cmd = "dbus-monitor --session \"type='signal',interface='org.freedesktop.ScreenSaver',member='ActiveChanged'\"";
while (<IN>) {
if (m/^\s+boolean true/) {
#when screensaver activates, run the following commands
print("Playing song. \n");
system("echo \"--------------------------------------------------------------------\" >> /tmp/play_sound.txt");
system("echo \"started:\" >> /tmp/play_sound.txt");
system("date >> /tmp/play_sound.txt");
system("play \"/home/user/le_music.mp3\"");
}
elsif (m/^\s+boolean false/) {
system("echo \"--------------------------------------------------------------------\" >> /tmp/play_sound.txt");
system("echo \"stopped:\" >> /tmp/play_sound.txt");
system("date >> /tmp/play_sound.txt");
system("echo \"--------------------------------------------------------------------\" >> /tmp/play_sound.txt");
print("Stopping song. \n");
system("kill `pgrep play`");
}
}
Might anyone else have an idea on this? If anyone's wondering about this I have the packages for xscreensaver installed (xscreensaver, xscreensaver-data, xscreensaver-data-extra, xscreensaver-gl, and xscreensaver-gl-extra).