Bug 496598 - Identify primary screen in kwinscript
Summary: Identify primary screen in kwinscript
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: scripting (show other bugs)
Version: unspecified
Platform: Other Linux
: LO wishlist
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-11-23 01:44 UTC by Yuxin Wu
Modified: 2024-12-20 13:22 UTC (History)
1 user (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 Yuxin Wu 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