Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've tried a lot of things. I googled and followed tutorials and I'm still unable to have my wallpaper load on startup.

What I've done so far is I've added the wallpaper of my choice via feh

feh --bg-scale /home/MYNAME/Pictures/wallpaper123.jpg. This set's my wallpaper just fine.

Obviously after restart, the wallpaper is not loaded. So I followed some tutorials that had me do the following

I added this code #My wallpaper eval cat $HOME/.fehbg & to the autostart.sh file in /etc/xdg/openbox.

Well, when I restart, my wallpaper is never loaded.

I also tried adding a directory called "Wallpapers". I then copied the following code

 #!/bin/env bash
 ALIST=( `ls -w1 $WALLPAPERS` )
 let "number = $RANDOM"
 let LASTNUM="`cat $WALLPAPERS/.last` + $number"
 let "number = $LASTNUM % $RANGE"
 echo $number > $WALLPAPERS/.last

 feh --bg-scale $WALLPAPERS/${ALIST[$number]}

into a file called wallpaper.sh and saved it at ~/.config/openbox/

I ran chmod +x wallpaper.sh

and added

#Random wallpaper

to my autostart.sh file.

Still, nothing.

What am I doing wrong?

share|improve this question
~/.config/openbox/autostart (without .sh) it is executed as a shell script on startup (doesn't need +x) – Alex Apr 22 '14 at 22:20
Sorry, I'm not sure what you are trying to say. – Space Ghost Apr 23 '14 at 4:23

I actually solved this my self.

The mistake I was making was creating the wallpaper.sh file in ~/.config/openbox/

I should have only created a file called autostart.sh or autostart (either work for me) inside ~/.config/openbox/ and in that file I simply write feh --bg-scale /home/myusername/Pictures/nameOfPicture.png

I then save and close. After restarting, the wallpaper of my choice is displayed at startup.

I hope this helps somebody in the future.


Very important..

Do not forget to add & at the end of script, like I did just now.

So the updated autostart should look like this

feh --bg-scale /home/myusername/Pictures/nameOfPicture.png &

Forgetting to do so means that when openbox starts, it will execute the above but without the & that might be the only thing it executes and nothing else.

If anyone else more knowledgeable would like to clarify why this is bad or add more to this, please feel free.

share|improve this answer

You are doing it wrong; very wrong. Do not create any exec scripts. https://wiki.archlinux.org/index.php/openbox#Wallpaper_.2F_background_programs

share|improve this answer
Oh shoot. Is it because I forgot to add & at the end? I've reviewed what you linked a few times and the only discrepancy with the link's use of feh is the & at the end of the autostart file. I remember reading about how it's important to have that or otherwise everything else will not execute without the &. I will fix this right now. If there is anything else that I'm doing wrong, please let me know and if you can, more specifically. Thank's a lot. – Space Ghost Apr 23 '14 at 14:52

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.