acristoffers / kwin-rectangle Goto Github PK
View Code? Open in Web Editor NEWShortcuts to move windows around.
License: GNU General Public License v3.0
Shortcuts to move windows around.
License: GNU General Public License v3.0
When a window has been centered with meta + strg + numpad 5
(even when moved afterwards via mouse drag) and then should be moved again with meta + strg + numpad 1
..4
, 6
..9
, it maximizes instead of moving.
A window that has been maximized via Rectangle does not show the maximize button in the title bar as 'maximized'. An otherwise maximized window that has been de-maximized via Rectangle does not show the maximize button in the title bar as 'not maximized'.
A ninth (other than center ninth) that has been centered is a few pixels lower than an original center ninth. (Paddings are set to 0, if that is relevant).
Trying to center a (non-center) window on the right (secondary) screen moves it to left (primary) screen, and off-center there.
On a full keyboard, can the numeric keypad, navigation keys, and cursor control keys be fully used, possibly with multiple (non-modifier) keys pressed together?
That would mean making all these keys reactive (currently, at least the number pad 5 is finicky [on a Microsoft Natural 4000]).
And to have more than one key pressed would allow for very flexible layouts. Let me explain with an example, where key position matches screen position of window. We could send a window to any of the 1/6 screens with meta +
| ins | home | pgup |
|---------------------|
| del | end | pgdn |
and have an easy mnemonic to boot.
Combining two keys would give us 2/6 screens. Example window positions for meta +
| ins + home | pgup |
|--------------| + |
| del + end | pgdn |
A fully working number pad would allow to set windows (using different combinations of modifiers) to
With more than one number pressed, any adjacent ninths that form a rectangle could combine into a position/size of their own.
Finally, with again a different modifier combination, the number pad could be set to stepwise moves in 8 directions (1 thru 9, except 5).
As a nice side effect, the above together would free the arrow keys to be used for something else, e.g., shifting virtual desktops, volume control, ...
One can dream, can't one?
Currently, a window that has been resized/repositioned with kwin-rectangle and is then manually moved will snap back to the size it had before the kwin-rectangle action.
Some users (#4, #5) prefer it that way. For me, after working a while with such a window (with the previous snapping action already dropped out of mind), it is a minor but annoying cognitive jerk if something I drag does not keep the pre-dragging size. Then I have to grab it again (or apply a shortcut) to resize it again, which somewhat lessens the 'flow'.
Is it possible to make the re-snap behaviour an option in settings? A checkbox [ ] Return to previous size when moving window manually after it has been set by kwi-rectangle
or so?
Pretty much what it says in the title. The MacOS Rectangle resets the window to its previous size when you move it out of the position that Rectangle snapped it to. Having this functionality in this script would be amazing!!
Thanks for your hard work!
The system settings for Kwin don't allow sorting by shortcuts (let alone by modifiers or by non-modifiers only), only by names of actions.
With so many options now, it's a long list, and alphabetic sort is not the best here. I'd like therefore to suggest a naming scheme that introduces more levels of categorizing, and uses numbering to sort by effect or keyboard key). Having the long list in logical instead of alphabetical order makes a lower cognitive load.
Maximize: # here, alphabet sorting works well and its only a few entries anyway
Almost
Full
Only [up, down, to left, to right]) # this is not implemented
Minimize
Move: # name by numpad key position to avoid alphabet sorting and have left–middle–right order
1. Bottom left
2. Bottom
3. Bottom right
4. ...
9. Top right
Size & Position: # number by screen division; could include Maxi/Mini as "1a. Maximize", "1b. Minimize"
2. Halves:
Left
Right
...
3a. Thirds:
3b. Two-Thirds:
...
9. Ninths
I understand if that is too much hassle for the not so frequent activity of setting settings. In that case, some renames would sort entries together and make them easier to find: "Center:" as "Move: Center:" would sort it with other moves, similarly "Almost Maximized" as "Maximized: Almost", and "Centered Quarter" as "Quarter: Centered".
Thank you for making this awesome kwin script of rectangle-style window management! This is exactly what I need for my ultrawide monitor. I was wondering if you would be interested in making another thirds addition. Right now, you can do left, center, and right thirds. Would it be possible to add thirds but with half the vertical space? That way someone could do something like 2 rows by 3 columns
A window that has been resized/positioned with Kwin Rectangle does not always appear in the task manager of the pane of the screen that window is on.
Example observed on a two-screen setup (setting in image below):
Window is resized/moved into right half of the left screen (primary); it is represented in the task bar of the left screen (here cut off for image size reduction).
Same window resized/moved into right third of the left screen; it is represented in the task bar of the *right" screen.
Screen setup:
Edit:
The system is:
Operating System: openSUSE Tumbleweed 20240407
KDE Plasma Version: 6.0.3
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.3
Kernel Version: 6.8.4-rc1-1-default (64-bit)
Graphics Platform: X11
Hi again, I can see code for a configurable padding amount but I don't see anywhere in the System Settings to adjust these values.
I'm on Neon (Plasma 5.27) - I wonder if something has changed to stop the Config dialog becoming available?
Thanks for your help on my previous issue BTW.
So, in a VM with x11 it works.
This script seems perfect for my needs since I can position windows to places together with sexy gapps.
My real machine run Wayland and has 3 monitors and the most left is a vertical one.
When I use any of the shortcuts, the window is moved to the correct starting pixel (for example, on my vertical monitor, going to the top-left or maximizing to the top part of the screen) places it at the correct x,y but it doesn't resize the window.
What can I do to provide you with useful info?
Problem: I use two screens, and KDE-rectangle. If I have a window on Screen 0, and use Meta-Shift-Right to move the Window to Next Screen
(this successfully moves the window to Screen 1), followed by eg Meta-Ctrl-Right to use Rectangle Halves: Right
, the window will
Expected behaviour: Rectangle Halves: Right
should leave the window on Screen 1, and fill the right half of the screen.
Discussion: This might be a bug in the other kwin scripts, possibly Window to Next Screen
hasn't updated something, leaving the window believing it is still on Screen 0 even though I can see it on Screen 1.
If I move the window from screen 0 to screen 1 using the mouse, and then use Rectangle Halves: Right
, then I don't see this behaviour.
kFind does not react to kwin-rectangle, but it does to the usual shortcuts meta + left
, meta + right
, etc.
This is a set of keys to fully use a standard 104-key keyboard, but leaving the arrow keys alone.
Not meant to only add where the KWin settings don't have an option. It's a lower cognitive load to have a consistent scheme, and it is easier to set up if all is in one place.
Feel free to use in any way you see useful.
The modifiers follow some basic rules: Meta
to position and resize, meta + ctrl
to move, both + alt
for additional options. Shift
to add the rarely used options.
meta
— position and resize to halves, quarters, sixths, and to maxi-/minimize
meta + alt
— position and resize to thirds, two-thirds, and ninths
meta + ctrl
— move, keeping width and height
meta + ctrl + alt
— maximize in one dimension (ctrl for move because "move center of window")
meta + ctrl + shift
— maximize in one dimension, exotic options
The key clusters were chosen because their outline serves as mnemonic for the screen divisions, and because the hand can target them without the need to look closely. Arrow keys are not used.
prtscrn
scrllk
break
would be nice for thirds, and numpad's =
(
)
backsp
for fourths, but unfortunately prtscrn
interferes with the established Capture Screen of Spectacle, and numpad's =
(
)
do not work with meta (at least on a Microsoft Natuarl 4000) (is this fixable?). Therefore we'll resort to meta + alt
and use the keys below.
Notation below is like this:
action or position
modifier key(s)
+ non-modifier key (list of options)
POSITION AND SIZE
halves, at screen border
`meta`
+ numpad numbers `8`, `6`, `2`, `4`
halves, centered # not set, can be done in two steps (see below, CENTER)
~, all directions (corner quarter => center)
~, horizontal (top or bottom half => center)
~, vertical (left or right half => center)
fourths, left to right (portrait orientation)
`meta`
+ `numlock` `/` `x` `-` # !!! `meta + numlock` toggles number lock. Can this be blocked?
quarters in screen corners
`meta`
+ numpad number `7`, `9`, `3`, `1`
quarter centered # not set, can be done in two steps (below)
(any corner quarter => center)
ninths
`meta + alt`
+ numpad `1` thru `9`
sixths, upper row
`meta`
+ `ins`, `home`, `pgup`
sixths, lower row
`meta`
+ `del`, `end`, ` pgdwn`
thirds, left to right (portrait orientation)
`meta + alt`
+ `ins`, `home`, `pgup`
two-thirds, left to right (portrait orientation)
`meta + alt`
+ `del`, `end`, `pgdwn`
-----------
MAXIMIZE/MINIMIZE
maximize
`meta`
+ numpad `enter`
almost maximize
`meta`
+ numpad `period` or `comma`
maximize height
`meta + ctrl + alt`
+ numpad `4` # a bit arbitrary...
maximize width
`meta + ctrl + alt`
+ numpad `8` # a bit arbitrary...
minimize
`meta`
+ numpad `0`
-----
NEW IDEAS
maximize upward only
`meta + ctrl + shift`
+ numpad `8`
maximize downward only
`meta + ctrl + shift`
+ numpad `2`
maximize to left only
`meta + ctrl + shift`
+ numpad `4`
maximize to right only
`meta + ctrl + shift`
+ numpad `6`
---------
CENTERING
Getting centered halves, thirds, two-thirds, quarters, sixths can be a two step procedure
1. set to desired size, anywhere on screen (this includes arbitrary mouse drag sizes)
2. center with `meta + ctrl + numpad 5` (keeping size)
This is the best option, imo. Centering is not a very frequent activity. It mostly happens for new windows, where it can be done with a window rule. And it trumps fiddling with hard to remember modifier combinations with numpad `5`, or, worse, different non-modifiers.
-------
MOVE
move
`meta + ctrl`
+ numpad `1` .. `4`, `6` .. `9` in the according direction
+ numpad `5` to center (as above)
Hi, I really like this script but I discovered a problem. In my KDE customization I've put the panel at the top of the screen but when I position a program using a shortcut of the script, the title bar of the program goes under the panel and at the bottom there is a unused space. Here's a demonstration:
Thank you very much!
:
Hello,
Currently, the script calculates window positions based on the entire screen area, which sometimes results in unintended docking of floating panels when windows are positioned near the bottom of the screen.
I would like to request a feature that takes into account the presence of floating panels when positioning windows.
I like the new floating panel option of Plasma 6, but since your script doesn't take that into account, my panel remains docked.
Thanks for reading.
Hello,
As you maybe have noticed, Plasma 6 has been released today and your script needs to be updated for it to work for Plasma 6 it seems.
After upgrading, your script was gone (probably automatically done by KDE to be on the safe side after a big upgrade). I cant find it when looking for scripts from within KDE and installing the latest master from here gives this error:
false ./install.sh: line 5: plasmapkg2: command not found ./install.sh: line 6: plasmapkg2: command not found 1
I hope you can update the script. Been using it everyday since you have released it. Such a handy script that improves my productivity.
Can we have three-fourth sized portrait mode windows? Very useful to have a folder tree or file list in one fourth and an application in the remaining space. Similar to the folder trees integrated in some applications.
The numlock
key (on number pad) toggles the number lock also when used with modifiers. It would be nice to use it, though, for quarters and fourths (number pad numlock
/
*
-
).
Is it possible to not pass on numlock
in kwin-rectangle? Alternatively, is it possible to send a second numlock
stroke to toggle back to the previous state?
Here is a demo, showing I can resize normally without issue, I can use rectangle without issue, but then I try to resize and get the flickering:
kwin rectangle 1.2.8, plasma 5.27.8
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.