nclarius / KWin-window-positioning-scripts

KWin scripts controlling window placement on multi-monitor setups
GNU General Public License v3.0
59 stars 14 forks source link

[Always open on primary] Overrides window rules #7

Closed Merrit closed 2 years ago

Merrit commented 2 years ago

I ideally this shouldn't override a specific rule if I want a certain application to open on a secondary monitor, but windows without rules to open on primary.

nclarius commented 2 years ago

I agree this would be desirable, but unfortunately it is not clear to me at all from the KWin scripting API documentation how the window rules option is supposed to be used and my guesses just gave me errors, so at the moment I don't know if and how this could be implemented.

Merrit commented 2 years ago

Yeah, working with the API isn't easy. It is especially difficult since a bug means there is no way to get output from the scripting console to find out what might be wrong.

nclarius commented 2 years ago

After asking over at Kreddit, it looks like the API doesn't provide what would be needed. Since a configuration widget for all kinds of combinations of window classes and titles to exclude would be complicated to do, a quick and dirty solution would be for you to hardcode your rules into the script:

In always-open-on-primary-screen/contents/code/main.js, at the beginning of the function add a return condition; e.g. to ignore utility windows of class dolphin with "abcd" in the title:

if (client.utility && String(client.resourceClass) == "dolphin" && String(client.resourceName).includes("abcd")) return;

Cone the repo, do the modification as described above, then reinstall according to the instructions in the readme except with the -u ("upgrade") instead of -i ("install") flag.

Merrit commented 2 years ago

That's a very smart work-around! :grinning:

Thanks for looking into it. If support just isn't available feel free to close the issue, I am satisfied. 💙

nclarius commented 2 years ago

Glad I could help!

nclarius commented 2 years ago

BTW, the KWin scripting console output can at least be accessed from the system journal:

journalctl -b0 -f

https://bugs.kde.org/show_bug.cgi?id=445058#c4

And of course with

kwin_x11 --replace &&
Merrit commented 2 years ago

journalctl -b0 -f

Well that's bloody brilliant! I've been needing this, thank you very much for sharing! :grin: :tada: