Bug 457905 - When plugging laptop into a dock with 2 monitors and disabling the laptop screen, containment on now-disabled primary laptop screen is moved to the wrong dock-connected screen
Summary: When plugging laptop into a dock with 2 monitors and disabling the laptop scr...
Status: RESOLVED WORKSFORME
Alias: None
Product: plasmashell
Classification: Plasma
Component: generic-multiscreen (show other bugs)
Version: 5.25.4
Platform: openSUSE Linux
: NOR normal
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-08-15 09:31 UTC by Denis Kuplyakov
Modified: 2022-09-22 15:54 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Effective screen settings after attaching to dockstation. (87.33 KB, image/png)
2022-08-15 09:32 UTC, Denis Kuplyakov
Details
Desktop after inserting to dock-station (2.83 MB, image/jpeg)
2022-08-15 09:33 UTC, Denis Kuplyakov
Details
Plasma's "panels and desktops" after inserting to dock-station (79.38 KB, image/jpeg)
2022-08-15 09:34 UTC, Denis Kuplyakov
Details
Desktop after plasmashell restart (2.73 MB, image/jpeg)
2022-08-15 09:35 UTC, Denis Kuplyakov
Details
Plasma's "panels and desktops" after plasmashell restart (113.94 KB, image/jpeg)
2022-08-15 09:35 UTC, Denis Kuplyakov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Denis Kuplyakov 2022-08-15 09:31:37 UTC
SUMMARY
I have a Dell E5470 laptop. Everyday I use two screen configurations:
1. just using the laptop with it's embedded screen as primary;
2. attaching the laptop to a dockstation with two monitors connected. They are positioned in a row and the right one is the primary. Laptop's screen is closed and disabled.

STEPS TO REPRODUCE and OBSERVED RESULT and EXPECTED RESULT
1. attach the laptop to dockstation;
2. OBSERVED: left screen is shown as primary and have the main panel on it;
   EXPECTED: right screen is shown as primary as it was configured in screen settings
3. OBSERVED: plasma "panels and desktops" doesn't show the second monitor at all;
   EXPECTED: plasma "panels and desktops" shows the second monitor;

By the moment I run such workaround to repair the problem:
3. run `killall plasmashell; kstart plasmashell`;
4. right screen become primary as expected;

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: openSUSE  Tumbleweed 20220813
(available in About System)
KDE Plasma Version:  5.25.4
KDE Frameworks Version: 5.96.0
Qt Version: 5.15.5

ADDITIONAL INFORMATION
The bug was introduced since July openSUSE Tumbleweed update. Before this stuff was working as expected.
Comment 1 Denis Kuplyakov 2022-08-15 09:32:19 UTC
Created attachment 151329 [details]
Effective screen settings after attaching to dockstation.
Comment 2 Denis Kuplyakov 2022-08-15 09:33:53 UTC
Created attachment 151330 [details]
Desktop after inserting to dock-station
Comment 3 Denis Kuplyakov 2022-08-15 09:34:27 UTC
Created attachment 151331 [details]
Plasma's "panels and desktops" after inserting to dock-station
Comment 4 Denis Kuplyakov 2022-08-15 09:35:10 UTC
Created attachment 151332 [details]
Desktop after plasmashell restart
Comment 5 Denis Kuplyakov 2022-08-15 09:35:38 UTC
Created attachment 151333 [details]
Plasma's "panels and desktops" after plasmashell restart
Comment 6 Nate Graham 2022-08-15 17:32:04 UTC

*** This bug has been marked as a duplicate of bug 450068 ***
Comment 7 Denis Kuplyakov 2022-08-16 09:59:29 UTC
(In reply to Nate Graham from comment #6)
> 
> *** This bug has been marked as a duplicate of bug 450068 ***

I think that the issue is not the same as in the bug 450068. In my setup screen connectors names doesn't change and numbers doesn't increase. Here is the output of some commands to prove that:

```
(here laptop is not connected to dock-station)

$ ls /sys/class/drm
card1       card1-DP-2  card1-eDP-1     card1-HDMI-A-2  renderD128
card1-DP-1  card1-DP-3  card1-HDMI-A-1  card1-HDMI-A-3  version

$ cat .config/plasmashellrc | grep -A 6 ScreenConnectors
[ScreenConnectors]
0=eDP-1        <-- this is the laptop screen, as I assume zero means that it is primary, which is correct
1=HDMI-1
2=DP-1
3=DP-2

(here I connect the laptop to dock-station and closing the laptop)

$ ls /sys/class/drm 
card1       card1-DP-2  card1-eDP-1     card1-HDMI-A-2  renderD128   <--- here nothing has changed
card1-DP-1  card1-DP-3  card1-HDMI-A-1  card1-HDMI-A-3  version

$ cat .config/plasmashellrc | grep -A 6 ScreenConnectors
[ScreenConnectors]
0=DP-2           <-- DP-2 (right monitor) is primary, but treated by plasma as secondary
1=HDMI-1      <-- this is not connected
2=DP-1           <-- DP-1 (left monitor) is secondary, but treated by plasma as primary
3=eDP-1

(here I see that plasma doesn't render expected panels on the primary screen)

$ killall plasmashell && kstart plasmashell

$ ls /sys/class/drm
card1       card1-DP-2  card1-eDP-1     card1-HDMI-A-2  renderD128  <--- here nothing has changed
card1-DP-1  card1-DP-3  card1-HDMI-A-1  card1-HDMI-A-3  version

$ cat .config/plasmashellrc | grep -A 6 ScreenConnectors
[ScreenConnectors]
0=DP-2        <--- here nothing has changed, but plasma now renders panels correctly
1=HDMI-1
2=DP-1
3=eDP-1
```

nate@kde.org, what do you think? It doesn't look like a duplicate.
Comment 8 Nate Graham 2022-08-17 16:02:52 UTC
OK yeah, probably not exactly the same issue. I suspect it will be fixed by whatever fixes Bug 450068 anyway though. 

Are you on X11 or Wayland?
Comment 9 Denis Kuplyakov 2022-08-17 16:04:09 UTC
(In reply to Nate Graham from comment #8)
> OK yeah, probably not exactly the same issue. I suspect it will be fixed by
> whatever fixes Bug 450068 anyway though. 
> 
> Are you on X11 or Wayland?

OK. I am on X11
Comment 10 Nate Graham 2022-08-17 16:26:57 UTC
Thanks. On X11, does the problem stop happening if you make the left-most docked screen the primary screen?

It will be a pain in the butt because you'll have to redo your layout from scratch, but do you think you could test to see if it works better on Wayland?

I ask these questions because X11 is known to have problems when the primary screen isn't the left-most one.
Comment 11 Bug Janitor Service 2022-09-01 04:36:24 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 12 Bug Janitor Service 2022-09-17 04:36:07 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!
Comment 13 Denis Kuplyakov 2022-09-19 09:36:10 UTC
(In reply to Nate Graham from comment #10)
> Thanks. On X11, does the problem stop happening if you make the left-most
> docked screen the primary screen?

Sorry, I haven't tested this yet.

> It will be a pain in the butt because you'll have to redo your layout from
> scratch, but do you think you could test to see if it works better on
> Wayland?

But, I have tested wayland and it fixed mentioned problem. There was no need to redo my layout, I just changed X11 to Wayland in login settings. The only thing I have to change was the screen DPI in fonts settings. In X11 screen DPI was forced the following way:

```
$ cat /etc/X11/xinit/xinitrc.d/90-dpi.sh 
#!/bin/sh

xrandr --dpi 157
```

The only app that still renders with incorrect DPI is Firefox and some other GTK applications. I still have no clue how to fix this.

There is also a bug that have been fixed with Wayland. In X11 if I lock screen with laptop attached to dockstation with two screens then detach it, laptop screen stands black and shows only mouse pointer and nothing makes X11 to start using it. The only way is to hit ctrl+alt+backspace to stop X11. That's why I used the following workaround: unlock screen first and only after detach from dockstation.

But migration to Wayland introduced another bug. Everything is OK with plasma panels. But screen wallpaper and desktop type preferences are totally broken. With laptop detached from screens I have slideshow settings with "default desktop" type. With laptop attached I see default wallpaper on both screens. Desktop settings of the left screen (which is secondary) allows me to modify wallpaper, but they show desktop type as "show folder", but I don't see ~/Desktop/ folder contents. Desktop settings of the right screen (which is primary) doesn't allow me to modify neither wallpaper nor desktop type. When I hit "Apply" nothing happens and if I open settings window again it shows old settings.

Anyway, everything above is about other bugs/issues. Here I can confirm that migration to Wayland solved the topic-starting problem. nate@kde.org, can you please change the status accordingly or you want me to test with left screen as primary on X11?
Comment 14 Nate Graham 2022-09-19 21:52:20 UTC
I"m glad to hear that overall, Wayland fixed the issue. Please do file a bug report about the issue you found.

And if you could test the case where the primary screen is the left-most one, that would be lovely.
Comment 15 Denis Kuplyakov 2022-09-22 15:12:35 UTC
(In reply to Nate Graham from comment #14)
> I"m glad to hear that overall, Wayland fixed the issue. Please do file a bug
> report about the issue you found.

I've reported it https://bugs.kde.org/show_bug.cgi?id=459532
Comment 16 Denis Kuplyakov 2022-09-22 15:54:58 UTC
(In reply to Nate Graham from comment #14)
> And if you could test the case where the primary screen is the left-most
> one, that would be lovely.

I have tested this by docking/undocking my laptop. Primary screen panels correctly move from laptop screen to the left external screen. But panels rendered on the right screen, which is secondary, are more like a random. Sometimes there are no panels, sometimes there is previous secondary screen panel.