Monitor Position Resets in Wayland Session

Summary: Unable to change screen positions between laptop screen and DP-1 external monitor in Wayland session.

Description: When using a Wayland session, the positions of my laptop screen and the DP-1 external monitor cannot be changed. After adjusting the monitor positions and clicking “Apply,” the changes appear to be saved initially. However, if I switch to another window and then return, the monitor positions revert to their original state.

Steps to Reproduce:

  1. Open the display settings in a Wayland session.
  2. Change the positions of the laptop screen and DP-1 external monitor.
  3. Click “Apply.”
  4. Switch to another window.
  5. Return to the display settings.

Expected Behavior: The monitor positions should remain as adjusted after applying the changes.

Actual Behavior: The monitor positions revert to their original state after switching to another window and returning.

System Information:

  • KDE Plasma version: 6.1.0
  • KDE Frameworks version: 6.3.0
  • Qt version: 6.7.2
  • Kernel version: 6.6.35-2-lts (64-bit)
  • OS type: archlinux
~ $ kscreen-doctor output.DP-1.position.0,0 output.eDP-1.position.2560,0
kscreen.doctor: Set output position QPoint(0,0)
kscreen.doctor: Set output position QPoint(2560,0)
kscreen.doctor: setop exec returned KScreen::Config(
KScreen::Output(33, "DP-1", connected enabled priority 2, pos: QPoint(0,0), res: QSize(2560, 1440), modeId: "37", scale: 1, clone: no, rotation: KScreen::Output::None, followPreferredMode: false)
KScreen::Output(35, "eDP-1", connected enabled priority 1, pos: QPoint(2560,0), res: QSize(1920, 1200), modeId: "70", scale: 1, clone: no, rotation: KScreen::Output::None, followPreferredMode: false) )
~ $ kscreen-doctor -o
Output: 33 DP-1
	enabled
	connected
	priority 2
	DisplayPort
	Modes:  37:2560x1440@60*!  38:1920x1440@60  39:1600x1200@60  40:1440x1080@60  41:1400x1050@60  42:1280x1024@60  43:1280x960@60  44:1152x864@60  45:1024x768@60  46:800x600@60  47:640x480@59  48:320x240@60  49:1920x1200@60  50:1680x1050@60  51:1440x900@60  52:1280x800@60  53:1152x720@60  54:960x600@60  55:928x580@60  56:800x500@59  57:768x480@59  58:720x480@60  59:640x400@59  60:320x200@59  61:2048x1152@60  62:1920x1080@60  63:1600x900@60  64:1368x768@60  65:1280x720@60  66:1024x576@60  67:864x486@59  68:720x400@60  69:640x350@60
	Geometry: 1920,0 2560x1440
	Scale: 1
	Rotation: 1
	Overscan: 0
	Vrr: incapable
	RgbRange: unknown
	HDR: incapable
	Wide Color Gamut: incapable
	ICC profile: incapable
	Color profile source: incapable
Output: 35 eDP-1
	enabled
	connected
	priority 1
	Panel
	Modes:  40:1440x1080@60  41:1400x1050@60  44:1152x864@60  45:1024x768@60  47:640x480@59  48:320x240@60  50:1680x1050@60  52:1280x800@60  53:1152x720@60  54:960x600@60  56:800x500@59  57:768x480@59  58:720x480@60  59:640x400@59  60:320x200@59  62:1920x1080@60  63:1600x900@60  67:864x486@59  68:720x400@60  70:1920x1200@60*!  71:1600x1200@60  72:1280x1024@60  73:1280x960@60  74:800x600@59  75:1440x900@60  76:928x580@60  77:1368x768@60  78:1280x720@60  79:1024x576@60  80:640x350@59
	Geometry: 0,0 1920x1200
	Scale: 1
	Rotation: 1
	Overscan: 0
	Vrr: incapable
	RgbRange: unknown
	HDR: incapable
	Wide Color Gamut: incapable
	ICC profile: incapable
	Color profile source: incapable

Although the position appears to be changed according to kscreen-doctor, the actual display output remains in its original configuration.

I’m confused, the settings window you show is for X11. Is that simply a misleading screenshot, or does it actually look like that in the Wayland session for you?

Question: Could the discrepancy between KSCREEN_BACKEND being set to KSC_KWayland.so and the preferred backend being KSC_QScreen.so be causing this issue?

$ kscreen-doctor -i
Environment:
  * KSCREEN_BACKEND           : KSC_KWayland.so
  * KSCREEN_BACKEND_INPROCESS : 1
  * KSCREEN_LOGGING           : true
Logging to                : /home/stevek/.local/share/kscreen/kscreen.log
Preferred KScreen backend : KSC_QScreen.so
Available KScreen backends:
  * KSC_Fake.so: /usr/lib/qt6/plugins/kf6/kscreen/KSC_Fake.so
  * KSC_KWayland.so: /usr/lib/qt6/plugins/kf6/kscreen/KSC_KWayland.so
  * KSC_QScreen.so: /usr/lib/qt6/plugins/kf6/kscreen/KSC_QScreen.so
  * KSC_XRandR.so: /usr/lib/qt6/plugins/kf6/kscreen/KSC_XRandR.so
26.06.2024 00:36:16.397 ; qscreen ;  : Screen added QScreen(0x574fca568390, name="eDP-1") "eDP-1"
26.06.2024 00:36:16.398 ; qscreen ;  : Screen added QScreen(0x574fca5684d0, name="DP-1") "DP-1"
26.06.2024 00:36:16.463 ; kded ;  : Config KScreen::Config(0x574fcacb54a0) is ready
26.06.2024 00:36:16.465 ; kded ;  : PowerDevil SuspendSession action not available!
26.06.2024 00:36:16.465 ; kded ;  : "The name is not activatable"
26.06.2024 00:36:16.471 ; kded ;  : Applying config
26.06.2024 00:36:16.471 ; kded ;  : Connected outputs:  2
26.06.2024 00:36:16.472 ; kded ;  : No file for "outputs/39f92572aa6fb3fd955490838b4835eaeDP-1"
26.06.2024 00:36:16.472 ; kded ;  : No file for "outputs/39f92572aa6fb3fd955490838b4835ea"
26.06.2024 00:36:16.472 ; kded ;  : Finding a mode for QSize(0, 0) @ 0
26.06.2024 00:36:16.472 ; kded ;  : No file for "outputs/2a9fbdde5737282fe17bae0ad24af414DP-1"
26.06.2024 00:36:16.472 ; kded ;  : No file for "outputs/2a9fbdde5737282fe17bae0ad24af414"
26.06.2024 00:36:16.472 ; kded ;  : Finding a mode for QSize(0, 0) @ 0
26.06.2024 00:36:16.472 ; kded ;  : Lid is open
26.06.2024 00:36:16.472 ; kded ;  : fallbackIfNeeded()
26.06.2024 00:36:16.472 ; kded ;  : Do set and apply specific config
26.06.2024 00:36:16.473 ; kded ;  : Config applied
26.06.2024 00:36:16.473 ; kded ;  : Monitor for changes:  true
26.06.2024 00:36:18.246 ; qscreen ;  : Screen added QScreen(0x5dc028ba0680, name="eDP-1") "eDP-1"
26.06.2024 00:36:18.246 ; qscreen ;  : Screen added QScreen(0x5dc028ba07c0, name="DP-1") "DP-1"
26.06.2024 00:36:19.329 ; qscreen ;  : Screen added QScreen(0x64734509f9c0, name="eDP-1") "eDP-1"
26.06.2024 00:36:19.329 ; qscreen ;  : Screen added QScreen(0x64734509fb00, name="DP-1") "DP-1"

Yes, I am logged in with a Wayland session. The output of show-session also confirms it is Wayland.

loginctl show-session 4
Id=4
User=1000
Name=stevek
Timestamp=Wed 2024-06-26 00:36:10 KST
TimestampMonotonic=24371448
VTNr=1
Seat=seat0
TTY=tty1
Remote=no
Service=sddm
Desktop=KDE
Scope=session-4.scope
Leader=1010
Audit=4
Type=wayland
Class=user
Active=yes
State=active
IdleHint=no
IdleSinceHint=0
IdleSinceHintMonotonic=0
LockedHint=no

I am also confused. I am running KDE Plasma 6.1.0 with Wayland, and a desktop system with 2 monitors.

I don’t have this problem, but when I change anything in that “Display Configuration” tab, after clicking “Apply”, and having the settings applied, a “Keep display configuration?” confirmation box appears. I have about 10 seconds to press the “Keep” button, or my changes are reverted.

Do you have to confirm your changes like that? It should be between steps 3 and 4 in your steps to reproduce.

Thank you for your help. I created a new user and can confirm that there is no issue with the KDE settings. I think there was a configuration problem in my dotfiles.

Yeah, that would cause this problem. Tbh I’m not sure why the QScreen backend exists at all… maybe we should get rid of it, or at the very least display a warning message when it’s loaded in system settings.

On my system, none of the environment variables for KScreen are set. If you un-set them, does that fix the problem?

@Zamundaaa I’ve been using X11-based GNOME and KDE for a long time, and it seems the problem started when I switched to Wayland. When I create a new user and start a KDE Wayland session, there are no issues.

In the problematic environment, when the KSCREEN_BACKEND is not set, the Preferred KScreen backend is KSC_XRandR.so. However, when I set KSCREEN_BACKEND=KSC_KWayland.so, the preferred backend changes to KSC_QScreen.so.

Do you maybe have some scripts that set XDG_SESSION_TYPE or WAYLAND_DISPLAY to something odd?

After setting KSCREEN_BACKEND to KWayland, KSC_KWayland.so was configured as expected.

~> kscreen-doctor -i
Environment:
  * KSCREEN_BACKEND           : KWayland
  * KSCREEN_BACKEND_INPROCESS : [not set]
  * KSCREEN_LOGGING           : [not set]
Logging to                : [logging disabled]
Preferred KScreen backend : KSC_KWayland.so
Available KScreen backends:
  * KSC_Fake.so: /usr/lib/qt6/plugins/kf6/kscreen/KSC_Fake.so
  * KSC_KWayland.so: /usr/lib/qt6/plugins/kf6/kscreen/KSC_KWayland.so
  * KSC_QScreen.so: /usr/lib/qt6/plugins/kf6/kscreen/KSC_QScreen.so
  * KSC_XRandR.so: /usr/lib/qt6/plugins/kf6/kscreen/KSC_XRandR.so