How do I put a different wallpaper on each monitor?

Raymond Chen

When you set a wallpaper on a multi-monitor system, that wallpaper goes onto each monitor. For example, if your wallpaper is a picture of a flower, each monitor shows that same flower. Commenter David Phillips wonders whether there is a way to set a different wallpaper on each monitor, or whether it is some sort of trick. It’s some sort of trick. And it’s a trick because it’s not something that the window manager folks intended to happen; rather, it’s just an artifact of how wallpapers work. The trick is to set your wallpaper to “tile” rather than “center” or “stretch”. When the window manager draws a tiled bitmap, it places the tiles so that the upper left corner of the primary monitor exactly coincides with the top left corner of a tile. The remaining tiles are then arranged around that anchor tile. You’re not listening. I said that I wanted a different picture on each monitor, not the same picture tiled across all of my monitors.

Yes, I know. Here comes the trick: Create a “monster tile”. For example, suppose you have two 800×600 monitors arranged side by side (primary on the left), and you want a tropical island on the primary monitor and a country road sunset on the second, like this:

Create a single bitmap that consists of the two images side by side. In our case, it would be a single 1600×600 bitmap.

When this bitmap is tiled, the “virtual infinite screen” looks like this:

And the upper left corner of the primary monitor lines up against the upper left corner of a tile, like so:

If your monitors aren’t the same size, you can still use this trick; you just need to add some dummy space to get the tiles to line up the way you want. For example, suppose your secondary monitor is smaller than your primary, positioned so that its top edge lines up with the top edge of the primary. Your “monster bitmap” would place the country road sunset in the corresponding position next to the bitmap you want to use for your primary monitor.

When this bitmap is tiled and the upper left corner of the tile is placed at the upper left corner of the primary monitor, you get the desired effect:

Ah, but what if you have a monitor above or to the left of your primary monitor? Since the bitmap is tiled, you just “wrap around” from the left of the “monster bitmap” to the extreme right. For example, if your monitors are arranged side by side but you have the secondary monitor on the left, then you still put the image for the secondary monitor on the right; that way, when the origin of your monitor system is placed against a tile, the image from the tile to the left is the one that shows up on your secondary monitor.

Given these examples, I leave you to develop the general algorithm.

0 comments

Discussion is closed.

Feedback usabilla icon