keybinding: Implement keybindings for moving windows between monitors
Currently the only way to move a window to another monitor via keyboard is to start a move operation and move it manually using arrow keys. We do have all the bits of a dedicated keybinding in place already, so offer it as a more comfortable alternative. https://bugzilla.gnome.org/show_bug.cgi?id=671054
This commit is contained in:
parent
75f5d59d53
commit
0fe5c4f957
@ -41,6 +41,7 @@
|
|||||||
#include "ui.h"
|
#include "ui.h"
|
||||||
#include "frame.h"
|
#include "frame.h"
|
||||||
#include "place.h"
|
#include "place.h"
|
||||||
|
#include "screen-private.h"
|
||||||
#include <meta/prefs.h>
|
#include <meta/prefs.h>
|
||||||
#include <meta/util.h>
|
#include <meta/util.h>
|
||||||
|
|
||||||
@ -3973,6 +3974,26 @@ handle_move_to_workspace (MetaDisplay *display,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
handle_move_to_monitor (MetaDisplay *display,
|
||||||
|
MetaScreen *screen,
|
||||||
|
MetaWindow *window,
|
||||||
|
XIDeviceEvent *event,
|
||||||
|
MetaKeyBinding *binding,
|
||||||
|
gpointer dummy)
|
||||||
|
{
|
||||||
|
gint which = binding->handler->data;
|
||||||
|
const MetaMonitorInfo *current, *new;
|
||||||
|
|
||||||
|
current = meta_screen_get_monitor_for_window (screen, window);
|
||||||
|
new = meta_screen_get_monitor_neighbor (screen, current->number, which);
|
||||||
|
|
||||||
|
if (new == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
meta_window_move_to_monitor (window, new->number);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
handle_raise_or_lower (MetaDisplay *display,
|
handle_raise_or_lower (MetaDisplay *display,
|
||||||
MetaScreen *screen,
|
MetaScreen *screen,
|
||||||
@ -4629,6 +4650,34 @@ init_builtin_key_bindings (MetaDisplay *display)
|
|||||||
META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_DOWN,
|
META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_DOWN,
|
||||||
handle_move_to_workspace, META_MOTION_DOWN);
|
handle_move_to_workspace, META_MOTION_DOWN);
|
||||||
|
|
||||||
|
add_builtin_keybinding (display,
|
||||||
|
"move-to-monitor-left",
|
||||||
|
common_keybindings,
|
||||||
|
META_KEY_BINDING_PER_WINDOW,
|
||||||
|
META_KEYBINDING_ACTION_MOVE_TO_MONITOR_LEFT,
|
||||||
|
handle_move_to_monitor, META_SCREEN_LEFT);
|
||||||
|
|
||||||
|
add_builtin_keybinding (display,
|
||||||
|
"move-to-monitor-right",
|
||||||
|
common_keybindings,
|
||||||
|
META_KEY_BINDING_PER_WINDOW,
|
||||||
|
META_KEYBINDING_ACTION_MOVE_TO_MONITOR_RIGHT,
|
||||||
|
handle_move_to_monitor, META_SCREEN_RIGHT);
|
||||||
|
|
||||||
|
add_builtin_keybinding (display,
|
||||||
|
"move-to-monitor-down",
|
||||||
|
common_keybindings,
|
||||||
|
META_KEY_BINDING_PER_WINDOW,
|
||||||
|
META_KEYBINDING_ACTION_MOVE_TO_MONITOR_DOWN,
|
||||||
|
handle_move_to_monitor, META_SCREEN_DOWN);
|
||||||
|
|
||||||
|
add_builtin_keybinding (display,
|
||||||
|
"move-to-monitor-up",
|
||||||
|
common_keybindings,
|
||||||
|
META_KEY_BINDING_PER_WINDOW,
|
||||||
|
META_KEYBINDING_ACTION_MOVE_TO_MONITOR_UP,
|
||||||
|
handle_move_to_monitor, META_SCREEN_UP);
|
||||||
|
|
||||||
add_builtin_keybinding (display,
|
add_builtin_keybinding (display,
|
||||||
"raise-or-lower",
|
"raise-or-lower",
|
||||||
common_keybindings,
|
common_keybindings,
|
||||||
|
@ -243,6 +243,10 @@ void meta_prefs_set_ignore_request_hide_titlebar (gboolean whether);
|
|||||||
* @META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_RIGHT: FILLME
|
* @META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_RIGHT: FILLME
|
||||||
* @META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_UP: FILLME
|
* @META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_UP: FILLME
|
||||||
* @META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_DOWN: FILLME
|
* @META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_DOWN: FILLME
|
||||||
|
* @META_KEYBINDING_ACTION_MOVE_TO_MONITOR_LEFT: FILLME
|
||||||
|
* @META_KEYBINDING_ACTION_MOVE_TO_MONITOR_RIGHT: FILLME
|
||||||
|
* @META_KEYBINDING_ACTION_MOVE_TO_MONITOR_UP: FILLME
|
||||||
|
* @META_KEYBINDING_ACTION_MOVE_TO_MONITOR_DOWN: FILLME
|
||||||
* @META_KEYBINDING_ACTION_RAISE_OR_LOWER: FILLME
|
* @META_KEYBINDING_ACTION_RAISE_OR_LOWER: FILLME
|
||||||
* @META_KEYBINDING_ACTION_RAISE: FILLME
|
* @META_KEYBINDING_ACTION_RAISE: FILLME
|
||||||
* @META_KEYBINDING_ACTION_LOWER: FILLME
|
* @META_KEYBINDING_ACTION_LOWER: FILLME
|
||||||
@ -336,6 +340,10 @@ typedef enum _MetaKeyBindingAction
|
|||||||
META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_RIGHT,
|
META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_RIGHT,
|
||||||
META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_UP,
|
META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_UP,
|
||||||
META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_DOWN,
|
META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_DOWN,
|
||||||
|
META_KEYBINDING_ACTION_MOVE_TO_MONITOR_LEFT,
|
||||||
|
META_KEYBINDING_ACTION_MOVE_TO_MONITOR_RIGHT,
|
||||||
|
META_KEYBINDING_ACTION_MOVE_TO_MONITOR_UP,
|
||||||
|
META_KEYBINDING_ACTION_MOVE_TO_MONITOR_DOWN,
|
||||||
META_KEYBINDING_ACTION_RAISE_OR_LOWER,
|
META_KEYBINDING_ACTION_RAISE_OR_LOWER,
|
||||||
META_KEYBINDING_ACTION_RAISE,
|
META_KEYBINDING_ACTION_RAISE,
|
||||||
META_KEYBINDING_ACTION_LOWER,
|
META_KEYBINDING_ACTION_LOWER,
|
||||||
|
Loading…
Reference in New Issue
Block a user