Bug 466482 - kwin scripting interface missing important tiling methods
Summary: kwin scripting interface missing important tiling methods
Status: REPORTED
Alias: None
Product: kwin
Classification: Plasma
Component: scripting (show other bugs)
Version: 5.27.1
Platform: Arch Linux Linux
: NOR wishlist
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-02-26 17:52 UTC by vaughanm1@protonmail.com
Modified: 2023-03-23 17:02 UTC (History)
2 users (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 vaughanm1@protonmail.com 2023-02-26 17:52:57 UTC
SUMMARY
***
I have been exploring the (completely undocumented) brand new kwin tiling interface exposed in the scripts. After getting a grasp on the interface and examining the Doxygen for kwin, I attempted to write a tiling script that would automatically tile all windows to the defined layout. Unfortunately, this did not work. Further inspection of the KWin::Tile object via dumping the methods of the javascript object into strings has revealed that there is no addWindow() method for the Tile object. The windows array of the Tile object also seems to be immutable, or at least not pushable. There are several missing functions in the javascript interface, but this one (and deleteWindow(), etc.) renders the entire new tiling API almost useless.

If this method happens to exist and is hidden below the surface of the API, official documentation would be very much appreciated.
***


STEPS TO REPRODUCE
1. Use the script located at https://github.com/zeroxoneafour/kwin_tiling/blob/master/utils/dump_class_info.js in the plasma-interactiveconsole --kwin, substituting class_name for a tile like workspace.tilingForScreen(workspace.currentScreen).rootTile (the root tile of the current screen)
2. Open journalctl --user --no-pager -e and look at the output of the script

OBSERVED RESULT
There is no line with addWindow: function() { [native code] }

EXPECTED RESULT
A line appears with the functions addWindow and removeWindow, as is documented in the Doxygen I generated at https://zeroxoneafour.github.io/kwin_tiling/kwin_doxygen/class_k_win_1_1_tile.html

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 6.1.12-zen1-1-zen (64-bit)
KDE Plasma Version: 5.27.1
KDE Frameworks Version: 5.103.0
Qt Version: 5.15.8

ADDITIONAL INFORMATION
I have tried calling addWindow(window) even after seeing the script output results and it is still undefined. I have called it on non-root windows, and have observed that, although the windows array of the Tile object changes based on whether a window is tiled or not, it cannot be modified with addWindow(window) or windows.push(window).

All of my findings can be found at https://zeroxoneafour.github.io/kwin_tiling/