From 5ef20a4e329fa3ac814d26ffa8a5314ee418a930 Mon Sep 17 00:00:00 2001 From: Luca Moschella Date: Mon, 26 Nov 2018 22:13:18 +0100 Subject: [PATCH] Implement conflict-free movement in 2x2 grid --- README.md | 27 +++++++++++++---------- contents/code/main.js | 40 +++++++++++++++++++++++++++++++++- movewindowtocenter.kwinscript | Bin 8414 -> 8564 bytes 3 files changed, 55 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 426e755..b014c78 100644 --- a/README.md +++ b/README.md @@ -29,21 +29,26 @@ My suggestion is to use the following configuration: | Meta + Numpad5 | Ultrawide: Move Window to center-height (3x2) | | Meta + Numpad6 | Ultrawide: Move Window to right-height (3x2) | -| Shortcuts | Commands in 2x2 grid | -| ----------------------------------------------------- | ------------------------------------ | -| Meta + Alt + Numpad7 | Move Window to Up Left | -| Meta + Alt + Numpad8 | Move Window Up | -| Meta + Alt + Numpad9 | Move Window to Up Right | -| Meta + Alt + Numpad1 | Move Window to Down Left | -| Meta + Alt + Numpad2 | Move Window to Down | -| Meta + Alt + Numpad3 | Move Window to Down Right | -| Meta + Alt + Numpad4 | Move Window to Left | -| Meta + Alt + Numpad6 | Move Window to Right | +| Shortcuts | Commands in 2x2 grid | +| ----------------------------------------------------- | -------------------------------------------------------------- | +| Meta + Alt + Numpad7 | UltrawideWindows: Move Window to up-left (2x2) | +| Meta + Alt + Numpad8 | UltrawideWindows: Move Window to up-width (2x2) | +| Meta + Alt + Numpad9 | UltrawideWindows: Move Window to up-right (2x2) | +| Meta + Alt + Numpad1 | UltrawideWindows: Move Window to down-left (2x2) | +| Meta + Alt + Numpad2 | UltrawideWindows: Move Window to down-width (2x2) | +| Meta + Alt + Numpad3 | UltrawideWindows: Move Window to down-right (2x2) | +| Meta + Alt + Numpad4 | UltrawideWindows: Move Window to left-height (2x2) | +| Meta + Alt + Numpad6 | UltrawideWindows: Move Window to right-height (2x2) | | Shortcuts | General commands | | ----------------------------------------------------- | -------------------------- | | Meta + Numpad0 | Maximize window | -| Meta + Alt + Numpad5 | Maximize window | +| Meta + Alt + Numpad0 | Maximize window | + +##### Notes +* Using only `Ultrawide` shortcuts, even for 2x2 movements, avoids conflicts. They are caused by the standard behaviour of going to the previous position if the window is already in the correct position. I found that the only default one useful is the `maximize windows`, that even if it may work unexpectedly, is convenient to use. If the unexpected bothers you, there is a `Ultrawide` implementation, that doesn't have the _go to the previous position_ feature. +* The animations are lost. +* The default shortcuts works only if the combinations contains even the ald modifier, probably a KWin problem. # Update ```bash diff --git a/contents/code/main.js b/contents/code/main.js index b776f2e..20c4875 100644 --- a/contents/code/main.js +++ b/contents/code/main.js @@ -25,7 +25,7 @@ function move(workspace, numberXslots, numberYslots, x, y) { } } - +// GRID 3x2 registerShortcut("MoveWindowToUpLeft3x2", "UltrawideWindows: Move Window to up-left (3x2)", "Meta+Num+7", function () { move(workspace, 3, 2, 0, 0) }); @@ -61,3 +61,41 @@ registerShortcut("MoveWindowToCenterHeight3x2", "UltrawideWindows: Move Window t registerShortcut("MoveWindowToRightHeight3x2", "UltrawideWindows: Move Window to right-height (3x2)", "Meta+Num+6", function () { move(workspace, 3, 1, 2, 0) }); + +// GRID 2x2 +registerShortcut("MoveWindowToUpLeft2x2", "UltrawideWindows: Move Window to up-left (2x2)", "Meta+alt+Num+7", function () { + move(workspace, 2, 2, 0, 0) +}); + +registerShortcut("MoveWindowToUpCenter2x2", "UltrawideWindows: Move Window to up-width (2x2)", "Meta+alt+Num+8", function () { + move(workspace, 1, 2, 0, 0) +}); + +registerShortcut("MoveWindowToUpRight2x2", "UltrawideWindows: Move Window to up-right (2x2)", "Meta+alt+Num+9", function () { + move(workspace, 2, 2, 1, 0) +}); + +registerShortcut("MoveWindowToDownLeft2x2", "UltrawideWindows: Move Window to down-left (2x2)", "Meta+alt+Num+1", function () { + move(workspace, 2, 2, 0, 1) +}); + +registerShortcut("MoveWindowToDownCenter2x2", "UltrawideWindows: Move Window to down-width (2x2)", "Meta+alt+Num+2", function () { + move(workspace, 1, 2, 0, 1) +}); + +registerShortcut("MoveWindowToDownRight2x2", "UltrawideWindows: Move Window to down-right (2x2)", "Meta+alt+Num+3", function () { + move(workspace, 2, 2, 1, 1) +}); + +registerShortcut("MoveWindowToLeftHeight2x2", "UltrawideWindows: Move Window to left-height (2x2)", "Meta+alt+Num+4", function () { + move(workspace, 2, 1, 0, 0) +}); + +registerShortcut("MoveWindowToRightHeight2x2", "UltrawideWindows: Move Window to right-height (2x2)", "Meta+alt+Num+6", function () { + move(workspace, 2, 1, 1, 0) +}); + +// General +registerShortcut("MoveWindowToCenterHeight2x2", "UltrawideWindows: Maximize Window", "Meta+alt+Num+5", function () { + move(workspace, 1, 1, 0, 0) +}); diff --git a/movewindowtocenter.kwinscript b/movewindowtocenter.kwinscript index 1883b78207176f73d9bd3ee0cd6d6d7deda20f80..9df2412d446ab73ec434e314b81adc36b5e7ccf3 100644 GIT binary patch delta 830 zcmV-E1Ht^>LG(h9m46|ydQE4!gb%9%007Aj000#L8~|f)ZggdCbaO9bZ)9aJZDDC{ zE^2dCR0#kB4qyCR97OzEb$AN^0R-p+000E&0{{S}mtAk0FcgOG`4vaKA`MN7v(Hq! zm|AI@woFsEYOShV(9{WNd_=|xWL5tAY-|V+*nBz^skME4&VSSM;@6F}+{6nWBr&Wg z|CXeI{N2tH_A6a`3+lik3~0<9h&Ry#Ww&XV@U$G==~3>$ZU9dfh-d3Dh`jtgqaM72 zD$z*gk<<3)pFupDd3g{8zp0!ls|+rx6j|`deUU(?8maNPfpLiTX|VEnEnH8G8=!~y zm}a-N=p2T+;D0IPji|d?)J{a{yr-~JVT|$(i{V}-bczj*%H-(KxwW^fs>e~XrS;}w znyOmV=&2{NZs}#Qpm>5M*eY-&Yk3bLEpy1nV@xFYU!^aqe6?PR)c5Cer&^MaZlGLp zTT7XqC#`v3&rjxuD*6vv(Ildr?L@>=V^2OUAexDGQ-38#v#OM43R$aWq0|)oYId)R z@1=O-F?_iGbOn=~Sd6ZMlvDQIPZ(cpxP3AcT^6t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