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

[Feature Request] Add the possibility to exclude certain windows by classname #14

Closed tam1m closed 2 years ago

tam1m commented 2 years ago

As the title states, it would be nice to have an exclusion list for windows, that shouldn't be effected by the script.

For instance, I have mpv set to always open on my secondary display, which obviously doesn't play nice with your window positioning scripts at the moment. The kwin-forceblur script does this really nice if you need some inspiration of how to implement that. It's using a a simple list of window classnames which can either work as deny or allowlist.

It looks like this: Screenshot_20220413_193553

nclarius commented 2 years ago

I would like to avoid adding too much complexity to the script, but for your specific setup you could just hardcode the exception into the script:

In ~/.local/share/kwin/scripts/alwaysopenonactivescreen/contents/code/main.js, after the return statement in l. 26., add a new line

if (["konsole", "dolphin"].includes(client.resourceClass)) return;

(with the window classes you want to exclude in the square brackts).

The next time you start the window manager (log out an in again, or run kwin_x11 --replace &/kwin_wayland --replace &) the changes should take effect.

tam1m commented 2 years ago

First of all, thank's for all the kwin scripts. I'm using a few of them and they are awesome!

Back no topic. Your solution above is what I was doing before. I don't think the requested feature adds so much complexity for the pretty big benefit it gives. It'd be, I think, the simplest workaround for not respecting plasmas window rules and the maintenance burden should be minimal.

Anyways, if it goes against your philosophie for this project, that's alright. I just implemented it myself here. If you're open to contributions I'll gladly send you a PR. Otherwise, I'll just keep this fork

nclarius commented 2 years ago

I spent some time thinking about it and came to the conclusion that being able to exclude certain windows might indeed solve more problems than it creates. So if you'd like to do a PR, go ahead!