tim: "System Status: Degraded" (degraded)
For reasons, I find myself using a Linux machine -- specifically one running Ubuntu Trusty (for all intents and purposes) -- and for other reasons, I wanted my screensaver to display random photos from a folder (specifically a folder of images from posts I liked on Tumblr, but that part is separate).

My computer was set up to use the Cinnamon desktop manager and I didn't want to change that especially (something that I learned when I unintentionally uninstalled it while trying to change the screensaver). In Cinnamon you change the screensaver by going to the system settings and then selecting the Screensaver icon, which presents you with a list of possible screensavers, most of which are from xscreensaver. One option is the GLSlideshow program, which did exactly what I wanted: displays photos from a folder you select.

Only problem is, the System Settings GUI lets you choose GLSlideshow as your screensaver but doesn't have any configuration options that are screensaver-specific. So there's no way in the GUI to select the folder of pictures you want to use.

An easy way to address this problem would be to set Cinnamon's internal screensaver to never trigger and to install xscreensaver. But I wanted to run my screensaver when I clicked on the Lock Screen menu option. I couldn't figure out a way to reconfigure Cinnamon's menu options, so I resolved to find a solution that didn't require me to do that or to disable or circumvent Cinnamon's screensaver.

After some digging, I discovered that you can configure the folder GLSlideshow uses by creating a ~/.xscreensaver file -- this post answers that part of the question.

After I added that dotfile -- oh, and also deleted my ~/.cache directory, which took another 15 or so minutes to figure out (an alternative I tried first, which worked just as well, I think, is to rename the directory with your photos in it, and edit the .xscreensaver file to reflect the new name) -- I had a screensaver that showed random photos from my chosen directory when I locked my screen, but the photo that it chose would stay the same for a long time; I wanted the photos to alternate faster.

edited to add, 2016-05-13: You may also have to delete your ~/.xscreensaver-getimage.cache file, and/or ~/tmp/.xscreensaver-getimage.cache.

After another 15-20 minutes of digging, I found that GLSlideshow has two command-line options, -pan and -duration, that control how long it displays a single photo for. I still don't quite understand the semantics of these flags, but it suffices to set the pan and duration values to the same integer (5 seconds seems reasonable) to get the behavior I want. This is explained in this post.

Okay, but how do I actually pass those flags? GLSlideshow gets invoked by some widget that's part of Cinnamon that I can't change, and which doesn't expose that configuration in the UI? There is a solution that you get when you search for this problem, and it's wrong, or at least, doesn't work with Cinnamon on Trusty.

The solution is a hack: a single command

gsettings set org.cinnamon.desktop.screensaver xscreensaver-hack "glslideshow -pan 5 -duration 5"

to replace the specific xscreensaver module that the Cinnamon screensaver runs (the "xscreensaver hack") with that same module, suffixed by the flags that you want to pass to it. This works, although perhaps it shouldn't. Now I have a screensaver that displays a random photo from my photos folder and changes the photo every 5 seconds! Yay!

But in the meantime -- false starts, accidentally uninstalling Cinnamon (turns out if you use apt to uninstall the Cinnamon screensaver, it helpfully removes all of Cinnamon), and all -- I spent about 2 hours doing something that would take about 3 minutes on a Mac.

How's 2016, the year of the Linux desktop, treating you?

Profile

tim: Tim with short hair, smiling, wearing a black jacket over a white T-shirt (Default)
Tim Chevalier

September 2017

S M T W T F S
     12
3 4 56789
10 111213141516
17181920212223
24252627282930

Syndicate

RSS Atom

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags