Bug 470540 - On X11, complex containment arrangement is messed up after connecting an external display
Summary: On X11, complex containment arrangement is messed up after connecting an exte...
Status: RESOLVED INTENTIONAL
Alias: None
Product: plasmashell
Classification: Plasma
Component: Desktop Containment (show other bugs)
Version: 5.27.4
Platform: Ubuntu Linux
: NOR normal
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords: multiscreen
Depends on:
Blocks:
 
Reported: 2023-06-01 21:46 UTC by leonardopsantos
Modified: 2023-07-25 21:41 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Panels and Desktops Management showing wrong screen order (220.84 KB, image/png)
2023-06-01 21:46 UTC, leonardopsantos
Details
Display configuration screenshot (52.52 KB, image/png)
2023-06-01 21:47 UTC, leonardopsantos
Details
xrandr output (2.49 KB, text/plain)
2023-06-01 21:47 UTC, leonardopsantos
Details
KDE config files diff (1.09 KB, text/plain)
2023-07-01 01:54 UTC, leonardopsantos
Details
Panels and Desktop Management screenshot showing screen as disconnected (281.45 KB, image/png)
2023-07-06 17:42 UTC, leonardopsantos
Details

Note You need to log in before you can comment on or make changes to this bug.
Description leonardopsantos 2023-06-01 21:46:12 UTC
Created attachment 159402 [details]
Panels and Desktops Management showing wrong screen order

SUMMARY

After disconnecting and re-connecting an external display, my panels end up on the wrong display.

My setup is not very exotic: 

- Laptop attached screen
- External HP Z27 (through a USB 3 Thunderbolt cable)
- External HP Z27 (through an HDMI cable)

I've added a KDE default panel to external USB monitor and an empty panel to the external HDMI monitor. I've added a task manager widget to the empty panel.

TL; DR: the two external monitors have panels configured differently, so I can tell them apart.

Looking at the "Panels and Desktops Management" app, I see that the order they appear (screenshot 1) is not the order that's configured (screenshot 2). Also, when I first configured everything, the laptop display was the leftmost screen on "Panels and Desktops Management" app, now is the rightmost.

I've also attached the output of xrandr.

STEPS TO REPRODUCE

Disconnect and reconnect an external display.

OBSERVED RESULT

Laptop screen gets the task manager panel, external (HDMI) screen gets the original panel.

EXPECTED RESULT

Laptop screen gets the original panel, external (HDMI) screen gets the task manager panel.

Operating System: Kubuntu 23.04
KDE Plasma Version: 5.27.4
KDE Frameworks Version: 5.104.0
Qt Version: 5.15.8
Kernel Version: 6.2.0-20-generic (64-bit)
Graphics Platform: X11
Processors: 8 × Intel® Core™ i5-8265U CPU @ 1.60GHz
Memory: 15.3 GiB of RAM
Graphics Processor: Mesa Intel® UHD Graphics 620
Manufacturer: LENOVO
Product Name: 20QD001UUS
System Version: ThinkPad X1 Carbon 7th

ADDITIONAL INFORMATION

plasmashell version: 5.27.4
Kernel: Linux 6.2.0-20-generic #20-Ubuntu SMP PREEMPT_DYNAMIC Thu Apr  6 07:48:48 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Comment 1 leonardopsantos 2023-06-01 21:47:01 UTC
Created attachment 159403 [details]
Display configuration screenshot
Comment 2 leonardopsantos 2023-06-01 21:47:22 UTC
Created attachment 159404 [details]
xrandr output
Comment 3 leonardopsantos 2023-06-01 21:48:03 UTC
ls /sys/class/drm

card0  card0-DP-1  card0-DP-2  card0-eDP-1  card0-HDMI-A-1  renderD128  version
Comment 5 Nate Graham 2023-06-05 19:46:16 UTC
FWIW the "manage desktops and panels" window is not supposed to mirror the actual physical layout of the screens; it displays a flat one-dimensional list, while screens can actually be displayed at arbitrary locations in 2-dimensional space. So let's ignore that part of the report.

A few questions:
1. Can you describe how the output of `xrandr` changes, if at all, when you reproduce the bug?
2. Can you describe how the output of `kscreen-doctor -o` changes, if at all, when you reproduce the bug?
3. Does the bug happen on Wayland too? Or is it 11-only?
4. Did you upgrade from an earlier Plasma version? If you did, can you move aside (not delete) your ~/.local/share/kscreen folder, re-create the display arrangement in System Settings > Display and Monitor, reboot, and see if it's better now?
5. If it's still not, can you try re-arranging the desktops and/or the panels in the Manage desktops and panels window to be in the place where they're supposed to be, then reboot, then try to make it happen again, and see what happens?
Comment 6 Bug Janitor Service 2023-06-20 03:45:10 UTC Comment hidden (spam)
Comment 7 leonardopsantos 2023-07-01 01:07:36 UTC
I finally had some time to try and reproduce this bug.

I unplugged both external monitors, and plugged them back on. Plasmashell immediately crashed (_usr_bin_plasmashell.1000.crash.tar.bz2). Of the three available monitors, only the USC-C one is working, the laptop screen is completely black, as is the HDMI-connected monitor.

After disconnecting the monitors but before reconnecting them, I ran 

sudo dmesg -c

To clear the kernel event log. After plugging monitors the  back on, I have

[336221.542969] EDID block 0 (tag 0x00) checksum is invalid, remainder is 236
[336222.540425] i915 0000:00:02.0: [drm] *ERROR* Unexpected DP dual mode adaptor ID 41
[336222.950803] EDID block 0 (tag 0x00) checksum is invalid, remainder is 31
[336223.691976] i915 0000:00:02.0: [drm] *ERROR* Unexpected DP dual mode adaptor ID 50
[336233.788581] usb 1-5: USB disconnect, device number 23
[336233.788588] usb 1-5.1: USB disconnect, device number 24
[336236.522956] xhci_hcd 0000:2d:00.0: xHC error in resume, USBSTS 0x401, Reinit
[336236.522971] usb usb3: root hub lost power or was reset
[336236.522977] usb usb4: root hub lost power or was reset
[336247.237949] usb 1-5: new high-speed USB device number 25 using xhci_hcd
[336247.388505] usb 1-5: New USB device found, idVendor=03f0, idProduct=0169, bcdDevice=55.60
[336247.388511] usb 1-5: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[336247.388512] usb 1-5: Product: USB2.1 Hub
[336247.388513] usb 1-5: Manufacturer: GenesysLogic
[336247.390784] hub 1-5:1.0: USB hub found
[336247.391021] hub 1-5:1.0: 2 ports detected
[336247.705940] usb 1-5.1: new high-speed USB device number 26 using xhci_hcd
[336247.836320] usb 1-5.1: New USB device found, idVendor=03f0, idProduct=0169, bcdDevice=55.71
[336247.836326] usb 1-5.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[336247.836328] usb 1-5.1: Product: USB2.1 Hub
[336247.836329] usb 1-5.1: Manufacturer: GenesysLogic
[336247.837108] hub 1-5.1:1.0: USB hub found
[336247.837380] hub 1-5.1:1.0: 4 ports detected

The xrand output is

Screen 0: minimum 320 x 200, current 3840 x 2160, maximum 16384 x 16384
eDP-1 connected (normal left inverted right x axis y axis)
   2560x1440     60.01 +  60.01  
   1920x1440     60.01  
   1856x1392     60.01  
   1792x1344     60.01  
   2048x1152     60.01  
   1920x1200     60.01  
   1920x1080     60.01  
   1600x1200     60.01  
   1680x1050     60.01  
   1400x1050     60.01  
   1600x900      60.01  
   1280x1024     60.01  
   1400x900      60.01  
   1280x960      60.01  
   1440x810      60.01  
   1368x768      60.01  
   1280x800      60.01  
   1280x720      60.01  
   1024x768      60.01  
   960x720       60.01  
   928x696       60.01  
   896x672       60.01  
   1024x576      60.01  
   960x600       60.01  
   960x540       60.01  
   800x600       60.01  
   840x525       60.01  
   864x486       60.01  
   700x525       60.01  
   800x450       60.01  
   640x512       60.01  
   700x450       60.01  
   640x480       60.01  
   720x405       60.01  
   684x384       60.01  
   640x360       60.01  
   512x384       60.01  
   512x288       60.01  
   480x270       60.01  
   400x300       60.01  
   432x243       60.01  
   320x240       60.01  
   360x202       60.01  
   320x180       60.01  
DP-1 disconnected (normal left inverted right x axis y axis)
HDMI-1 connected (normal left inverted right x axis y axis)
   3840x2160     30.00    29.97    29.98  
   1920x1200     59.95  
   1920x1080     60.00    50.00    59.94  
   1920x1080i    60.00    50.00    59.94  
   1680x1050     59.88  
   1600x900      60.00  
   1280x1024     60.02  
   1440x900      59.90  
   1280x800      59.91  
   1280x720      60.00    50.00    59.94  
   1024x768      60.00  
   800x600       60.32  
   720x576       50.00  
   720x576i      50.00  
   720x480       60.00    59.94  
   720x480i      60.00    59.94  
   640x480       60.00    59.94  
   720x400       70.08  
DP-2 connected primary 3840x2160+0+0 (normal left inverted right x axis y axis) 597mm x 336mm
   3840x2160     60.00*+  29.98  
   1920x1200     59.88  
   1920x1080     60.00    50.00    59.94  
   1920x1080i    60.00    50.00    59.94  
   1680x1050     59.95  
   1600x900      60.00  
   1280x1024     60.02  
   1440x900      59.89  
   1280x800      59.81  
   1280x720      60.00    50.00    59.94  
   1024x768      60.00  
   800x600       60.32  
   720x576       50.00  
   720x480       60.00    59.94  
   640x480       60.00    59.94  
   720x400       70.08
Comment 8 leonardopsantos 2023-07-01 01:37:36 UTC
I had saved my monitor configuration with autorandr, so I used that to force-load the appropriate config, and then I restored plasma-org.kde.plasma.desktop-appletsrc and plasmashellrc:

systemctl --user stop plasma-plasmashell
cp -avf $HOME/backup/org.kde.plasma.desktop-appletsrc $HOME/.config/
cp -avf $HOME/backup/plasmashellrc $HOME/.config/
sleep 5
systemctl --user start plasma-plasmashell

But now my panels are _on the wrong monitors_! When I saved org.kde.plasma.desktop-appletsrc and plasmashellrc, I had:

1. The laptop monitor with the original Kubuntu panel
2. The USB-C monitor with a new Kubuntu default panel (Application Launcher, Taskbar, System Tray),
3. The HDMI monitor with a panel containing just a Taskbar widget.

After running the commands above, I got

1. The laptop monitor with panel containing just a Taskbar widget.
2. The USB-C monitor with a new Kubuntu default panel (Application Launcher, Taskbar, System Tray),
3. The HDMI monitor with a new Kubuntu default panel (Application Launcher, Taskbar, System Tray),

Clearly unplugging and plugging the external monitors is a painful process, and even after "restoring" my configuration, the panels end up in the wrong screen.


> 1. Can you describe how the output of `xrandr` changes, if at all, when you reproduce the bug?

xrand output attached as 20230630-xrandr.txt

> 2. Can you describe how the output of `kscreen-doctor -o` changes, if at all, when you reproduce the bug?


> 3. Does the bug happen on Wayland too? Or is it 11-only?

I'm not sure, can you please tell me how do I figure this out? I'm using Kubuntu 23.04's default server.

> 4. Did you upgrade from an earlier Plasma version? If you did, can you move aside (not delete) your ~/.local/share/kscreen folder, re-create 
 the display arrangement in System Settings > Display and Monitor, reboot, and see if it's better now?

It's a fresh Kubuntu 23.04 install.
Comment 9 leonardopsantos 2023-07-01 01:54:17 UTC
Rebooted the machine. Laptop screen still has the wrong panel. Restored backup files with

systemctl --user stop plasma-plasmashell
cp -avf $HOME/backup/org.kde.plasma.desktop-appletsrc $HOME/.config/
cp -avf $HOME/backup/plasmashellrc $HOME/.config/
sleep 5
systemctl --user start plasma-plasmashell

Didn't make a difference, panels still on the wrong monitor.

Moved panels using the "Panels and Desktop Management". 

The diff from my backup files is attached as 20230630-kde-diff.txt
Comment 10 leonardopsantos 2023-07-01 01:54:44 UTC
Created attachment 160010 [details]
KDE config files diff
Comment 11 leonardopsantos 2023-07-01 02:05:15 UTC
I tried to reproduce the error after the last reboot, but I couldn't. 

I tried:

1. Unplugging both cables:
  A. Unplugging the HDMI and and then the USC-C cable
  B. Plugging the HDMI cable back on and and then the USC-C cable

All panels were correctly restored.

2. Unplugging both cables quick to maybe force a race condition:
  A. Unplugging the HDMI and and then the USC-C cable
  B. Plugging the HDMI cable back on and and then the USC-C cable

I did both steps again, but tried to re-plug the cables as fast I could, so the USB cable was re-connected before KDE had a change to reconfigure itself after I re-plugged the HDMI cable (maybe it's a race condition), all panels were correctly restored.

3. Unplugging both cables (USB first):
  A. Unplugging the USC-C and then the HDMI cable
  B. Plugging the USC-C cable back on and and then the HDMI cable

All panels were correctly restored.

4. With hibernate

A. Unplugged both cables
B. Closed the laptop lid (so it hibernates), 
C. Reconnected the cables
D. Opened the lid and logged back in

All panels were correctly restored.

My feeling is that I can only reproduce this problem after the laptop has been on for a long time, like from Monday to Friday. I'll try again next Friday.
Comment 12 leonardopsantos 2023-07-06 17:41:05 UTC
Big storm, power failed briefly, so both external monitors when off and on again.

HDMI monitor restored, USB monitor is on but without a signal.

xrandr output is:


Screen 0: minimum 320 x 200, current 7680 x 2160, maximum 16384 x 16384
eDP-1 connected primary 2560x1440+0+0 (normal left inverted right x axis y axis) 309mm x 174mm
   2560x1440     60.01*+  60.01  
   1920x1440     60.01  
   1856x1392     60.01  
   1792x1344     60.01  
   2048x1152     60.01  
   1920x1200     60.01  
   1920x1080     60.01  
   1600x1200     60.01  
   1680x1050     60.01  
   1400x1050     60.01  
   1600x900      60.01  
   1280x1024     60.01  
   1400x900      60.01  
   1280x960      60.01  
   1440x810      60.01  
   1368x768      60.01  
   1280x800      60.01  
   1280x720      60.01  
   1024x768      60.01  
   960x720       60.01  
   928x696       60.01  
   896x672       60.01  
   1024x576      60.01  
   960x600       60.01  
   960x540       60.01  
   800x600       60.01  
   840x525       60.01  
   864x486       60.01  
   700x525       60.01  
   800x450       60.01  
   640x512       60.01  
   700x450       60.01  
   640x480       60.01  
   720x405       60.01  
   684x384       60.01  
   640x360       60.01  
   512x384       60.01  
   512x288       60.01  
   480x270       60.01  
   400x300       60.01  
   432x243       60.01  
   320x240       60.01  
   360x202       60.01  
   320x180       60.01  
DP-1 disconnected (normal left inverted right x axis y axis)
HDMI-1 connected 3840x2160+3840+0 (normal left inverted right x axis y axis) 597mm x 336mm
   3840x2160     30.00*   29.97    29.98  
   1920x1200     59.95  
   1920x1080     60.00    50.00    59.94  
   1920x1080i    60.00    50.00    59.94  
   1680x1050     59.88  
   1600x900      60.00  
   1280x1024     60.02  
   1440x900      59.90  
   1280x800      59.91  
   1280x720      60.00    50.00    59.94  
   1024x768      60.00  
   800x600       60.32  
   720x576       50.00  
   720x576i      50.00  
   720x480       60.00    59.94  
   720x480i      60.00    59.94  
   640x480       60.00    59.94  
   720x400       70.08  
DP-2 connected (normal left inverted right x axis y axis)
   3840x2160     60.00 +  29.98  
   1920x1200     59.88  
   1920x1080     60.00    50.00    59.94  
   1920x1080i    60.00    50.00    59.94  
   1680x1050     59.95  
   1600x900      60.00  
   1280x1024     60.02  
   1440x900      59.89  
   1280x800      59.81  
   1280x720      60.00    50.00    59.94  
   1024x768      60.00  
   800x600       60.32  
   720x576       50.00  
   720x480       60.00    59.94  
   640x480       60.00    59.94  
   720x400       70.08  

"DP-2 connected" means that the USB monior is not being driven. Manually applying the configuration with xrandr:

xrandr --output eDP-1 --mode 2560x1440 --rate 60 --pos 0x0 --output DP-2 --mode 3840x2160 --rate 60 --right-of eDP-1 --primary --output HDMI-1 --mode 3840x2160 --rate 30 --right-of DP-2

After running the command above, the USB monior is on, but it's missing a panel (i.e. panels were not properly restored)

dmesg output related to the monitor USB connection:

[184144.001869] usb 1-5: USB disconnect, device number 3
[184144.001884] usb 1-5.1: USB disconnect, device number 5
[184149.355026] ucsi_acpi USBC000:00: ucsi_handle_connector_change: GET_CONNECTOR_STATUS failed (-110)
[184150.027048] usb 1-5: new high-speed USB device number 8 using xhci_hcd
[184150.181544] usb 1-5: New USB device found, idVendor=03f0, idProduct=0169, bcdDevice=55.60
[184150.181554] usb 1-5: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[184150.181557] usb 1-5: Product: USB2.1 Hub
[184150.181559] usb 1-5: Manufacturer: GenesysLogic
[184150.186692] hub 1-5:1.0: USB hub found
[184150.186980] hub 1-5:1.0: 2 ports detected
[184150.499013] usb 1-5.1: new high-speed USB device number 9 using xhci_hcd
[184150.633437] usb 1-5.1: New USB device found, idVendor=03f0, idProduct=0169, bcdDevice=55.71
[184150.633448] usb 1-5.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[184150.633453] usb 1-5.1: Product: USB2.1 Hub
[184150.633456] usb 1-5.1: Manufacturer: GenesysLogic
[184150.634492] hub 1-5.1:1.0: USB hub found
[184150.634737] hub 1-5.1:1.0: 4 ports detected

> 1. Can you describe how the output of `xrandr` changes, if at all, when you reproduce the bug?

xrandr output after the manual configuration:

Screen 0: minimum 320 x 200, current 10240 x 2160, maximum 16384 x 16384
eDP-1 connected 2560x1440+0+0 (normal left inverted right x axis y axis) 309mm x 174mm
   2560x1440     60.01 +  60.01* 
   1920x1440     60.01  
   1856x1392     60.01  
   1792x1344     60.01  
   2048x1152     60.01  
   1920x1200     60.01  
   1920x1080     60.01  
   1600x1200     60.01  
   1680x1050     60.01  
   1400x1050     60.01  
   1600x900      60.01  
   1280x1024     60.01  
   1400x900      60.01  
   1280x960      60.01  
   1440x810      60.01  
   1368x768      60.01  
   1280x800      60.01  
   1280x720      60.01  
   1024x768      60.01  
   960x720       60.01  
   928x696       60.01  
   896x672       60.01  
   1024x576      60.01  
   960x600       60.01  
   960x540       60.01  
   800x600       60.01  
   840x525       60.01  
   864x486       60.01  
   700x525       60.01  
   800x450       60.01  
   640x512       60.01  
   700x450       60.01  
   640x480       60.01  
   720x405       60.01  
   684x384       60.01  
   640x360       60.01  
   512x384       60.01  
   512x288       60.01  
   480x270       60.01  
   400x300       60.01  
   432x243       60.01  
   320x240       60.01  
   360x202       60.01  
   320x180       60.01  
DP-1 disconnected (normal left inverted right x axis y axis)
HDMI-1 connected 3840x2160+6400+0 (normal left inverted right x axis y axis) 597mm x 336mm
   3840x2160     30.00*   29.97    29.98  
   1920x1200     59.95  
   1920x1080     60.00    50.00    59.94  
   1920x1080i    60.00    50.00    59.94  
   1680x1050     59.88  
   1600x900      60.00  
   1280x1024     60.02  
   1440x900      59.90  
   1280x800      59.91  
   1280x720      60.00    50.00    59.94  
   1024x768      60.00  
   800x600       60.32  
   720x576       50.00  
   720x576i      50.00  
   720x480       60.00    59.94  
   720x480i      60.00    59.94  
   640x480       60.00    59.94  
   720x400       70.08  
DP-2 connected primary 3840x2160+2560+0 (normal left inverted right x axis y axis) 597mm x 336mm
   3840x2160     60.00*+  29.98  
   1920x1200     59.88  
   1920x1080     60.00    50.00    59.94  
   1920x1080i    60.00    50.00    59.94  
   1680x1050     59.95  
   1600x900      60.00  
   1280x1024     60.02  
   1440x900      59.89  
   1280x800      59.81  
   1280x720      60.00    50.00    59.94  
   1024x768      60.00  
   800x600       60.32  
   720x576       50.00  
   720x480       60.00    59.94  
   640x480       60.00    59.94  
   720x400       70.08 

> 2. Can you describe how the output of `kscreen-doctor -o` changes, if at all, when you reproduce the bug?

$ kscreen-doctor -o
Output: 65 eDP-1 enabled connected priority 1 Panel Modes: 70:2560x1440@60! 71:2560x1440@60* 72:1920x1440@60 73:1856x1392@60 74:1792x1344@60 75:2048x1152@60 76:1920x1200@60 77:1920x1080@60 78:1600x1200@60 79:1680x1050@60 80:1400x1050@60 81:1600x900@60 82:1280x1024@60 83:1400x900@60 84:1280x960@60 85:1440x810@60 86:1368x768@60 87:1280x800@60 88:1280x720@60 89:1024x768@60 90:960x720@60 91:928x696@60 92:896x672@60 93:1024x576@60 94:960x600@60 95:960x540@60 96:800x600@60 97:840x525@60 98:864x486@60 99:700x525@60 100:800x450@60 101:640x512@60 102:700x450@60 103:640x480@60 104:720x405@60 105:684x384@60 106:640x360@60 107:512x384@60 108:512x288@60 109:480x270@60 110:400x300@60 111:432x243@60 112:320x240@60 113:360x202@60 114:320x180@60 Geometry: 0,0 2560x1440 Scale: 1 Rotation: 1 Overscan: 0 Vrr: incapable RgbRange: unknown
Output: 66 DP-1 disabled disconnected priority 0 DisplayPort Modes: Geometry: 0,0 0x0 Scale: 1 Rotation: 1 Overscan: 0 Vrr: incapable RgbRange: unknown
Output: 67 HDMI-1 enabled connected priority 2 HDMI Modes: 115:3840x2160@30*! 116:3840x2160@30 117:3840x2160@30 118:1920x1200@60 119:1920x1080@60 120:1920x1080@50 121:1920x1080@60 122:1920x1080@60 123:1920x1080@50 124:1920x1080@60 125:1680x1050@60 126:1600x900@60 127:1280x1024@60 128:1440x900@60 129:1280x800@60 130:1280x720@60 131:1280x720@50 132:1280x720@60 133:1024x768@60 134:800x600@60 135:720x576@50 136:720x576@50 137:720x480@60 138:720x480@60 139:720x480@60 140:720x480@60 141:640x480@60 142:640x480@60 143:720x400@70 Geometry: 6400,0 3840x2160 Scale: 1 Rotation: 1 Overscan: 0 Vrr: incapable RgbRange: unknown
Output: 68 DP-2 enabled connected priority 3 DisplayPort Modes: 117:3840x2160@30 119:1920x1080@60 120:1920x1080@50 121:1920x1080@60 122:1920x1080@60 123:1920x1080@50 124:1920x1080@60 126:1600x900@60 127:1280x1024@60 130:1280x720@60 131:1280x720@50 132:1280x720@60 133:1024x768@60 134:800x600@60 135:720x576@50 137:720x480@60 138:720x480@60 141:640x480@60 142:640x480@60 143:720x400@70 144:3840x2160@60*! 145:1920x1200@60 146:1680x1050@60 147:1440x900@60 148:1280x800@60 Geometry: 2560,0 3840x2160 Scale: 1 Rotation: 1 Overscan: 0 Vrr: incapable RgbRange: unknown

> 3. Does the bug happen on Wayland too? Or is it 11-only?

I haven't tested on Wayland, just X11

> 4. Did you upgrade from an earlier Plasma version? If you did, can you move aside (not delete) your ~/.local/share/kscreen folder, re-create the display arrangement in System Settings > Display and Monitor, reboot, and see if it's better now?

Fresh Kubuntu 23.04 install.

> 5. If it's still not, can you try re-arranging the desktops and/or the panels in the Manage desktops and panels window to be in the place where they're supposed to be, then reboot, then try to make it happen again, and see what happens?

I can't, "Panels and Desktop Management" shows the USB monitor as "Disconnecetd Screen 3. See the attached screenshot (taken with the USB monitor) (Screenshot_20230706_133627.png)

Used the following commands to restore a working backup:
systemctl --user stop plasma-plasmashell
cp -avf $HOME/backup/org.kde.plasma.desktop-appletsrc $HOME/.config/
cp -avf $HOME/backup/plasmashellrc $HOME/.config/
sleep 5
systemctl --user start plasma-plasmashell

USB monitor is still missing panel.
Comment 13 leonardopsantos 2023-07-06 17:42:05 UTC
Created attachment 160104 [details]
Panels and Desktop Management screenshot showing screen as disconnected
Comment 14 leonardopsantos 2023-07-11 15:56:26 UTC
Switched to Wayland. Seems to work "fine". 

The setup:

A. Laptop screen has a default Kubuntu panel with the Application Launcher, Pager, Task Manager, and System Tray widgets.
C. USB external screen has a panel with the Application Launcher, Task Manager, and System Tray widgets.
C. HDMI external screen has a panel with the Task Manager widget only.

1. Disconnect the HDMI cable: the panel from the HDMI (C above) monitor is moved to the USB monitor, overlapping it. I don't think this should happen.
2. Disconnect the USB monitor: laptop screen has the correct panel.
3. Reconnect the HDMI cable: the HDMI monitor gets the USB monitor panel (B above)
4. Reconnect the USB cable: the panels are restored. 

It's worth mentioning that not only the panels were restored, but the windows were also correctly restored to the original screen and panels. 

I repeated the steps above, but got a different result:

1. Disconnect the HDMI cable: the panel from the HDMI (C above) monitor is moved to the USB monitor, overlapping it.
2. Disconnect the USB monitor: laptop screen has the correct panel.
3. Reconnect the HDMI cable: nothing happens: the external HDMI monitor is blank. kde5 crashes, kwallet crashes, other apps also crash.
4. Reconnect the USB cable: both monitors go on now. The panels are restored.
Comment 15 Nate Graham 2023-07-25 21:41:59 UTC
If it works on Wayland, let's consider it fixed, as X11 is known to work poorly with complex multi-screen arrangements. There's only some much that can be done there.

The crash you see on Wayland is a separate issue that should be fixed though. Feel free to submit a new bug report for it!