gala icon indicating copy to clipboard operation
gala copied to clipboard

Basic keyboard quarter tiling

Open peteruithoven opened this issue 7 years ago • 35 comments

Basic quarter tiling support. Ctrl + Super + 1: Tile top left Ctrl + Super + 2: Tile top right Ctrl + Super + 3: Tile bottom left Ctrl + Super + 4: Tile bottom right

Partially Implements: #105 (only the keyboard support).

To my surprise, contrary to when using wmctrl, there was no issue with different shadows margins.

It doesn't transition (yet).

peteruithoven avatar Nov 10 '18 01:11 peteruithoven

I think we'd want these to be bound to arrow keys by default if possible, so:

Ctrl+Super+Up+Left, Ctrl+Super+Up+Right, etc.

cassidyjames avatar Nov 10 '18 19:11 cassidyjames

Good point. I'm having a bit of an issue with the keybindings though. With the keybindings:

<Super><Ctrl><Up>Left
<Super><Ctrl><Up>Right
<Super><Ctrl><Bottom>Left
<Super><Ctrl><Bottom>Right

only the bottom left + right work. It also blocks regular left and right tile.

With the keybindings:

<Super><Ctrl><Left>Up
<Super><Ctrl><Right>Up
<Super><Ctrl><Left>Bottom
<Super><Ctrl><Right>Bottom
  • both Super+Ctrl+left and Super+Ctrl+left +Up and Super+Ctrl+left +Down triggers tiles top left.
  • both Super+Ctrl+right and Super+Ctrl+right +Up and Super+Ctrl+right +Down triggers tile right.

Anyway, quite a mess. I could use some tips on how to get this working.

peteruithoven avatar Nov 10 '18 20:11 peteruithoven

I’d prefer these but not sure it fixes your issue.

Move to the upper left — ⌃⌘← Move to the lower left — ⌃⇧⌘← Move to the upper right — ⌃⌘→ Move to the lower right — ⌃⇧⌘→

⌘ = super ⌃ = ctrl ? ⇧ = shift ?

Command-Control-Shift-

jchannon avatar Nov 10 '18 21:11 jchannon

@jchannon I might be confused by your usage of ⌃ (which means ctrl right?), but isn't ⌃⌘←( Ctrl+Super+) the same as the current tile left keyboard shortcut?

peteruithoven avatar Nov 11 '18 16:11 peteruithoven

Quite possibly, those are the shortcuts I use on OSX for quarter tiling :)

jchannon avatar Nov 11 '18 17:11 jchannon

This is awesome, but I worry that changing the key combinations to use two cursor keys at the same time would be problematic given that using one of those keys is already ingrained and as @peteruithoven has found requires some special handling of the keybindings.

I would propose something a little more visual and hopefully simpler to implement.

Ctrl+Super+u: Top Left Ctrl+Super+i: Top Right Ctrl+Super+j: Bottom Left Ctrl+Super+k: Bottom Right

This could later be suplemented with 3rd tiling...

Ctrl+Super+d: Left 3rd Ctrl+Super+f: Middle 3rd Ctrl+Super+g: Right 3rd

Ctrl+Super+e: Left 2 3rds Ctrl+Super+t: Right 3rds

I might be influenced by muscle memory, but I do honestly think it's less problematic.

magnet for macos keybindings

ianmjones avatar Nov 12 '18 10:11 ianmjones

One issue with using letters is that it's logical orientation breaks down on non Querty keyboards. I couldn't find statistics on keyboard layout popularity.

peteruithoven avatar Nov 12 '18 16:11 peteruithoven

Hmm, yeah, that did occur to me.

I wonder if there is some sort of hardware code mapping that could be used more reliably than letters for saving to settings?

ianmjones avatar Nov 12 '18 20:11 ianmjones

Any update to this, most distros have quarter tiling so it would be good to get it into elementary

jchannon avatar Jan 30 '19 10:01 jchannon

Would be a terrific addition!

thomasfaller avatar Feb 10 '19 13:02 thomasfaller

I hope this get added soon, its really useful productivity wise!

Julioevm avatar Feb 22 '19 11:02 Julioevm

@donadigo nop it definitely wasn't. I just rarely use maximized / fullscreen windows. I added those allow resize / move checks because that seemed safe. But I changed it, it now also works for maximized and fullscreen windows.

peteruithoven avatar Jul 03 '19 00:07 peteruithoven

I want to get feedback from @elementary/ux about the shortcuts before we merge

cassidyjames avatar Jul 03 '19 20:07 cassidyjames

Is it possible to tell if a window is already half tiled? If so, maybe have it so you half tile first, then do up or down to go into quarter tiling?

btkostner avatar Jul 03 '19 20:07 btkostner

@btkostner yes I can tell if it's tiled. What would that sequence of actions accomplish?

peteruithoven avatar Jul 03 '19 21:07 peteruithoven

@peteruithoven So super+ctrl+left would left half tile it, then super+ctrl+top would quarter tile it to the upper left. Just a thought :thinking:

btkostner avatar Jul 03 '19 21:07 btkostner

@btkostner Ah! Interesting idea! I've implemented the idea. Please let me know what you think.

peteruithoven avatar Jul 03 '19 23:07 peteruithoven

So you’d have to do two sets of shortcuts to get it to tile to top left for example? Seems unproductive

On Thu, 4 Jul 2019 at 00:17, Peter Uithoven [email protected] wrote:

@btkostner https://github.com/btkostner Ah! Interesting idea! I've implemented the idea. Please let me know what you think.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/elementary/gala/pull/408?email_source=notifications&email_token=AAAZVJW2KLGBOJSV7ZV6IMTP5UXPJA5CNFSM4GC67FSKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZF5BKI#issuecomment-508285097, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAZVJXVUGAX4X2TKHI2L5DP5UXPJANCNFSM4GC67FSA .

jchannon avatar Jul 04 '19 05:07 jchannon

@jchannon The way I've seen it implemented is where you could (but don't have to) let go of left or right. But this way, you get instant feedback.

btkostner avatar Jul 05 '19 18:07 btkostner

@peteruithoven Just tried it and it feels pretty cool :confetti_ball:. Two things might need to be changed, but I think @cassidyjames might have some insight to this. First being up + left should be the same thing as left + up if possible (not sure the technical constraints)... Second, I found myself wanting to move the whole window when it was already tiled. For instance, if I had a window in the upper left part of the screen and I did right, it would then be tiled in the upper right of the screen. This might be my tiling window manager brain, but might be something to try out...

btkostner avatar Jul 05 '19 19:07 btkostner

First being up + left should be the same thing as left + up if possible (not sure the technical constraints)...

I think I've explained the technical limitation earlier. Properly implementing that keyboard shortcut simply is not supported. With the left/light > top/down I can use the tiling position as a workaround.

I thought I could maybe also register to Super+Ctrl+left/right and maybe do some kind of timeout where if Super+Ctrl+up/down and Super+Ctrl+left/right are pressed within a certain time I could trigger a quarter tile, but listening for left/right breaks the existing tile to side behaivior. I assume only one listener is allowed.

peteruithoven avatar Jul 06 '19 12:07 peteruithoven

Second, I found myself wanting to move the whole window when it was already tiled. For instance, if I had a window in the upper left part of the screen and I did right, it would then be tiled in the upper right of the screen. This might be my tiling window manager brain, but might be something to try out...

Let's first get quarter tiling to work...

peteruithoven avatar Jul 06 '19 12:07 peteruithoven

So a little summarizing update, beside tiling using Super+Ctrl+1/2/3/4 I've implemented @btkostner's suggestion. You can now quarter tile using a two step process:

  1. Tile window to left or right using Super+Ctrl+Left/Right
  2. Quarter tile window to top or bottom of that side using Super+Ctrl+Up/Down

Tiling to top or bottom half is also supported:

  1. Maximize window using Super+Up
  2. Tile to top or bottom half using: Super+Ctrl+Up/Down

And thanks @jlnr for the code review.

peteruithoven avatar Jul 10 '19 16:07 peteruithoven

Can't wait to try the updated branch 💪

Another thought: Does a majority of people use keyboards with numpads? (Definitely not me, I'm a complete TKL fanatic 😬) Would 1, 3, 6, 9 be more intuitive shortcuts for corner tiling in that case? You could also use 4 and 6 for half-screen tiling, etc...

jlnr avatar Jul 10 '19 16:07 jlnr

@jlnr @cassidyjames That's a pretty cool idea. I would wonder how many people use a 10 key with elementary. I personally do, and this solution sounds like the best for me, but I'm not sure that would work for everyone...

btkostner avatar Jul 10 '19 16:07 btkostner

I've personally never had those, on any of the laptops I've owned. But sounds like someone could just remap the Super+Ctrl+1/2/3/4 and Super+Ctrl+Left shortcuts? You might miss something for the 2 and 8 though, something to directly tile something to the top or bottom half of the screen.

It's a pity it's not possible to bind multiple keyboard shortcuts to the same action, as far as I know.

peteruithoven avatar Jul 10 '19 18:07 peteruithoven

I hope this makes it. I'm actually using a UHD 3440x1440 and three panels side by side would be awesome too. But yes, hope all the work on this ticket makes it

renevall avatar Aug 21 '19 21:08 renevall

@btkostner About the numpad idea: Turns out Ubuntu MATE 19.10 just changed it's tiling shortcuts away from a numpad-based system (see "New Key-bindings"). I don't know what data they've based it on, but it seems numpads are not an overwhelming majority then.

jlnr avatar Oct 02 '19 21:10 jlnr

How is this still not merged 😄 Looking at the issue list there is 10 issues about tiling. Do elementary not think tiling is important?

jchannon avatar Nov 27 '19 10:11 jchannon

Because it's important to get it right - that's why there are several issues and even alternative PRs (#595). The underlying APIs are also a bit limited (keyboard shortcuts, mutter tiling). The best way to accelerate this is to provide a PR that has absolutely no glitches 😜

jlnr avatar Nov 28 '19 07:11 jlnr