Help fixing monitors randomly getting mixed up in X11 KDE

I have been running EOS for a few months and there is a minor reoccurring issue I’m finally not too lazy to find a fix for.

I have a bit of a janky 3 monitor setup where I have on central 4k monitor and two 1080p side monitors, one of which is in vertical orientation for discord/slack. All of the monitors are different brands.

Whenever I first log in the portrait mode monitor is still displaying in landscape mode, which isn’t a biggy because it’ll switch over to portrait during login. However, every couple of logins something happens that causes the display settings between monitors to shuffle around: wallpaper/taskbar of display 1 on display 2, incorrect resolution/scaling, layout of monitors is incorrect for moving between displays, etc. 9/10 times all I have to do is unplug the DP cable from the vertical monitor and plug it back in and everything resets itself. The other 1/10 times the issue persists and I have to go into the display configuration to find that the screen priorities are mixed up and putting them in the correct order resolves the issue.

Does anyone know what is causing this issue and how I can stop it from occurring?

For context, what desktop environment are you using (eg: KDE Plasma, Gnome, etc)?

KDE Plasma

1 Like

Could you share the output of xrandr? Let us know if you can, which DP-x relates to which screen, from left to right, and which is in portrait?

Eg: DP-0 = left, DP-1=middle, DP-2=right portrait, etc.

xrandr
Screen 0: minimum 8 x 8, current 5560 x 1920, maximum 32767 x 32767
HDMI-0 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 530mm x 290mm
   1920x1080     60.00*+  74.97    59.94    50.00  
   1680x1050     59.95  
   1600x900      60.00  
   1366x768      59.79  
   1280x1024     75.02    60.02  
   1280x960      60.00  
   1280x800      59.81  
   1280x720      60.00    59.94    50.00  
   1024x768      75.03    70.07    60.00  
   800x600       75.00    72.19    60.32    56.25  
   720x576       50.00  
   720x480       59.94  
   640x480       75.00    72.81    59.94    59.93  
DP-0 connected 1080x1920+4480+0 left (normal left inverted right x axis y axis) 509mm x 286mm
   1920x1080     60.00*+  59.94    50.00  
   1680x1050     59.95  
   1440x900      74.98    59.89  
   1440x576      50.00  
   1440x480      59.94  
   1280x1024     75.02    60.02  
   1280x960      60.00  
   1280x720      60.00    59.94    50.00  
   1152x864      75.00  
   1024x768      75.03    70.07    60.00  
   800x600       75.00    72.19    60.32    56.25  
   720x576       50.00  
   720x480       59.94  
   640x480       75.00    72.81    59.94    59.93  
DP-1 disconnected (normal left inverted right x axis y axis)
DP-2 connected primary 2560x1440+1920+0 (normal left inverted right x axis y axis) 697mm x 392mm
   3840x2160     60.00 +  30.00    29.97  
   2560x1440     59.95* 
   1920x1080     60.00    59.94  
   1680x1050     59.95  
   1600x900      60.00  
   1440x900      59.89  
   1280x1024     75.02    60.02  
   1280x800      59.81  
   1280x720      60.00  
   1152x864      75.00  
   1024x768      75.03    70.07    60.00  
   800x600       75.00    72.19    60.32    56.25  
   640x480       75.00    72.81    59.94  
DP-3 disconnected (normal left inverted right x axis y axis)
DP-4 disconnected (normal left inverted right x axis y axis)
DP-5 disconnected (normal left inverted right x axis y axis)

DP-0 would be the vertical monitor

1 Like

There’s a couple of things to address I suspect (SDDM / KDE / X11 / Wayland), so bear with me as a step through it.

To clarify this point, are you saying that the portrait screen is not correctly rotated at the initial login screen (SDDM)? Then, when you log in, it often rights itself (except on occasions where things get mixed up)?

1 Like

Yes, it starts off incorrectly oriented and then rights itself except when it doesn’t and things get mixed up

Ok, to address the rotation issue on the login screen, with your display setup correctly in a Wayland session (not X11), you might go to Login Screen (SDDM) settings, and hit Apply Plasma Settings…

Hopefully, your login screen should now be correctly orientated.

Does it have to be in wayland or can I do it from x11?

I’ll test that :wink:

Ah it says screen orientation only works in wayland

1 Like

Interesting other quirk is that HDMI-1 and DP-0’s settings swap when I go to wayland

This is modified from the example provided here, to match your setup:
Arch Wiki - SDDM - 3.11 Login session appears on an unexpected display

Edit the file /usr/share/sddm/scripts/Xsetup :

#!/bin/sh
# Xsetup - run as root before the login dialog appears

xrandr --output DP-2 --auto --primary
xrandr --output DP-0 --auto --rotate left --noprimary
xrandr --output HDMI-0 --auto --noprimary

If things appear upside-down, you might need to tweak this (eg: rotate right).

This is just to address the SDDM / login screen issue at the moment.

I will be changing it slightly based of that wiki post to

xrandr --output DP-2 --auto --primary
xrandr --output DP-0 --right-of DP-2 --rotate left --noprimary
xrandr --output HDMI-0 --left-of DP-2 --noprimary

to make sure they are ordered correctly

1 Like

I wasn’t sure how they were ordered (you didn’t mention) :+1:

Edit: Although I think I see how that info might be conveyed from xrandr now. I’d missed that earlier.

Ok that fixed the login screen, though having the login input appear on only one monitor would be nice. But I rather get the monitor shuffling fixed first

This might work to turn off the other displays at SDDM?

xrandr --output DP-2 --auto --primary
xrandr --output DP-0 --off
xrandr --output HDMI-0 --off

Edit: Fixed typo… -off to --off

1 Like

works

1 Like

I’ve not been able to pinpoint anything specific to this.

Might you share some of your configuration?

inxi -GSMxx
System:
  Host: pisqi-desktop Kernel: 6.11.3-arch1-1 arch: x86_64 bits: 64
    compiler: gcc v: 14.2.1
  Desktop: KDE Plasma v: 6.2.0 tk: Qt v: N/A wm: kwin_wayland dm: SDDM
    Distro: EndeavourOS base: Arch Linux
Machine:
  Type: Desktop Mobo: ASRock model: B450M Pro4 serial: <superuser required>
    UEFI: American Megatrends v: P5.70 date: 10/20/2022
Graphics:
  Device-1: NVIDIA GA102 [GeForce RTX 3080 12GB] vendor: Micro-Star MSI
    driver: nvidia v: 560.35.03 arch: Ampere pcie: speed: 8 GT/s lanes: 16
    ports: active: none off: DP-1,DP-2,HDMI-A-1 empty: DP-3 bus-ID: 07:00.0
    chip-ID: 10de:220a
  Display: wayland server: X.org v: 1.21.1.13 with: Xwayland v: 24.1.3
    compositor: kwin_wayland driver: X: loaded: nvidia unloaded: modesetting
    alternate: fbdev,nouveau,nv,vesa gpu: nvidia d-rect: 5560x1920
    display-ID: 0
  Monitor-1: DP-1 pos: right res: 1080x1920 size: N/A
  Monitor-2: DP-2 pos: center res: 2560x1440 size: N/A
  Monitor-3: HDMI-A-1 pos: primary,left res: 1920x1080 size: N/A
  API: EGL v: 1.5 platforms: device: 0 drv: nvidia device: 2 drv: swrast
    gbm: drv: nvidia surfaceless: drv: nvidia wayland: drv: nvidia x11:
    drv: nvidia inactive: device-1
  API: OpenGL v: 4.6.0 compat-v: 4.5 vendor: nvidia mesa v: 560.35.03
    glx-v: 1.4 direct-render: yes renderer: NVIDIA GeForce RTX 3080/PCIe/SSE2
    display-ID: :1.0
  API: Vulkan v: 1.3.295 surfaces: xcb,xlib,wayland device: 0
    type: discrete-gpu driver: nvidia device-ID: 10de:220a