Browse and set wallpaper in Openbox with feh

Pretty much since I started using Openbox, I’ve been wanting a simple way to change the wallpaper from the right-click menu. I eventually found a way, using a script that reads my wallpaper directory and lists files it finds there. Clicking on the menu entry triggers feh, which sets the image to the root window. It’s not ideal, since really I don’t remember what some of those wallpapers look like, and the names aren’t obvious choices. But it’s a simple solution, even if it wasn’t so simple to figure out.

At the same time, I’ve been grinding my teeth over the fact that Ubuntu’s version of Mirage, a nifty GTK image viewer with only one dependency, is saddled with an inordinate amount of optional Gnome baggage. I could use a decent image viewer to screen photos … and sift through my wallpaper folder, to be honest. With Mirage so burdened, I wasn’t keen on auditioning more image viewers.

And then today, about an hour ago, the two puzzle pieces suddenly clicked. I was running Midnight Commander in a terminal emulator and double-clicked on a photo. Boing! Up pops feh, showing me the full image, with a bunch of right-click menu options — including setting the image as the background!

Doh! Of course! feh is an image viewer! Here’s the lightweight customizable command-line-triggerable imageviewer that I’ve been looking for … for months! I only ever install it to set the wallpaper, and it’s something I’ve been using since I started out with Openbox. But that’s just a bonus, an added little something on top of the image slideshow, indexing and montage/collage effects it offers.

I feel like someone punched me in the stomach. All this time and it was right under my nose. šŸ˜

So anyway, add this line to an Openbox menu for a pop-up feh window that will let you peruse through a folder of images — of almost any type — and set one to the background through a right-click menu.

feh -g 640x480 -d -S filename /home/kmandla/wallpaper/

The -g option keeps the previews within 640×480, while the -d option shows the filename over the photo, in case you’re keeping track. -S sorts them by filename, and there are other options than that. Change you folder location to match your machine, and while you’re at it you might double-check the other feh options that are available to you. There are a LOT.

Right now I’m going to go kick myself repeatedly, for waiting almost a year to spend the 10 minutes it took to figure this out. šŸ‘æ

9 thoughts on “Browse and set wallpaper in Openbox with feh

  1. taghof

    Thanks…just what i needed. Did some further digging and found that with feh’s action and bg-center commands you don’t even need to lift your fingers from the keyboard.

    Reply
  2. devnet

    Something I’ve done with openbox on Foresight Linux is to enable gnome-settings-daemon in my autostart.sh

    from there, I can call “nautilis –no-deskop” and browse my file structure in thumbnails so looking at wallpapers becomes a snap šŸ™‚

    Beware that not adding –no-desktop to the nautilis command will snafu your openbox instance so make sure you remember to add that to your obmenu entry.

    Reply
  3. Pingback: More fun GTK1.2 stuff « Motho ke motho ka botho

  4. Pingback: Making feh work for you « Motho ke motho ka botho

  5. Jamie

    Feh is an amazing program šŸ™‚
    When I was using Gnome, I prefered using Feh to view an image instead of the default programs like Eye Of Gnome (EOG)

    Reply
  6. Lane Lester

    That’s a neat trick, but on my Debian Lenny Openbox system, the wallpaper change doesn’t stick after a fresh logon.

    Reply

Leave a comment