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
108 stars 6 forks source link

Ability to easily edit layouts #18

Open emvaized opened 2 years ago

emvaized commented 2 years ago

It would be good to refactor the script in order to use 12x12 grid, so that users could easily manage all supported layouts, add new or remove the current ones.

emvaized commented 2 years ago

As for now, I can imagine this as rewriting onWindowResize() and switchAssistLayout() functions to make use of some common layout.js file, listing all supported snapped window positions, corresponding assistant positions, and assistant alternative positions, cycled through with the Tab key. Probably it also makes sense to use abstract 12x12 grid in this config file, instead of relying on fractions of the screen height and width.

The problem to solve here is that switchAssistLayout() function uses a lot of context depending code to determine where to show next alternative position for the assist — as well as next assist positions to show on client select, depending of current assist layout. We need to figure out how to preserve all this logic.