The other day I decided to use an old screen as a secondary monitor for my laptop, sadly the wallpaper that is set using hroot was horribly stretched and I didn't like the result at all. So I've written this small bash script to run on the Openbox start.

RES=`xrandr | grep current`
arr=', ' read -r -a array <<< "$RES"
if [ $WIDTH -eq 2646 ]; then
	hsetroot -fill ~/wallpaper_wide.png &
	hsetroot -fill ~/wallpaper.png &

Basically what it does is reading the screen width in pixels using the xrandr command, and if the width of the current resolution equals 2646 (my laptop plus the secondary monitor) it is going to set the widescreen wallpaper, otherwise the standard wallpaper will be set.

It is easy to be combined with the Random reddit wallpaper script I wrote some weeks ago, but I'm not doing it at the moment, since I use that script at work, and this one is for my personal laptop that uses always the same wallpaper.