Monday, January 26, 2015

opensuse, fluxbox, feh

I've been using xli to handle my desktop backgrounds in Fluxbox in openSUSE 13.2, mainly because I incorrectly thought that feh was not available from the openSUSE repos. However, I was running into a few issues with my random wallpaper script; I just couldn't get it to properly autostart when I logged into Fluxbox, even after trying a number of different approaches.

I found one approach that actually did work, in this Arch Linux forum thread. Referring to that, I edited the ~/.fluxbox/startup file, replacing the exec fluxbox line with fluxbox &, and adding code for the sleep function. The resulting startup file looked like this:

#!/bin/sh
#
# fluxbox startup-script:
#
# Lines starting with a '#' are ignored.

# Change your keymap:
xmodmap "/home/steve/.Xmodmap"

# Applications you want to run with fluxbox.
# MAKE SURE THAT APPS THAT KEEP RUNNING HAVE AN ''&'' AT THE END.
#
# unclutter -idle 2 &
# wmnd &
# wmsmixer -w &
# idesk &


# Start fluxbox.
# Because it is the last app you have to run it with ''exec'' before it.
# Jan 25 2015 - changed 'exec fluxbox' to 'fluxbox &'

fluxbox &
fbpid=$!

sleep 2
{
   # Applications you want to run after fluxbox has started
   # MAKE SURE THAT APPS THAT KEEP RUNNING HAVE AN & AT THE END.
    /home/steve/wallpaper-script1 &
   } &

wait $fbpid

# or if you want to keep a log:
# exec fluxbox -log "/home/steve/.fluxbox/log"


The only problem with that approach was that if I did a "Restart" from the Fluxbox menu, then Fluxbox, instead of using my random wallpaper script, would use whatever was stored in ~/.fluxbox/lastwallpaper -- and that was whatever wallpaper had last been set by the fbsetbg command.

Then I ran the the following command and took a look at the output:

steve[~]$ fbsetbg -i

display doesn't set the wallpaper properly. Transparency for fluxbox and apps like aterm and xchat won't work right with it. Consider installing feh, wmsetbg (from windowmaker) or Esetroot (from Eterm) and I'll use them instead.

So I went back to YaST and found that, indeed, feh was available for installation. Added that, then ran the above command again:

steve[~]$ fbsetbg -i

feh is a nice wallpapersetter. You won't have any problems.

That's what you're supposed to see. Good.

Still, feh was unable to load any of my wallpapers! If I tried to load a random image from my wallpapers directory, I was seeing this sort of thing:

steve[~]$ fbsetbg -r /home/steve/wallpapers
feh WARNING: /home/steve/wallpapers/hugerock.jpeg - No Imlib2 loader for that file format
feh ERROR: Unable to load image /home/steve/wallpapers/hugerock.jpeg
steve[~]$ fbsetbg -r /home/steve/wallpapers
feh WARNING: /home/steve/wallpapers/red_rocks_on_the_beach-wallpaper-1366x768.jpg - No Imlib2 loader for that file format
feh ERROR: Unable to load image /home/steve/wallpapers/red_rocks_on_the_beach-wallpaper-1366x768.jpg

So I tried using feh with the -U switch to see which wallpapers feh could actually load:

steve[~]$ feh -U /home/steve/wallpapers
steve[~]$

It couldn't load any of 'em. Drat.

From YaST I could see that imlib2-1 was installed, but imlib2 was not, so I installed imlib2 to see if that would help. This also installed imlib2-loaders and libid3tag0.

That fixed the problem!!!

So, I no longer needed my random wallpaper script at all. Instead, I simply added the following line to the ~/.fluxbox/init file:

session.screen0.rootCommand: fbsetbg -r /home/steve/wallpapers

Then, from the Fluxbox menu, I clicked Reconfigure, then Restart, and was presented with a new, random wallpaper. Logged out, then back into Fluxbox, and again was presented with a new, random wallpaper, as expected. Mark this one "Solved."

No comments: