Wednesday, August 31, 2011

Electric Sheep on KDE 4.6.5 with Fedora 15 (using Intel graphics card)


This post begins with a few important updates; scroll down to see the bulk of the original post.

Fedora 16 update: If you are using Fedora 16, then see updates from a newer post about how to get ElectricSheep built and running.

DPMS Update (getting monitors to sleep/standby/suspend/turn off on schedule again): It turns out that electricsheep is preventing my monitors from getting DPMS sleep/standby/off signals because of a bug in mplayer that was fixed today in SVN r34074. If you pull down the updated mplayer and build it yourself, your DPMS problems with electricsheep will be fixed. If you aren't willing to pull down the SVN source and build the fixed binary, you could use something like this sample electricsheep-wrapper script that starts both electricsheep and a secondary process that reads waiting times from xset q, sleeps for those times, and then issues the appropriate xset dpms force commands. To use the hack, all references to electricsheep in KDE or xscreensaver configuration files must be changed to electricsheep-wrapper and the electricsheep-wrapper script has to be installed in a directory in the PATH. Or, again, you can just wait for mplayer to get patched in your Linux distribution.

KDE update: electricsheep's SourceForge SVN includes a Desktop file for KDE, and so I've updated the stuff below to use it instead. It's probably a good idea to check out their updated SVN repository at GoogleCode to see if the support files have improved.

Multiple Monitors update: KDE will stretch one electricsheep across all of your monitors. Instead, if you want electricsheep to put a different instance on each monitor, use xscreensaver instead of kscreensaver. To do so, you'll have to follow the instructions for using xscreensaver on KDE, which are also on the xscreensaver man page. I modified step 4 to use my own custom system-level kscreenlocker that doesn't force everyone on the system to use xscreensaver. Additionally, to get electricsheep to show up in the xscreensaver-demo menu, you need to not only install the relevant electricsheep.xml file (find it in the source repo's or built it yourself), but you also have to add a line to your own ~/.xscreensaver configuration file. I don't know why the former doesn't generate the latter. On one of my machines, it does. On the other, it doesn't.

Of course, YMMV.


I installed electric sheep today because I was bored of my ASCIIQuarium KDE screensaver and not thrilled about the other options (some of which bail out on my dual screen Intel setup). [ If you're not familiar with Electric Sheep, you should check out the Electric Sheep Wikipedia page which discusses how the screensaver evolves over time. It's a distributed computing project, and the genetic algorithm that guides the evolution actually takes input from Electric Sheep users (well, not me, because I don't have the keyboard support to "up" and "down" the sheep I see). So the screen saver is constantly downloading and processing new AVI's, generating new content, and contributing it back to the network. I like it because it's pretty screen saver diversity at the cost of a few computing cycles and some disk space. ] It wasn't so bad, but it also wasn't trouble free. Here's what I did (which almost worked entirely without me having to do anything special):
  1. Use the Fedora-specific script from Tait Clarridge's page on downloading and installing electric sheep in Fedora (if you are running Fedora 16, see my updated script instead).
  2. Learn from Giulio Guzzinati about the need to add an electric sheep KDE Desktop file to get the screensaver into the KDE Screen Saver configuration tool.
Unfortunately, Giulio Guzzinati's desktop file didn't work for me, and so I had to build my own use the desktop file inside the electricsheep distribution. Here the file that ended up "working" for me (which is downloadable as electricsheep.desktop, but I copied from electricsheep.desktop.kde in the SVN repo).
[Desktop Entry]
Exec=electricsheep
Icon=kscreensaver
Type=Service
X-KDE-ServiceTypes=ScreenSaver
TryExec=xscreensaver
Actions=InWindow;Root;Setup;
X-KDE-Category=Fractals Screen Savers
X-KDE-Type=xv
Name=ElectricSheep

[Desktop Action Setup]
Exec=electricsheep-preferences
Name=Setup...

[Desktop Action InWindow]
Exec=electricsheep -window-id %w
Name=Display in Specified Window
NoDisplay=true

[Desktop Action Root]
Exec=electricsheep -window-id %w
Name=Display in Root Window
NoDisplay=true

X-Ubuntu-Gettext-Domain=desktop_kdeartwork
As explained in Giulio Guzzinati's post, you can place that file in
/usr/share/kde4/services/ScreenSavers/
You can probably put it in
~/.kde/share/services/ScreenSavers/
as well (you might have to create that directory first) if you'd rather do something local. That put the Electric Sheep across both of my monitors. If you'd rather put a separate electricsheep in each monitor, use xscreensaver instead of KDE's screen saver. If you're having trouble getting your monitors to go to sleep while electricsheep is running, then you need to get an updated mplayer that fixes the bug that causes that problem (see the updates at the top of this post for more information). Alternatively, you can use a hack like this electricsheep-wrapper script to re-enable DPMS-like timeouts during the screensaver. To use the hack, all references to electricsheep in KDE or xscreensaver configuration files must be changed to electricsheep-wrapper and the electricsheep-wrapper script has to be installed in a directory in the PATH. However, it probably won't be too long until the mplayer DPMS fix reaches your Linux distribution.

1 comment:

hoboprimate said...

Thanks a lot for the script, works fine in Fedora 17.
If you use Gnome3, you'll need to install xscreensaver and add electricsheep to its list of screensavers. I found instructions to do so here, they work fine in Fedora: http://www.webupd8.org/2011/11/how-to-get-electric-sheep-to-work-with.html