Bug 448418

Summary: [wayland] - plasma 5.24 - primary display is not respected as it should
Product: [Unmaintained] lattedock Reporter: Marko Gobin <gobonja>
Component: applicationAssignee: Michail Vourlakos <mvourlakos>
Status: RESOLVED FIXED    
Severity: normal CC: bugs.kde, marc.fez, openmindead, tamara.zoe.schmitz
Priority: NOR    
Version First Reported In: 0.10.7   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In: 0.11.0
Sentry Crash Report:

Description Marko Gobin 2022-01-14 00:03:29 UTC
SUMMARY
Since 5.24 beta primary monitor setting is introduced: https://bugs.kde.org/show_bug.cgi?id=442158.
This works with "normal" panels but not with latte.

STEPS TO REPRODUCE
1. Setup dock/panel to follow primary screen
2. Attach external monitor and set it as primary

OBSERVED RESULT
Dock/panel stays on first display (e.g. eDP1)

EXPECTED RESULT
Dock/panel should be moved to primary display

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Arch
KDE Plasma Version: 5.23.90
KDE Frameworks Version: 5.90.0
Qt Version: 5.15.2
Graphic platform: Wayland
Comment 1 Michail Vourlakos 2022-01-14 07:27:49 UTC
plasma 5.24 has built its own internal wayland protocol in order to identify primary screen. Of course that means that adjusting Latte might be a lot of work...

reference: https://github.com/KDE/plasma-workspace/commit/0f2be58f1408bff6d3cf3153d555f86b29e27ba2
Comment 2 Tamara Schmitz 2022-01-23 12:30:18 UTC
I can confirm this on my system. Everytime power management switches off the monitors, desktop icons and the status bar appear on my secondary monitor. My second monitor appears to be treated differently as it is connected via HDMI-to-DVI cable versus my primary monitor being connected via DP.

Clearly this automatic system cannot handle all cases, so a manual configuration option in the menu and the monitor switching overlay just like under X11 would be highly appreciated.

System version:
Operating System: openSUSE Tumbleweed 20220121
KDE Plasma Version: 5.23.5
KDE Frameworks Version: 5.90.0
Qt Version: 5.15.2
Kernel Version: 5.16.1-1-default (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 7 2700X Eight-Core Processor
Memory: 31,3 GiB of RAM
Graphics Processor: AMD Radeon RX 6700 XT
Comment 3 Michail Vourlakos 2022-04-17 10:08:59 UTC
*** Bug 452597 has been marked as a duplicate of this bug. ***
Comment 4 Michail Vourlakos 2022-05-09 17:46:13 UTC
Git commit b1d57051c227ce5f52bde52b8f8308273fa2127b by Michail Vourlakos.
Committed on 09/05/2022 at 17:35.
Pushed by mvourlakos into branch 'master'.

wayland:support Plasma primaryscreen protocol

--use ScreenPool as reference for primary screen.
The new code uses PrimaryOutputWatcher class from
Plasma Shell in order to keep track of primary
screen at all cases.
FIXED-IN:0.11.0

M  +8    -2    CMakeLists.txt
M  +22   -21   README.md
M  +8    -1    app/CMakeLists.txt
M  +1    -1    app/infoview.h
M  +32   -26   app/lattecorona.cpp
M  +4    -4    app/lattecorona.h
M  +11   -10   app/layout/genericlayout.cpp
M  +2    -2    app/layout/genericlayout.h
M  +3    -2    app/layouts/synchronizer.cpp
M  +4    -2    app/plasma/extended/screenpool.cpp
M  +4    -0    app/plasma/extended/screenpool.h
A  +166  -0    app/primaryoutputwatcher.cpp     [License: LGPL(v2.0+)]
A  +58   -0    app/primaryoutputwatcher.h     [License: LGPL(v2.0+)]
M  +28   -50   app/screenpool.cpp
M  +10   -8    app/screenpool.h
M  +9    -8    app/view/positioner.cpp
M  +4    -3    app/view/view.cpp
M  +1    -1    containment/package/metadata.desktop
M  +1    -1    plasmoid/package/metadata.desktop
M  +1    -1    shell/package/metadata.desktop

https://invent.kde.org/plasma/latte-dock/commit/b1d57051c227ce5f52bde52b8f8308273fa2127b
Comment 5 Vladimir Yerilov 2022-05-10 06:48:45 UTC
(In reply to Michail Vourlakos from comment #4)
> Git commit b1d57051c227ce5f52bde52b8f8308273fa2127b by Michail Vourlakos.
> Committed on 09/05/2022 at 17:35.
> Pushed by mvourlakos into branch 'master'.
> 
> wayland:support Plasma primaryscreen protocol
> 
> --use ScreenPool as reference for primary screen.
> The new code uses PrimaryOutputWatcher class from
> Plasma Shell in order to keep track of primary
> screen at all cases.
> FIXED-IN:0.11.0

Works great on Plasma 5.24.5, thanks! Tried unplugging my external monitor and plugging it back, both times Latte moved to the correct screen automatically. The only drawback now is on Plasma side as it resets the wallpaper on the external monitor to the defaults but Latte is fine anyway.