Bug 496598

Summary: Identify primary screen in kwinscript
Product: [Plasma] kwin Reporter: ppwwyyxx <ppwwyyxxc>
Component: scriptingAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: wishlist CC: kde
Priority: LO    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description ppwwyyxx 2024-11-23 01:44:09 UTC
In kwinscript I used to identify primary screen by simply `workspace.screens[0]`. Some other open source code (e.g. https://github.com/nclarius/KWin-window-positioning-scripts/blob/fe9d1641982912075f9debe68cc6b9afde7292d5/always-open-on-primary-screen/contents/code/main.js#L24-L25 ) does the same.

After changing to wayland recently I found that `workspace.screens[0]` is no longer the primary screen that's set in "Display Configuration". It seems there is no reliable way in kwinscript to identify which screen is primary.



SOFTWARE/OS VERSIONS
Linux/KDE Plasma: archlinux; wayland
KDE Plasma Version: 6.2.3
KDE Frameworks Version:6.8.0 
Qt Version: 6.8.0
Comment 2 Vlad Zahorodnii 2024-12-20 13:22:05 UTC
Git commit 58cee934c46f49d31f0a1706c808d014a34ea5a5 by Vlad Zahorodnii.
Committed on 20/12/2024 at 13:22.
Pushed by vladz into branch 'master'.

scripting: Expose output order

M  +6    -0    src/scripting/workspace_wrapper.cpp
M  +7    -0    src/scripting/workspace_wrapper.h

https://invent.kde.org/plasma/kwin/-/commit/58cee934c46f49d31f0a1706c808d014a34ea5a5