Quick Tile An App When It Opens Using A KWin Script
A user on reddit recently asked how to quick tile a window when it opens in a multi monitor setup. While they could easily position the app using a KWin Rule, that solution would only work for a single monitor. As if you launched the app on the 2nd monitor, the app would always show up on the 1st monitor.
When KWin Rules fails, you can write a KWin Script!
https://techbase.kde.org/Development/Tutorials/KWin/Scripting/API_4.9
Then paste this in the metadata.desktop
file:
That’ll define the name/icon of script that shows up in System Settings. Make sure X-KDE-PluginInfo-Name=QuickTileAppOnStart
uses the same name as the folder you place it under. Next up is the actual script.
Then in the main.js
paste:
Change navigator
and firefox
to whatever “window class” you’d use in a KWin Rule to limit this quick tile effect to a single application. Otherwise remove the if statement.
Finally, open up KWin Scripts in System Settings, enable the script and hit apply. If it doesn’t work and you edited the main.js
, to “reload” the script, disable the script, hit apply, then re-enable the script and hit apply.