nclarius / tile-gaps

KWin script to add space around windows touching a screen edge or other window
https://store.kde.org/p/1619642
GNU General Public License v3.0
104 stars 16 forks source link

Incompatibility with KDE Snap Assist script #16

Closed Terkyz closed 1 year ago

Terkyz commented 2 years ago

Among many other scripts to customize KDE, there is a very recent one called KDE Snap Assist that helps to preview open windows to place them next to others in the style of Windows.

My problem is that if I try to use that script specifically in conjunction with Tile-gaps, KDE Snap Assist stops working.

I honestly know it's not your responsibility to fix other people's bugs and if I had programming skills I'd help with this, but I don't know if this is a tile-gaps bug or a KDE Snap Assist bug, I can also open an issue on that other guy's github script

nclarius commented 2 years ago

I don't think there is anything I can do on my end.

If @emvaized you would like to add support for this in your script, I would suggest introducing a (possibly configurable) tolerance threshold up to which windows slightly differing from the tile geometry would still be considered tiled, so that windows trigger the assistant even when a little gapped:

/// Detect if window was snapped
/// left/right halves
if (width === halfScreenWidth && height == currentScreenHeight && dy === maxArea.y)

=>

const threshold = 15;
...
if (Math.abs(width - halfScreenWidth) <= threshold && Math.abs(height - currentScreenHeight) <= threshold && Math.abs(dy - maxArea.y) <= threshold)

Cool extension by the way, will give it a try, I have been looking for something like this for a long time.

emvaized commented 2 years ago

Thanks for your suggestion! I've just tried rewriting a few bits of code using the proposed method, separated in isEqual() function, but it somehow doesn't work for all layouts, as well as causes a lot of false detections and misbehavior. I think it's because the current code relies too much on precise geometry calculations.

I'll try to revisit it later with deeper investigation on what exactly goes wrong