1

Update: the problem has fixed itself. It must have happened with an update of xrandr, Xorg, nvidia or intel gpu drivers, or anything else related, but it works fine again! It wasn't my fault after all...

My laptop has a 4K (3840x2160) screen (dual gpu, nvidia-prime) and sometimes I want to connect my Full HD TV on the HDMI port to watch a video. I prefer the TV not to mirror my 4K screen.

So I start arandr and enable the HDMI input. On my previous installation of this laptop (Linux Arch), my 4K screen then became limited to 1920x1080, so 3/4 of the screen was unusable, even if not mirrored, but I would then just use mirror to watch the video which was limited to the 1/4 of the 4K screen, being the complete TV. On my new installation of this laptop (again, Linux Arch), my desktop seems to resize to 5760x2160, which make the TV only show the upper half of the screen, and showing videos incorrectly because the video application thinks my screen is 1920x2160.

So none of the situations were exactly what I wanted. I want it to work like it would work in Windows (or like my Arch installation on my desktop pc where I have a full HD screen on the left and a 1:1 2K screen on the right, it works perfectly fine there): one 4K screen on the left, one Full HD screen on the right, mouse can't pass the lower part of the screen from left to right, so the desktop is 3840x2160 on the left, 1920x1080 on the right, and the right screen has the same upper edge so the mouse stays on top when I go to the right screen.

As I am trying to automate this, I would like this to work with xrandr (I've already written an udev script which works), but even with xrandr, I don't seem to be able to set the parameters correctly.

I've tried so many things, but I seem to misunderstand the options or something, because whatever I try, it's not working as I expect it.

The simplest thing I tried was just: xrandr --output HDMI-1-0 --auto --right-of eDP-1 --mode 1920x1080 --pos 3840x0. I've tried to add --fb 1920x1080. It doesn't seem to work.

Can anyone help me understand it, maybe even help me configure it?

Edit: I don't know if it's important, but I use i3.

Edit: If I change the resolution of the 4K screen to 1920x1080, mirroring works perfectly. That's the only usable way, but it's still not what I want.

Edit: this is so strange, I just did xrandr --output eDP-1 --auto --output HDMI-1-0 --auto --right-of eDP-1 and my tv now shows an empty desktop, but my mouse is limited to the 4K screen and when I'm in the upper left area, the mouse shows up on the TV also... so it feels like the TV shows a part right of the 4K screen, but the mouse is on the left top part.

Edit: another thing I tried doesn't work: xrandr --output eDP-1 --mode 3840x2160 --fb 3840x2160 --output HDMI-1-0 --mode 1920x1080 --fb 1920x1080 --right-of eDP-1 xrandr: specified screen 1920x1080 not large enough for output eDP-1 (3840x2160+0+0) xrandr: specified screen 1920x1080 not large enough for output HDMI-1-0 (1920x1080+3840+0)

scippie
  • 2,011
  • 1
  • 26
  • 42
  • 1
    Can someone please explain why I get a -1 on this question? – scippie Sep 15 '20 at 13:07
  • Someone was have a bad day :) – undg Sep 16 '20 at 15:30
  • Had the exact same problem (also in i3). It also, strangely, fixed itself. For anyone else: if you have your screens in portrait move all your screens to the top so they all have a common edge (in arandr). Apply. The mouse was then bounded for me. Then I was able to move my landscape monitors about 1/3 the way up from my left portrait monitor after the mouse was locked in. – jpmorris Feb 19 '22 at 21:52

3 Answers3

0

Have you tried tools like arandr ? They help you configure this kind of things visually, with menus and drop-down lists for various parameters.

Link: https://christian.amsuess.com/tools/arandr/

znpy
  • 474
  • 2
  • 10
  • 1
    Yes, like I said in my OP, I can't do it with arandr either. I will get a big screen of 5760x2160 so there is a part of 1920x1080 below the TV that is available and used but is not visible anywhere. – scippie Sep 14 '20 at 15:34
0

In arandr you can save layout as a simple sh script (Layout->Save As or blue icon). Make it executable (chmod +x) and run like any other script.

undg
  • 787
  • 4
  • 14
  • I know, but I can't get it right in arandr either. Same issues... – scippie Sep 14 '20 at 15:33
  • I can't do it with arandr either. I will get a big screen of 5760x2160 so there is a part of 1920x1080 below the TV that is available and used but is not visible anywhere. – scippie Sep 14 '20 at 15:35
  • I just did (HDMI above/left of 4k) and it doesn't work at all, my i3 status bar doubles up on top of my 4k screen and the tv shows something that's inaccessible. If I move up my mouse, it automatically warps to a vertical position 1/4th lower (????). Only if I move up very fast, my mouse comes into the upper screen. Anything I try to open in there shows up partly there and overlaps everything on the 4K screen. In other words, the two screens are working as one weird working screen. It's terrible... – scippie Sep 14 '20 at 15:44
  • Even more weird is when I now try to move the HDMI screen right of the 4K screen. arandr immediately flips it under the 4K screen while the screen itself shows something different (not mirrored), but the mouse is consistent with the arandr placement. – scippie Sep 14 '20 at 15:46
  • Have you check this (undetected resolution)? https://wiki.archlinux.org/index.php/Xrandr#Adding_undetected_resolutions – undg Sep 14 '20 at 15:48
  • Yes, I have. But the resolutions shown are the correct resolutions, so I don't think that helps... – scippie Sep 14 '20 at 15:49
  • It just looks like the system doesn't want to see the second screen as a separate desktop screen, only as one whole, and by positioning the screen differently, it doesn't know how to handle this correctly. On my desktop pc, my two screens are separate, my i3 shows different workspaces there. This is not the case here. – scippie Sep 14 '20 at 15:53
  • It should be as two separate screens. This is how I have with 2xHD 1x2K http://imagy.me/ao21t15792 – undg Sep 14 '20 at 18:18
  • you have nvidia? maby this (twinview) ? https://wiki.archlinux.org/index.php/Multihead#TwinView – undg Sep 14 '20 at 18:31
  • The way you set up your screens, I believe that's how I am doing it too. Why doesn't it work here?? But you are mentioning twinview which is for two nvidia screens. I think my laptop puts the 4K screen on the intel gpu but I think the HDMI output is an nvidia output. Maybe that's the problem? – scippie Sep 14 '20 at 18:47
  • From what you saying it looks like with 4k it is creating virtual display, what is something what you don't want to have. https://wiki.archlinux.org/index.php/Multihead#Combine_screens_into_virtual_display Maybe it will help to debug your problem... – undg Sep 16 '20 at 15:34
  • Doesn't look like it, if I do xrandr --listmonitors I get two separate monitors, the 4k: 3840/344x2160/194+0+0 and the FullHD: 1920/698x2160/392+3840+0 where the 2160 is clearly incorrect and should be 1080, but I can't seem to change it. But I mean that they don't seem to be joined into one big virtual display. – scippie Sep 22 '20 at 06:37
  • And I can't seem to change that second screen size. I assume this is the 'virtual screen' for the second monitor and neither --size, --mode, --panning with the correct values can change the size of it. – scippie Sep 22 '20 at 06:40
0

The problem has solved itself with updates, be it in xrandr, Xorg, nvidia, intel, ... The same xrandr commands that didn't work then, work perfectly fine now.

scippie
  • 2,011
  • 1
  • 26
  • 42