I don't run a desktop environment, but instead use a bare window manager (StumpWM). Thus, my usual method for setting a desktop background is to run display -window root <image file> from a WM startup script, which does what I want.

When using multiple monitors, the X root window stretches across both and includes dead space. Thus, running that command line causes the image to either be stretched or tiled across the entire window, which isn't useful. I can use -geometry to display an image on either monitor, but if I run that again (to view on both monitors) it overwrites the other. There doesn't seem to be any ability with display to display two images in one invocation.

How can I use display to display different images on both monitors? Alternatively, how else can I get the "desktop background image" effect without a desktop environment?


You could use montage to generate a single image that encompasses your whole display, and call display -window root on the resulting image.

Alternatively, you can use xloadimage which is happy to tile multiple images. It doesn't know about separate monitors, so if your images aren't full-screen or if you have different-size monitors, you may need to use -at or -geometry to adjust the image positions manually.

xloadimage -onroot -at 1680,0 image1.jpg -at 0,0 image2.png
| improve this answer | |
  • xloadimage works perfectly. Thanks. – Tom Hunt Mar 14 '16 at 3:41

This is what I ended up using:

IMG1="$(ls $DIR/*jpg | shuf | head -1)"
IMG2="$(ls $DIR/*jpg | shuf | head -1)"
montage  -background "#000000" -geometry 1920x1080 $IMG1 $IMG2 jpg:- | display  -foreground "#000000" -backdrop  -window root jpg:-

Displays 2 random images on the root window, luckily my monitors are running at the same resolution.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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