Bug 463491 - Wayland kwin script api gives 0 to client.windowId when 'workspace.clientAdded.connect' event is triggered.
Summary: Wayland kwin script api gives 0 to client.windowId when 'workspace.clientAdde...
Status: RESOLVED NOT A BUG
Alias: None
Product: kwin
Classification: Plasma
Component: scripting (other bugs)
Version First Reported In: 5.26.4
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-12-26 15:12 UTC by shockw424
Modified: 2022-12-27 10:08 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description shockw424 2022-12-26 15:12:57 UTC
SUMMARY
wayland kwin script api gives 0 to client.windowId when 'workspace.clientAdded.connect' event is triggered.
The windowId is however given to the client.windowId variable when the application is run using Xwayland.

STEPS TO REPRODUCE
1. Alt+F2, then type 'plasma-interactiveconsole --kwin'
2. Paste this script into the code field.
```
workspace.clientAdded.connect((client) => {console.log(client.windowId);});
```
3. start a terminal emulator and type 'journalctl -g "js:" -f'
4. Execute the code in plasma-interactiveconsole.
5. Open a non Xwayland application, any will suffice. 

OBSERVED RESULT
It should give 0 for each wayland application opened.

EXPECTED RESULT
The expected result should be a windowId similar to this 10485803. 
If you open an Xwayland Application you should see the expected result

SYSTEM INFORMATION
Operating System: Arch Linux
KDE Plasma Version: 5.26.4
KDE Frameworks Version: 5.101.0
Qt Version: 5.15.7
Kernel Version: 6.1.1-arch1-1 (64-bit)
Graphics Platform: Wayland
Processors: 24 × AMD Ryzen 9 3900X 12-Core Processor
Memory: 31.3 GiB of RAM
Graphics Processor: NVIDIA GeForce GTX 1080/PCIe/SSE2
Manufacturer: Gigabyte Technology Co., Ltd.
Product Name: X570 AORUS ELITE
System Version: -CF
Comment 1 David Edmundson 2022-12-27 10:08:08 UTC
windowId only exist for X11 windows. 

src/x11window.h:    Q_PROPERTY(qulonglong windowId READ window CONSTANT)

as it maps to the underlying X11 window ID type.

For something universal use:

src/window.h:    Q_PROPERTY(QUuid internalId READ internalId CONSTANT)