Xrandr and i3: Command for Dual Monitor needs to be run twice (why?)

Hey there,

I have to admit, I created a similar thread yesterday. I’m fairly confident that the issue is more specifically about xrandr and probably also i3. That is, I suspect that there is an i3 setting in place that prevents the xrandr command to work as expected.

What I want
I installed EOS with i3 yesterday. I have two monitors, one 1920x1080 monitor on the left and one 2560x1440 monitor on the right. Out-of-the-box, everything works fine (the full bar at the bottom of each screen, windows on either the one monitor or the other); except that the default configuration assumes my smaller screen was on the right. I want to reverse the order.

This is the default after boot:

Screen 0: minimum 320 x 200, current 4480 x 1440, maximum 16384 x 16384
DP-1 disconnected primary (normal left inverted right x axis y axis)
DP-2 disconnected (normal left inverted right x axis y axis)
DP-3 connected 2560x1440+0+0 (normal left inverted right x axis y axis) 697mm x 392mm
HDMI-1 connected 1920x1080+2560+0 (normal left inverted right x axis y axis) 527mm x 296mm

If I understand the logic correctly, then I think in my case it should be:

DP-3 connected 2560x1440+1920+0
HDMI-1 connected 1920x1080+0+0

That is, DP-3 begins where HDMI-1 ends.

What I tried
I think the following command should result in the setting just given:

xrandr --output HDMI-1 --mode 1920x1080 --pos 0x0 --output DP-3 --primary --mode 2560x1440 --pos 1920x0

However, thinks look odd. Before I had my terminal emulator on the right monitor; afterwards it’s going over both screens.

What Somehow Works
If I run a series of commands, the result is actually exactly what I want:

xrandr --output HDMI-1 --mode 1920x1080 --pos 0x0 --output DP-3 --primary --mode 2560x1440 --pos 1920x0
xrandr --output HDMI-1 --mode 1920x1080 --pos 0x0 --output DP-3 --primary --mode 2560x1440 --pos 2560x0
xrandr --output HDMI-1 --mode 1920x1080 --pos 0x0 --output DP-3 --primary --mode 2560x1440 --pos 1920x0

Why doesn’t the command work in the first place? Naturally, I would prefer to run just one command on boot and be fine.


  • Is the xrandr command (or the command with -pos arguments) somehow relative to the setting currently in place?

Thanks for any insights!

where exactly you do run the command/s? the place would be in i3 config… and it could be you have saved xrandr/arandr file already that could be set in i3 config…
In addition it seems in some case that lightdm setting displays different i do always try to set display with the same xrandr script as on loading into i3…

there is this in i3 config:
exec_always --no-startup-id ~/.screenlayout/monitor.sh
if the file exist it will apply this…

in lightdm you can set xrandr script in the config:
in /etc/lightdm/lightdm.conf
and put your xrandr commands there as /etc/lightdm/monitor.sh p.e.


Thanks for your reply!

So far I had ran the commands only in the terminal. I don’t have the ~/.screenlayout/monitor.sh.

lightdm is a login application, isn’t it? During OS installation I checked that I want to log in automatically. Would lightdm-related config still be applied on boot?

Thanks again.

Maybe I can better explain the issue with a series of screenshots:

  1. As can be seen in this screenshot, per default xrandr thinks my smaller screen is on the right (when in fact the physical monitor is on the left). This can also be seen in arandr.
  2. Now, what I want is to take the part on the right and bring it over to the left. So, I reversed the order of the screens in arandr.
  3. Now, after I hit Apply in arandr, this is what my computer thinks I should see:

    Everything would be nice. The right monitor would contain the two windows it held before; and the smaller monitor would be the screen on the left.
  4. However, this is what I actually see:

So, maybe my question should instead be: Why might the virtual representation differ from what I actually see?

in this case i am sure it will not set x related things as it does not use x…

1 Like

this is indeed something strange… for me i have issues with displays are sorted by default in the wrong way all the time… but i can simply solve this with xrandr…

what it shows for you … is hard to reproduce in any way…:

looks like overlapping in a way… and it looks likw the right display is HDMI-1 and the left DP-3

Could you give the GPU infos?
inxi -Gaz | eos-sendlog

1 Like

Thanks for your reply. This is the result of the command. Does this suggest anything strange is going on?

Device-1: NVIDIA GA104 [GeForce RTX 3060 Ti Lite Hash Rate] driver: nouveau

mine :wink: =

  Device-1: NVIDIA GA106 [GeForce RTX 3060 Lite Hash Rate] driver: nvidia
    v: 535.54.03 alternate: nvidia_drm non-free: 530.xx+

similar GPU…

but you are using nouveau driver (open source) you may try changing to Nvidia driver to see if it does the same there… could be card card is still not 100% supported by nouveau driver…

NV170 family (Ampere)

Code name Official Name
NV172 (GA102) GeForce RTX (3080, 3090)
NV174 (GA104) GeForce RTX (3060 Ti, 3070, 3080 Mobile)

You can do this with EndeavourOS nvidia installer tool:
sudo pacman -Syu nvidia-inst

This should be the content of .screenlayout/monitor.sh file

xrandr --output DP-3 --primary --mode 2560x1440 --pos 1920x0 --rotate normal --output HDMI-1 --mode 1920x1080 --pos 0x0 --rotate normal

What editor do you use? If you are not familiar with nano install geany and use it.
geany .screenlayout/monitor.sh
copy paste the above content and delete all other stuff.

ls -al .screenlayout/monitor.sh 
-rwx--x--x 1 a a 146 jún   17 07.58 .screenlayout/monitor.sh

if x is missing chmod u+x .screenlayout/monitor.sh
(IMHO Commit was not followed by Save as in arandr and that’s why xrandr does not reflect what you would like to see)

1 Like

Thanks! I felt a bit overwhelmed by the Arch article on Nvidia, but nvidia-inst seems like a highly convenient tool. I’ll try out the official Nvidia drivers next weekend.

1 Like