GNOME Bugzilla – Bug 648700
Key binding for half-screen tiling and restoring windows
Last modified: 2012-01-07 18:00:24 UTC
There should be a way to create a binding for tiling the window to either side of the screen and a binding to restore window to previous state.
*** Bug 644995 has been marked as a duplicate of this bug. ***
*** Bug 650064 has been marked as a duplicate of this bug. ***
*** Bug 655031 has been marked as a duplicate of this bug. ***
I've filed a bug that has turned out to be a duplicate of this one. So I'm adding here some (I believe relevant) information I wrote in that other bug, so it doesn't get lost. If this gets implemented, I think we should use the same keyboard shortcuts Windows 7 uses for this (not just because they're used in Windows, but because I think they make sense). These shortcuts are the following: Windows key + Up = Maximize window Windows key + Down = Minimize window (maybe this one wouldn't make much sense in GNOME 3, since minimize buttons are gone) Windows key + Left = Move window to the left and resize it so it fits half the screen Windows key + Right = Move window to the right and resize it so it fits half the screen
Hello, I'm new to Gnome development and would really like to see this get implemented. Perhaps I can dive into this as I REALLY want this feature :D. I need only be pointed in the right direction.
stefano posted a patch on IRC, but it was shot down because of the keybinding work going on: #gnome-shell, July 22nd, 2011: [16:26:52] <stefano> hi.. I have a patch for bug #648700 at http://pastebin.com/KxHCcPzg [16:26:54] <bebot> Bug http://bugzilla.gnome.org/show_bug.cgi?id=648700 normal, Normal, ---, mutter-maint, UNCONFIRMED, Key binding for half-screen tiling and restoring windows [16:27:48] <owen> stefano: I don't want to do any keybinding stuff until we get stuff over to gsettings (fmuellner was working on that some) [16:29:10] <stefano> ah ok.. that's why the bug remained open [16:31:19] <mclasen> could use fancy bugzilla features and make the one bug block the other...
Any idea when that gsettings stuff is going to land?
The "restoring windows" part is just as important as the actual tiling, IMHO. I guess the tiling part is quickly taken care of by binding keyboard shortcuts to the already existing methods in mutter for that, but a method to restore the window to it's *exact* and former position doesn't exist yet AFAIK... Preferably, you re-use the Meta+L/R for restoring the former window position, like in Windows 7 or KDE 4. If you don't know what i'm talking about, then it works like this; you press Meta+R to tile a window to the right, and while it's in the tiled position, you press Meta+L to restore it. If you continue pressing Meta+L you're gonna tile it to the left, and to restore that window, you then press Meta+R. It's very natural once you try it out. BTW, maybe i'm just not used to bugzilla (or the gnome way of doing things), but shouldn't this bug be flagged as NEW or ASSIGNED by now?
*** Bug 660929 has been marked as a duplicate of this bug. ***
Hi, I was wondering if there's been any new development on this? It seems like issues with keybindings have been mostly worked out as the windows key can now be assigned to bindings. Hope this gets implemented soon.
(In reply to comment #10) > Hi, I was wondering if there's been any new development on this? It seems like > issues with keybindings have been mostly worked out as the windows key can now > be assigned to bindings. That is unrelated. We are waiting on Florian to finish his metacity gsettings changes. Speaking of that, Florian, can you at least publish/land your changes as is, without a rework of the keybinding stuff?
*** Bug 663897 has been marked as a duplicate of this bug. ***
Created attachment 202870 [details] [review] window: Queue a frame redraw after tiling Usually tiling involves a size change and the frame is redrawn automatically, however this is not the case when switching directly between left- and right-tiled. Ensure that a redraw happens in that case as well.
Created attachment 202871 [details] [review] window: Keep track of the last full-maximization state In order to be able to toggle between tiled and normal/maximized states, we need to keep track of the last full maximization state.
Created attachment 202872 [details] [review] window: Make meta_window_can_tile_side_by_side() public In order to support keybindings for window tiling, we need to determine whether a window is tilable or not, so make this public.
Created attachment 202873 [details] [review] keybindings: Add toggle-tile-left/right bindings Having keybindings for side-by-side tiling has been requested for a long time, so add this support now.
Review of attachment 202870 [details] [review]: Yep.
Review of attachment 202873 [details] [review]: ::: src/core/keybindings.c @@ +3264,3 @@ + /* Cheat meta_window_can_tile_side_by_side() */ + window->maximized_horizontally = 0; + window->tile_mode = META_TILE_NONE; I don't understand this. How are you cheating meta_window_can_tile_side_by_side()?
Review of attachment 202872 [details] [review]: Sure.
Review of attachment 202871 [details] [review]: Yep.
(In reply to comment #18) > I don't understand this. How are you cheating > meta_window_can_tile_side_by_side()? The current tiling code requires that a window is "dragged free" first before tiling it in a different position. While this behavior makes sense for the dragging functionality, it feels overly restrictive for the keybindings, e.g. I think we want to allow to change from left-tiled to right-tiled (or maximized) without untiling first. (An alternative approach to the "cheating" would be to implement the restrictions in move_resize_internal instead of can_tile_side_by_side())
(In reply to comment #21) > (In reply to comment #18) > > I don't understand this. How are you cheating > > meta_window_can_tile_side_by_side()? > > The current tiling code requires that a window is "dragged free" first before > tiling it in a different position. While this behavior makes sense for the > dragging functionality, it feels overly restrictive for the keybindings, e.g. I > think we want to allow to change from left-tiled to right-tiled (or maximized) > without untiling first. I completely agree. Can we relax these restrictions instead of cheating the system? > (An alternative approach to the "cheating" would be to implement the > restrictions in move_resize_internal instead of can_tile_side_by_side())
Created attachment 202886 [details] [review] window: Relax restrictions for can_tile_maximized () The current code requires windows to be resizable to be considered for tiling, which excludes all maximized/tiled windows. While this restriction concurs with the desired behavior for edge-tiling, it feels overly restrictive for keybindings. As the edge-tiling code in update_move() already ensures the above restriction, it seems save to remove it from the can_tile_maximized() function, assuming that windows that are not meant to be tiled or maximized won't provide a maximize function. (In reply to comment #22) > Can we relax these restrictions instead of cheating the system? I think so. At least a quick test with different kind of windows did not turn up any behavior changes.
Created attachment 202887 [details] [review] keybindings: Add toggle-tile-left/right bindings Updated patch, now with 70% less cheating!
Review of attachment 202886 [details] [review]: This makes sense to me.
Review of attachment 202887 [details] [review]: ::: src/core/keybindings.c @@ +3262,3 @@ + window->tile_monitor_number = window->monitor->number; + window->tile_mode = mode; + window->maximized_horizontally = 0; Why this?
(In reply to comment #26) > + window->maximized_horizontally = 0; > > Why this? meta_window_tile () resizes the window to half the screen width and maximizes it vertically. However, if the window is currently fully maximized, the resize operation does not have any effect (as meta_window_maximize_internal does not unset directions not requested, and maximization flags beat normal size hints).
*** Bug 665725 has been marked as a duplicate of this bug. ***
Attachment 202870 [details] pushed as 4ca5527 - window: Queue a frame redraw after tiling Attachment 202871 [details] pushed as bed9cb1 - window: Keep track of the last full-maximization state Attachment 202872 [details] pushed as baeb9fb - window: Make meta_window_can_tile_side_by_side() public Attachment 202886 [details] pushed as c3d76ae - window: Relax restrictions for can_tile_maximized () Attachment 202887 [details] pushed as 34f6ffd - keybindings: Add toggle-tile-left/right bindings (with an additional comment as requested on IRC)
*** Bug 667443 has been marked as a duplicate of this bug. ***