mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 15:40:41 -05:00
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. https://bugzilla.gnome.org/show_bug.cgi?id=648700
This commit is contained in:
parent
baeb9fbc4b
commit
34f6ffd1ad
1
.gitignore
vendored
1
.gitignore
vendored
@ -19,6 +19,7 @@ libtool
|
||||
ltmain.sh
|
||||
missing
|
||||
.deps
|
||||
src/50-mutter-windows.xml
|
||||
src/mutter-wm.desktop
|
||||
src/mutter.desktop
|
||||
*.o
|
||||
|
@ -1,5 +1,6 @@
|
||||
# List of source files containing translatable strings.
|
||||
# Please keep this file sorted alphabetically.
|
||||
src/50-mutter-windows.xml.in
|
||||
src/compositor/compositor.c
|
||||
src/core/bell.c
|
||||
src/core/core.c
|
||||
|
15
src/50-mutter-windows.xml.in
Normal file
15
src/50-mutter-windows.xml.in
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<KeyListEntries schema="org.gnome.mutter.keybindings"
|
||||
group="system"
|
||||
_name="Windows"
|
||||
wm_name="Mutter"
|
||||
package="mutter">
|
||||
|
||||
<KeyListEntry name="toggle-tiled-left"
|
||||
_description="View split on left"/>
|
||||
|
||||
<KeyListEntry name="toggle-tiled-right"
|
||||
_description="View split on right"/>
|
||||
|
||||
</KeyListEntries>
|
||||
|
@ -261,6 +261,11 @@ wmproperties_in_files=mutter-wm.desktop.in
|
||||
wmproperties_files=$(wmproperties_in_files:.desktop.in=.desktop)
|
||||
wmproperties_DATA = $(wmproperties_files)
|
||||
|
||||
xmldir = @GNOME_KEYBINDINGS_KEYSDIR@
|
||||
xml_in_files = \
|
||||
50-mutter-windows.xml.in
|
||||
xml_DATA = $(xml_in_files:.xml.in=.xml)
|
||||
|
||||
gsettings_SCHEMAS = org.gnome.mutter.gschema.xml
|
||||
@INTLTOOL_XML_NOMERGE_RULE@
|
||||
@GSETTINGS_RULES@
|
||||
@ -279,6 +284,7 @@ CLEANFILES = \
|
||||
mutter.desktop \
|
||||
mutter-wm.desktop \
|
||||
org.gnome.mutter.gschema.xml \
|
||||
$(xml_DATA) \
|
||||
$(mutter_built_sources) \
|
||||
$(typelib_DATA) \
|
||||
$(gir_DATA)
|
||||
@ -295,6 +301,7 @@ EXTRA_DIST=$(desktopfiles_files) \
|
||||
$(IMAGES) \
|
||||
$(desktopfiles_in_files) \
|
||||
$(wmproperties_in_files) \
|
||||
$(xml_in_files) \
|
||||
org.gnome.mutter.gschema.xml.in \
|
||||
mutter-schemas.convert \
|
||||
libmutter.pc.in \
|
||||
|
@ -3232,6 +3232,45 @@ handle_toggle_above (MetaDisplay *display,
|
||||
meta_window_make_above (window);
|
||||
}
|
||||
|
||||
static void
|
||||
handle_toggle_tiled (MetaDisplay *display,
|
||||
MetaScreen *screen,
|
||||
MetaWindow *window,
|
||||
XEvent *event,
|
||||
MetaKeyBinding *binding,
|
||||
gpointer dummy)
|
||||
{
|
||||
MetaTileMode mode = binding->handler->data;
|
||||
|
||||
if ((META_WINDOW_TILED_LEFT (window) && mode == META_TILE_LEFT) ||
|
||||
(META_WINDOW_TILED_RIGHT (window) && mode == META_TILE_RIGHT))
|
||||
{
|
||||
window->tile_monitor_number = window->saved_maximize ? window->monitor->number
|
||||
: -1;
|
||||
window->tile_mode = window->saved_maximize ? META_TILE_MAXIMIZED
|
||||
: META_TILE_NONE;
|
||||
|
||||
if (window->saved_maximize)
|
||||
meta_window_maximize (window, META_MAXIMIZE_VERTICAL |
|
||||
META_MAXIMIZE_HORIZONTAL);
|
||||
else
|
||||
meta_window_unmaximize (window, META_MAXIMIZE_VERTICAL |
|
||||
META_MAXIMIZE_HORIZONTAL);
|
||||
}
|
||||
else if (meta_window_can_tile_side_by_side (window))
|
||||
{
|
||||
window->tile_monitor_number = window->monitor->number;
|
||||
window->tile_mode = mode;
|
||||
/* Maximization constraints beat tiling constraints, so if the window
|
||||
* is maximized, tiling won't have any effect unless we unmaximize it
|
||||
* horizontally first; rather than calling meta_window_unmaximize(),
|
||||
* we just set the flag and rely on meta_window_tile() syncing it to
|
||||
* save an additional roundtrip.
|
||||
window->maximized_horizontally = FALSE;
|
||||
meta_window_tile (window);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
handle_toggle_maximized (MetaDisplay *display,
|
||||
MetaScreen *screen,
|
||||
@ -3889,6 +3928,20 @@ init_builtin_key_bindings (MetaDisplay *display)
|
||||
META_KEYBINDING_ACTION_TOGGLE_MAXIMIZED,
|
||||
handle_toggle_maximized, 0);
|
||||
|
||||
add_builtin_keybinding (display,
|
||||
"toggle-tiled-left",
|
||||
SCHEMA_MUTTER_KEYBINDINGS,
|
||||
META_KEY_BINDING_PER_WINDOW,
|
||||
META_KEYBINDING_ACTION_TOGGLE_TILED_LEFT,
|
||||
handle_toggle_tiled, META_TILE_LEFT);
|
||||
|
||||
add_builtin_keybinding (display,
|
||||
"toggle-tiled-right",
|
||||
SCHEMA_MUTTER_KEYBINDINGS,
|
||||
META_KEY_BINDING_PER_WINDOW,
|
||||
META_KEYBINDING_ACTION_TOGGLE_TILED_RIGHT,
|
||||
handle_toggle_tiled, META_TILE_RIGHT);
|
||||
|
||||
add_builtin_keybinding (display,
|
||||
"toggle-above",
|
||||
SCHEMA_COMMON_KEYBINDINGS,
|
||||
|
@ -191,6 +191,8 @@ typedef enum _MetaKeyBindingAction
|
||||
META_KEYBINDING_ACTION_ACTIVATE_WINDOW_MENU,
|
||||
META_KEYBINDING_ACTION_TOGGLE_FULLSCREEN,
|
||||
META_KEYBINDING_ACTION_TOGGLE_MAXIMIZED,
|
||||
META_KEYBINDING_ACTION_TOGGLE_TILED_LEFT,
|
||||
META_KEYBINDING_ACTION_TOGGLE_TILED_RIGHT,
|
||||
META_KEYBINDING_ACTION_TOGGLE_ABOVE,
|
||||
META_KEYBINDING_ACTION_MAXIMIZE,
|
||||
META_KEYBINDING_ACTION_UNMAXIMIZE,
|
||||
|
@ -83,6 +83,14 @@
|
||||
<default><![CDATA[['<Control><Shift><Alt>r']]]></default>
|
||||
</key>
|
||||
|
||||
<key name="toggle-tiled-left" type="as">
|
||||
<default><![CDATA[['<Super>Left']]]></default>
|
||||
</key>
|
||||
|
||||
<key name="toggle-tiled-right" type="as">
|
||||
<default><![CDATA[['<Super>Right']]]></default>
|
||||
</key>
|
||||
|
||||
<key name="tab-popup-select" type="as">
|
||||
<default>[]</default>
|
||||
<_summary>Select window from tab popup</_summary>
|
||||
|
Loading…
Reference in New Issue
Block a user