Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic keyboard quarter tiling #408

Draft
wants to merge 22 commits into
base: main
Choose a base branch
from
Draft

Basic keyboard quarter tiling #408

wants to merge 22 commits into from

Conversation

peteruithoven
Copy link
Collaborator

@peteruithoven peteruithoven commented Nov 10, 2018

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).

@cassidyjames
Copy link
Contributor

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.

@peteruithoven
Copy link
Collaborator Author

peteruithoven commented Nov 10, 2018

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.

@jchannon
Copy link

jchannon commented Nov 10, 2018

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-

@peteruithoven
Copy link
Collaborator Author

@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?

@jchannon
Copy link

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

@ianmjones
Copy link

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

@peteruithoven
Copy link
Collaborator Author

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.

@ianmjones
Copy link

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?

@jchannon
Copy link

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

if (!("tile-topleft" in settings.list_keys ())) {
warning ("Quarter tiling key bindings not found");
return;
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ricotz Thanks for the cleanup! But why remove this check? Without this, if a user where to try gala with this version and then downgrade he wouldn't be able to login anymore.
See: https://elementaryos.stackexchange.com/a/17582/3892

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gsettings schemas and keys are part of the API. We can't deal with not properly installed systems of all kinds.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After I've experiencing suddenly not being able to login that seems scary / fragile, but yeah it probably doesn't make sense to make an exception for this property.

@thomasfaller
Copy link

Would be a terrific addition!

@peteruithoven peteruithoven changed the title Basic quarter tiling Basic keyboard quarter tiling Feb 11, 2019
@Julioevm
Copy link

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

Copy link
Contributor

@donadigo donadigo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it intentional that you cannot tile a window that's already fully maximized? I would expect that to work.

@peteruithoven
Copy link
Collaborator Author

@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.

donadigo
donadigo previously approved these changes Jul 3, 2019
Copy link
Contributor

@donadigo donadigo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@cassidyjames cassidyjames added the Needs Design Waiting for input from the UX team label Jul 3, 2019
@peteruithoven
Copy link
Collaborator Author

peteruithoven commented Jul 10, 2019

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.

@jlnr
Copy link
Member

jlnr commented Jul 10, 2019

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...

@btkostner
Copy link
Contributor

@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...

@peteruithoven
Copy link
Collaborator Author

peteruithoven commented Jul 10, 2019

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.

jlnr
jlnr previously requested changes Jul 14, 2019
plugins/quartertiler/Main.vala Outdated Show resolved Hide resolved
@renevall
Copy link

renevall commented Aug 21, 2019

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

@kgrubb kgrubb requested a review from jlnr September 18, 2019 18:12
@jlnr jlnr dismissed their stale review October 2, 2019 21:44

Thanks for resolving this.

@jlnr
Copy link
Member

jlnr commented Oct 2, 2019

@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.

Copy link
Member

@jlnr jlnr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code is fine and does the job, but due to the technical limitations mentioned above, using the arrow keys feels a bit like a hack: cmd+ctrl+left+up only works if you press "left" before "up", etc.

Also, if you press cmd+ctrl+left, cmd+ctrl+down, cmd+ctrl+right, cmd+ctrl+down, you can see a ghost window floating in the wrong direction. I am not sure if this can be fixed easily.

I think it's up to @elementary/ux to decide whether this is polished enough. In any case, the number-based shortcuts feel solid.

@jchannon
Copy link

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

@jlnr
Copy link
Member

jlnr commented Nov 28, 2019

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 😜

@gazsp
Copy link

gazsp commented Dec 13, 2019

Please get this added!

It's one of the main things I miss from macOS / SizeUp - not being able to fling windows around with super + numpad (quartered / halved / centred)

Just make the keys re-definable in Keyboard Settings to keep everyone happy.

@jchannon
Copy link

jchannon commented Feb 7, 2020

@jeremypw jeremypw marked this pull request as draft April 29, 2021 11:36
@jeremypw
Copy link

@peteruithoven Converting to draft as there are conflicts and unresolved design issues, however there seems to be a lot of interest in it.
@danrabbit Is it just choice of shortcuts blocking this? Can the design issues be resolved or is there a fundamental conflict?

@peteruithoven
Copy link
Collaborator Author

Makes sense. I'd be down to update if there is at least a decent change this will be merged.

@spotlesscoder
Copy link
Contributor

For me, the initially proposed key combinations would make the most sense:

Ctrl + Super + 1: Tile top left
Ctrl + Super + 2: Tile top right
Ctrl + Super + 3: Tile bottom left
Ctrl + Super + 4: Tile bottom right

Are there any plans to implement such a feature?
I've seen multiple PRs in this repo which also provide very cool methods for organizing windows withing a single display.

Would be nice of one of these would be discussed with the design team and eventually make it into a future release of gala.

So far, these approaches seem the most promising:

#595
#890

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Conflicts Needs Design Waiting for input from the UX team
Projects
None yet
Development

Successfully merging this pull request may close these issues.