This is a very simple but flexible and easy to modify KWin script (see contents/code/main.js). By default it defines the following shortcuts/keybindings which work like the screen edge snap zones:
Meta+D
: snap the current window to the left third of the current monitorMeta+Shift+D
: snap the current window to the left two thirds of the current monitorMeta+G
: snap the current window to the right third of the current monitorMeta+Shift+G
: snap the current window to the right third of the current monitorMeta+F
: snap the current window to the center third of the current monitorMeta+Shift+F
: snap the current window to the center quarter of the current monitor
I use this functionality often with 27” monitor. The edge snap zone which makes 50% screen width windows which are often too large or too small and thirds are often more reasonable.
- Clone this repo somewhere.
- Modify and add additional keybindings to the script file:contents/code/main.js. For testing different inputs, copy the function into
plasma-interactiveconsole --kwin
. - Run
kpackagetool5 --type=KWin/Script -i .
inside the directory to install the script. (It should be possible to install this script from the KWin Scripts in system settings, but I have never got this to work.) You may need to restart KWin for this to take effect.
- Using this with no windows in focus or with an empty desktop can sometimes resize the kde desktop background
- Focus doesn’t follow the mouse correctly after snapping a window, this can be annoying when there are mutliple windows to arrange