emvaized / kde-snap-assist

KWin script for KDE Plasma which suggests other window thumbnails on snap
https://store.kde.org/p/1875687
GNU General Public License v3.0
119 stars 7 forks source link

Feature request: Filter windowed tiles #5

Open nclarius opened 2 years ago

nclarius commented 2 years ago

Related to the other proposal, it might be useful to have the assistant only show on tiles that are not already filled by some window.

emvaized commented 2 years ago

I think that recently introduced "snap groups" features are the natural extension for this script, and it's future development should focus on this direction, making them more stable and more smoothly integrated in the system and the workflow. "Snap groups" features suggest users to think of snapped windows as of one window, which can be minimized/restored and focused with a single click. I just haven't introduced them properly to the users yet, with video introduction and stuff (as I found out it's not working on Wayland), so couldn't gather some feedback to confirm or refute my opinion.

However, the feature you request in this form may not align well with the "snap groups" functionality, as it will prevent users from creating several snap groups of the same layout. From my point of view, that would be as if two options in the config would imply completely different workflows, which would likely contradict with each other.

But we probably could rethink it so that it would complement and extend the "snap groups" workflow instead of contradicting it. For example, currently there's an option in settings to try to fill the area on closing the snapped window, which resizes other windows from the same group to cover the gap. Perhaps we could introduce something similar for when a new window gets snapped: if there's active unminimized snap group right behind it, and it has any window matching the same size and position, it will get snapped with new window in the group, and the assist will not show; or if it's possible, other windows in the group could resize to fit a newly snapped window in the layout of this group.

Implementing this will require additional work on determining if the given snap group is on top of the windows stack or not, and I'm not sure if this feature will be intuitive enough and easy to understand for users.

Please let me know what are your thoughts on this.

emvaized commented 2 years ago

I just implemented new test option "Try to fit snapped window in group behind it" in the dev branch, which does more or less what I described: when there's active snap group behind the newly snapped window, the script will try to fit it in the group, and if it succeeds assist will not show.

fit-in-group-behind

It's not fully stable yet, sometimes the script fails to detect snap group behind the window – I believe there must be a better way to find out windows stacking order rather than relying on last activation time. But it could give a taste of how I see this option.

emvaized commented 2 years ago

After some polishing, the feature is now released in the new version 1.6.

Perhaps it's also possible to improve it by making a window "fit" in a snap group when it already fits it, and no need to resize other windows to let it in — I may think about it for next releases. But for now, the need for such option can be resolved by enabling the last three "snap groups" features in the script settings.

emvaized commented 2 years ago

"Try to fit snapped window in group behind it" now also tries to fit a window if it doesn't intersect with other windows in the group. Assist is not shown if it manages to do so.

This behavior can be tested by installing latest dev branch code — I consider it a 2.0-dev version.