Bug 498561

Summary: workspace.screens undefined
Product: [Plasma] kwin Reporter: Kalle Hallivuori <kde-bugs>
Component: scriptsAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED UNMAINTAINED    
Severity: normal CC: fanzhuyifan
Priority: NOR    
Version First Reported In: 5.27.11   
Target Milestone: ---   
Platform: Kubuntu   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Kalle Hallivuori 2025-01-12 14:37:53 UTC
SUMMARY
`workspace.screens` is not available although it should according to https://develop.kde.org/docs/plasma/kwin/api/#read-only-properties-1

STEPS TO REPRODUCE
1. `sudo less +F /var/log/syslog`
2. `plasma-interactiveconsole --kwin`
3. Execute script: `print(workspace.screens)`

OBSERVED RESULT
`undefined`

EXPECTED RESULT
`[<Screen0>, <Screen1>, <Screen2>]`

SOFTWARE/OS VERSIONS
Windows: -
macOS: -
(available in the Info Center app, or by running `kinfo` in a terminal window)
Operating System: Kubuntu 24.04
KDE Plasma Version: 5.27.11
KDE Frameworks Version: 5.115.0
Qt Version: 5.15.13
Kernel Version: 6.8.0-51-generic (64-bit)
Graphics Platform: offscreen
Processors: 12 × AMD Ryzen 5 5500
Memory: 31.1 GiB of RAM
Graphics Processor: NVIDIA GeForce GTX 1660 SUPER/PCIe/SSE2

ADDITIONAL INFORMATION
In order to be able to develop key shortcuts for relocating windows, I have been repeating a loop of
1. install a kwinscript that installs keyboard shortcuts
2. logout from KDE (to SDDM login screen)
3. remove the installed entries from ~/.config/kglobalshortcutsrc
4. log in to KDE (same credentials, via SDDM)
I cannot see how this could break kwin but mentioning for completeness.
Comment 1 fanzhuyifan 2025-01-13 00:03:33 UTC
As noted in the referenced document, it describes KWin Scripting API as of KWin 6.0. Please try this on a newer version of kde plasma (e.g., 6.2).