Bug 468432 - On X11, when third screen is activated, it gets the containment of the second screen, rather than the until-then unused containment it had the last time it was present
Summary: On X11, when third screen is activated, it gets the containment of the second...
Status: REPORTED
Alias: None
Product: KScreen
Classification: Plasma
Component: common (show other bugs)
Version: 6.3.2
Platform: Debian testing Linux
: NOR normal
Target Milestone: 1.0
Assignee: kscreen-bugs-null@kde.org
URL:
Keywords: multiscreen, X11-only
Depends on:
Blocks:
 
Reported: 2023-04-12 18:54 UTC by Alex
Modified: 2025-04-11 00:02 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alex 2023-04-12 18:54:10 UTC
SUMMARY
When activating a third screen, the workspace and panel from the second screen are moved to the third screen and the second screen gets the workspace and panel of the previously inactive third screen.


STEPS TO REPRODUCE
Screen layout: | DP-3 | HDMI-1 | HDMI-0

Two screens active:
xrandr --output HDMI-0 --off
xrandr --output HDMI-1 --right-of DP-3 --auto

Activate the third screen:
xrandr --output HDMI-0 --right-of HDMI-1 --auto

OBSERVED RESULT
Two screen layout:

$ xrandr
Screen 0: minimum 8 x 8, current 3840 x 1080, maximum 32767 x 32767
HDMI-0 connected (normal left inverted right x axis y axis)
   1920x1080     60.00 +  50.00  
   1680x1050     59.95  
   1600x1200     60.00  
   1440x900      59.89  
   1280x1024     60.02  
   1280x960      60.00  
   1280x800      59.81  
   1280x720      60.00    50.00  
   1024x768      60.00  
   800x600       60.32    56.25  
   720x576       50.00  
   720x480       59.94  
   640x480       59.94  
DP-0 disconnected (normal left inverted right x axis y axis)
DP-1 disconnected (normal left inverted right x axis y axis)
HDMI-1 connected 1920x1080+1920+0 (normal left inverted right x axis y axis) 521mm x 293mm
   1920x1080     60.00*+  59.94    50.00  
   1680x1050     59.95  
   1600x900      60.00  
   1440x900      59.89  
   1280x1024     75.02    60.02  
   1280x800      59.81  
   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  
DP-2 disconnected (normal left inverted right x axis y axis)
DP-3 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 527mm x 296mm
   1920x1080     60.00*+  59.94    50.00  
   1680x1050     59.95  
   1440x900      74.98    59.89  
   1280x1024     75.02    60.02  
   1280x960      60.00  
   1280x720      60.00    59.94    50.00  
   1024x768      75.03    60.00  
   800x600       75.00    60.32  
   720x576       50.00  
   720x480       59.94  
   640x480       75.00    72.81    59.94    59.93

Three screen layout:
$ xrandr --output HDMI-0 --right-of HDMI-1 --auto
$ xrandr 
Screen 0: minimum 8 x 8, current 5760 x 1080, maximum 32767 x 32767
HDMI-0 connected 1920x1080+3840+0 (normal left inverted right x axis y axis) 477mm x 268mm
   1920x1080     60.00*+  50.00  
   1680x1050     59.95  
   1600x1200     60.00  
   1440x900      59.89  
   1280x1024     60.02  
   1280x960      60.00  
   1280x800      59.81  
   1280x720      60.00    50.00  
   1024x768      60.00  
   800x600       60.32    56.25  
   720x576       50.00  
   720x480       59.94  
   640x480       59.94  
DP-0 disconnected (normal left inverted right x axis y axis)
DP-1 disconnected (normal left inverted right x axis y axis)
HDMI-1 connected 1920x1080+1920+0 (normal left inverted right x axis y axis) 521mm x 293mm
   1920x1080     60.00*+  59.94    50.00  
   1680x1050     59.95  
   1600x900      60.00  
   1440x900      59.89  
   1280x1024     75.02    60.02  
   1280x800      59.81  
   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  
DP-2 disconnected (normal left inverted right x axis y axis)
DP-3 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 527mm x 296mm
   1920x1080     60.00*+  59.94    50.00  
   1680x1050     59.95  
   1440x900      74.98    59.89  
   1280x1024     75.02    60.02  
   1280x960      60.00  
   1280x720      60.00    59.94    50.00  
   1024x768      75.03    60.00  
   800x600       75.00    60.32  
   720x576       50.00  
   720x480       59.94  
   640x480       75.00    72.81    59.94    59.93 

EXPECTED RESULT
The third screen should be activated with the workspace assigned to the inactive screen (or a new workspace if it is activated the first time)

SOFTWARE/OS VERSIONS
Operating System: Debian GNU/Linux 12
KDE Plasma Version: 5.27.2
KDE Frameworks Version: 5.103.0
Qt Version: 5.15.8
Graphics Platform: X11

Despite the output of xrandr, the graphics card has two DisplayPort and two HDMI ports. I do not know why it lists DP-0 to DP-3. Maybe the HDMI ports are listed as HDMI and DisplayPort?

ADDITIONAL INFORMATION
Bug 458916 is related and describes the workspace/panel dialog not always storing the screen layout after correcting the issues caused by this bug. This bug is probably the first step for solving it and easier to reproduce by using the shell commands.
Comment 1 Alex 2023-04-13 20:30:46 UTC
> When third screen is activated, it gets the containment of the second screen, rather than the until-then unused containment it had the last time it was present

When switching off, the containments are switched again, i.e., when I did not correct the layout it is correct again after switching off the third monitor, but when I corrected it, it then gets incorrect.
In the end it switches the containmeints of the two monitors when the third one is activated or deactivated.
Comment 2 Nate Graham 2025-04-05 20:46:53 UTC
Sorry we were not able to get to this yet. Can I ask you to please check to see if it's still an issue with Plasma 6.3?

Also, can you see if it happens on Wayland too, or only on X11?

Thanks!
Comment 3 Alex 2025-04-05 21:20:39 UTC
Yes and it is very annoying. I use for switching these scripts:

xrandr --output DP-3 --auto --output HDMI-0 --auto --right-of DP-3 --output HDMI-1 --off --output DP-1 --off
and
xrandr --output DP-3 --auto --output HDMI-0 --auto --right-of DP-3 --output HDMI-1 --auto --right-of HDMI-0 --output DP-1 --off

And the workspaces are always in the wrong order. The primary stays the same, the secondary/third is wrong.

I can only really test on X11 as Wayland still has a lot of problems, possibly due to Debian testing still using the Nvidia 535 driver.

For a workaround I would also be happy to have some command like "dbus-send ... workspace-02 DP-1" or similar that I could include in the scripts for switching monitor configurations.
Comment 4 Nate Graham 2025-04-08 17:15:08 UTC
Thanks. It would be great if you can test on Wayland if possible.
Comment 5 Alex 2025-04-08 17:44:26 UTC
I tried. It's hard to tell. Despite quite a few Wayland problems (flickering from transparent windows and so on) that may or may not be related to Nvidia 535, the results for this issue:

- Plasma starts with Monitor 1 and 2 swapped (probably something that systemsettings and nvidia-settings can solve)
- Activating Monitor 3 with systemsettings gets it the right containments
- No test with xrandr possible. It only shows the two active monitors in --listmonitors and with using it with --output ... --off I only get an error message. Maybe it's X11 only? But it lists at least the active monitors correctly.

How would I scripted activate and deactivate monitors for Wayland?
Comment 6 Nate Graham 2025-04-09 18:52:52 UTC
You can use kscreen-doctor to script this stuff on Wayland, but in general scripting shouldn't be necessary; anytime you're tempted to do so, that's a sign something's not working and that should be fixed directly. Oftentimes the custom scripts can fight with the system and create problems where there were none. So I would recommend turning off all the scripts, seeing if you can replicate the setup you want, and then see if it's stable after rebooting. If not, that's what we should fix.
Comment 7 Alex 2025-04-09 18:59:30 UTC
I need/want scripting, because I want to switch fast between a few predefined display configurations. With multiple monitors and a graphics tablet (that sometimes should have an own display and sometimes copy one) it is very convenient to have a short script that you can add to the menu for "Three monitors on".

When I think about it that way, I will test what happens with kscreen-doctor and wonder if the actual problem may be KDE not correctly synchronizing with screen changes done by non-KDE tools. Maybe plasmashell doesn't correctly pick up what the xrandr command line tool did.
Comment 8 Nate Graham 2025-04-09 20:53:10 UTC
I think that's likely.
Comment 9 Alex 2025-04-09 23:08:15 UTC
Would that still be considered a plasma/kwin bug?
Comment 10 Nate Graham 2025-04-10 14:50:52 UTC
Good question. I would say yes, it's a valid bug.

However I would caution you not to expect a fix anytime soon. Integration with 3rd-party command-line X11-only tools is very low on the priority list. We have other issues of KScreen disagreeing with xrandr too; see Bug 466149 and Bug 501242.

If I had to make a prediction, I would say that these bug reports will most likely be closed as RESOLVED UNMAINTAINED when we remove support for the X11 session.
Comment 11 Alex 2025-04-10 23:24:58 UTC
I think I can script kscreen-doctor instead.

I'm not sure if I found a but, but shouldn't 
$ kscreen-doctor output.HDMI-1.enable output.HDMI-1.position.3840,0
Enabling output 472
kscreen.doctor: Set output position QPoint(3840,0)

activate the third screen? If I split it into two commands
kscreen-doctor output.HDMI-1.enable
kscreen-doctor output.HDMI-1.position.3840,0

it works, but as far as I understand the help I should be able to configure all monitors at the same time and probably have less modeswitches (and moved around windows that way.
Comment 12 Nate Graham 2025-04-11 00:02:20 UTC
kscreen-doctor bugs will be investigated and fixed, so if you think you've found one, please do feel free to open a new bug report for it!