View Full Version : XWinWrap as screensaver
iznogood
December 3rd, 2006, 11:10 PM
Hi all,
just a question.Is it possible to use xwinwrap as a screensaver instead of xscreensaver or gnome-screensaver?
It would be nice if you have something running in the background (like slideshow) and if the screensaver is activated after some time, to bring the whole thing in the foreground
I believe apple has something like that.
Do we need to hack on xscreensaver code to achieve it or is it possible now??
i have seen some scripts that try to use xwinwrap as screensaver but they don't offer this kind of functionality
Any ideas ???
mikedee
December 4th, 2006, 01:24 AM
If I understand you correctly, you want the screensaver/movie to be showing behind (ie. with the -b option) but when the screensaver would normally show it just pops to the front and then goes back down after.
It sounds possible, you would have to kill and start another xwinwrap because as far as I know winwrap cannot change the options at runtime. This would probably look best if you showed the front one and then killed the behind one, it might look a little strange if you use transparency though.
You would not need to hack xscreensaver because it is designed to run any program when the screensaver starts and then send it a SIGTERM when the screensaver stops. This means all you need is a bash or python script which can detect that signal and then swap the 2 xwinwraps around (ie. kill one and start another).
Let me know if you need any more help or examples, I have some screensavers here which I would like to re-release at some point so maybe I will dig them out. It sounds like a cool idea, I haven't used xwinwrap recently but always thought it would be good for something like this.
BTW, the script that you come up with could be added to the scripting plugin so that it starts when the user logs in for the initial desktop background.
iznogood
December 4th, 2006, 07:54 AM
i would prefer not to kill - restart the screensaver, so i will see if i can change xwinwrap a bit so that it can change at least this option at runtime...
I will try it asap, thanks
mikedee
December 4th, 2006, 05:01 PM
I just had another thought, xwinwrap is not actually necessary. You can (maybe) run the screensaver or movie and then get state to make the window transparent and always below, then when the screensaver kicks in, the state options are changed and the window is brought to the top, there should be no need to kill and recreate it, so movies etc will keep running.
I havent checked it out totally, but it looks like a much simpler solution to patching xwinwrap (if it works :)). You can control it using dbus and python or bash.
iznogood
December 4th, 2006, 06:04 PM
ok i just came back from work and read you post...
I agree its the best thing but i need to get notified when the screensaver
starts and stops. I will dig into gnome-screensaver to see how i can do it.
Obviously dbus will help a lot, and this way we can have maximun code reuse
i will see what i can do, thanks
mikedee
December 4th, 2006, 06:35 PM
Damn Beryl and their data loss :evil:
All the information was on there before, all of the xscreensavers are just standalone apps which are started and killed when (in)activity is detected.
I think gnome-screensaver is a modified xscreensaver so the config will be different, but the principle is the same.
For xscreensaver you need to modify your ~/.xscreensaver file and add these lines below the program: line
programs: \
"Xwinwrap screensaver" xww-saver \n\
You must add all the \n\'s or it will not work.
The xww-saver must be in /usr/lib/misc/xscreensaver/ for it to work (your xscreensaver directory may be slightly different)
Now your script called xww-saver will be started when the screensaver starts and it sends it a SIGTERM when it finishes.
The only tricky bit for you is writing a script that loads the screensaver in the background when they login. The screensaver will then only change the state settings when it is started and change them back when it is stopped.
Here is a shell for a python script that acts as a screensaver.
#!/bin/env python
import signal
import time
import os
import sys
def stop_effect(sig_number, stack):
# dbus commands to put the screensaver at the bottom
sys.exit(0)
def start_effect():
#dbus commands here to bring the screensaver to the top
# attach start and stop functions to the sigterm
signal.signal(signal.SIGTERM, stop_effect)
# we have just launched the screensaver
start_effect()
while 1:
#do nothing, the screensaver is running we are just listening for the kill signal
time.sleep(60)
Examples of how to create a dbus object and then call methods are in my cairo-clock.py script.
This page is very helpful and also includes some special tips on how to start xscreensaver as the background in gdm. This would be nice to have as well so the login and the desktop have the same screensaver.
http://www.linuxcommand.org/man_pages/xscreensaver1.html
vBulletin® v3.7.1, Copyright ©2000-2008, Jelsoft Enterprises Ltd.