How to identify the first/second etc monitors in a Multi-Monitor setup?
Hi,
I'm new to Feh and is using it for my multi-monitor setup. My 2 monitors so far, have different resolutions and sizes. And I'm trying to use a list of files to set wallpapers on them, with different images, like:
feh --bg-center ~/wallpapers/2560x1080/ ~/wallpapers/1920x1080/
Such command set wallpapers, on the 2560x1080 monitor first, then on 1920x1080 one, according to my experiment.
My question is:
there is no way of telling what's the order of wallpaper setting up on these monitors - I mean that it's totally possible the order would be 1920x1080 then 2560x1080. 1. Is there a way to tell the monitors' indexes?
I ran xrandr locally to list out all monitors as well, which I got
Screen 0: minimum 320 x 200, current 4480 x 1080, maximum 16384 x 16384
DisplayPort-0 connected primary 2560x1080+0+0 (normal left inverted right x axis y axis) 820mm x 346mm
...
DisplayPort-1 disconnected (normal left inverted right x axis y axis)
HDMI-A-0 connected 1920x1080+2560+0 (normal left inverted right x axis y axis) 531mm x 298mm
...
HDMI-A-1 disconnected (normal left inverted right x axis y axis)
I see the connected monitors, in order, they are [DisplayPort-0, HDMI-A-0] . 2. So I'm guessing the xrandr would return a list of connected monitors, the same order as seen in Feh? Is it correct to assume that?
I asked because I want to write a script to automatically set wallpapers for each monitor, with correct resolutions. So that I would need to get an ordered list of resolutions for each monitor.
Thank you!
To be safe you could do 2 commands, like: DISPLAY=DisplayPort-0 feh --bg-center ~/wallpapers/2560x1080/;DISPLAY=DisplayPort-1 feh ~/wallpapers/1920x1080/`
Thank you for your suggestion, it's very insightful!
I tried the following command:
$: DISPLAY=DisplayPort-0 feh --bg-center ~/wallpapers/2560x1080/
feh ERROR: Can't open X display. It *is* running, yeah?
Seems like it's the wrong name for DISPLAY.
When I tried this:
DISPLAY=:0.0 feh --bg-center ~/wallpapers/2560x1080/
It works, but both of my desktops got set to the same wallpaper.
And by checking xrandr, seems like I only has 1 screen (screen 0) in Xserver. So the command DISPLAY=:0.1 feh --bg-center ~/wallpapers/2560x1080/ doesn't really work.
Sorry, that post was so wrong, I don't know why I wrote that...
How about using -g WIDTHxHEIGHT+X+Y for each image?
The command seems to work, but run it a second time for the second monitor would override the previous command.
Is it possible to split 2 monitors onto different x screens? Seems like Xinerama combined multiple monitors into a single screen.
If we could separate out the second monitor into DISPLAY=:0.1, then it would probably works.
0 ~ % xrandr --listactivemonitors
Monitors: 2
0: +*DVI-D-0 1680/474x1050/296+1680+0 DVI-D-0
1: +DP-1 1680/474x1050/296+0+0 DP-1
Respectively --listmonitors if that's different for you.
That's the order in which feh applies the backgrounds too, as you wrote above already. You can actually see that it's not left to right here, because index 0 is intentionally remapped to the right of index 1.
There doesn't seem to be a combination of flags to just query a single monitor, maybe with a native binding instead of the command line tool that's possible?
In any case you can parse the correct dimensions from the strings already, even if inconvenient; with the +X offset you could even figure out the order wrt. the X axis.
Hi!
@Ferada's answer sums it up pretty well. I'll leave this issue open for a few more days and consider it resolved if there's no further discussion.
I have added a reference to xrandr --listmonitors to the feh manual, thanks for pointing it out!