diff options
author | Omar Zeidan <[email protected]> | 2017-12-30 03:52:32 +0100 |
---|---|---|
committer | raveit65 <[email protected]> | 2018-01-15 17:29:48 +0100 |
commit | 7e14f82c4b5e3137bbdc3a4e55dbfe01e5af28c0 (patch) | |
tree | eec7bbf38d1ac51f46b06e516d67dc3498bdeaa0 /src | |
parent | 11d5b89c337e0ba5a9ffd25dc3404db6afbbefbb (diff) | |
download | marco-7e14f82c4b5e3137bbdc3a4e55dbfe01e5af28c0.tar.bz2 marco-7e14f82c4b5e3137bbdc3a4e55dbfe01e5af28c0.tar.xz |
Implemented simple shourtcuts to move window to another monitor
Diffstat (limited to 'src')
-rw-r--r-- | src/50-marco-window-key.xml.in | 16 | ||||
-rw-r--r-- | src/core/keybindings.c | 41 | ||||
-rw-r--r-- | src/include/all-keybindings.h | 14 | ||||
-rw-r--r-- | src/org.mate.marco.gschema.xml | 20 |
4 files changed, 91 insertions, 0 deletions
diff --git a/src/50-marco-window-key.xml.in b/src/50-marco-window-key.xml.in index 6d826d5f..217354e6 100644 --- a/src/50-marco-window-key.xml.in +++ b/src/50-marco-window-key.xml.in @@ -130,6 +130,22 @@ _description="Move window to center of screen" /> <KeyListEntry + name="move-to-monitor-n" + _description="Move window to north (top) monitor" /> + + <KeyListEntry + name="move-to-monitor-s" + _description="Move window to south (bottom) monitor" /> + + <KeyListEntry + name="move-to-monitor-e" + _description="Move window to east (right) monitor" /> + + <KeyListEntry + name="move-to-monitor-w" + _description="Move window to west (left) monitor" /> + + <KeyListEntry name="move-to-workspace-1" _description="Move window to workspace 1" value="1" diff --git a/src/core/keybindings.c b/src/core/keybindings.c index 2b71b3fa..11b8daf4 100644 --- a/src/core/keybindings.c +++ b/src/core/keybindings.c @@ -2672,6 +2672,47 @@ handle_move_to_center (MetaDisplay *display, window->rect.height); } + +static void +handle_move_to_monitor (MetaDisplay *display, + MetaScreen *screen, + MetaWindow *window, + XEvent *event, + MetaKeyBinding *binding) +{ + MetaScreenDirection move_direction = binding->handler->data; + MetaXineramaScreenInfo* current; + MetaXineramaScreenInfo* neighbour; + MetaRectangle current_window_rect; + int new_x; + int new_y; + + + current = meta_screen_get_xinerama_for_window(screen, window); + neighbour = meta_screen_get_xinerama_neighbor(screen, current->number, move_direction); + + if(neighbour == NULL || + current->number == neighbour->number) + return; + + if(META_WINDOW_TILED (window)) + { + window->tile_monitor_number = neighbour->number; + return; + } + + meta_window_get_client_root_coords(window, ¤t_window_rect); + + new_x = current_window_rect.x - current->rect.x + neighbour->rect.x; + new_y = current_window_rect.y - current->rect.y + neighbour->rect.y; + /* target_rect.width = window->rect.width; */ + /* target_rect.height = window->rect.height; */ + /* Maybe do some resizing? */ + + meta_window_move(window, TRUE, new_x, new_y); + +} + static gboolean process_workspace_switch_grab (MetaDisplay *display, MetaScreen *screen, diff --git a/src/include/all-keybindings.h b/src/include/all-keybindings.h index 2cba3df2..cba8e9fd 100644 --- a/src/include/all-keybindings.h +++ b/src/include/all-keybindings.h @@ -279,6 +279,7 @@ keybind (move-to-corner-sw, handle_move_to_corner_sw, 0, keybind (move-to-corner-se, handle_move_to_corner_se, 0, BINDING_PER_WINDOW) + keybind (move-to-side-n, handle_move_to_side_n, 0, BINDING_PER_WINDOW) keybind (move-to-side-s, handle_move_to_side_s, 0, @@ -290,6 +291,19 @@ keybind (move-to-side-w, handle_move_to_side_w, 0, keybind (move-to-center, handle_move_to_center, 0, BINDING_PER_WINDOW) +keybind (move-to-monitor-n, handle_move_to_monitor, META_SCREEN_UP, + BINDING_PER_WINDOW) +keybind (move-to-monitor-s, handle_move_to_monitor, META_SCREEN_DOWN, + BINDING_PER_WINDOW) +keybind (move-to-monitor-e, handle_move_to_monitor, META_SCREEN_RIGHT, + BINDING_PER_WINDOW) +keybind (move-to-monitor-w, handle_move_to_monitor, META_SCREEN_LEFT, + BINDING_PER_WINDOW) + + + + + keybind (switch-to-workspace-prev, handle_switch_to_workspace, META_MOTION_PREV, 0) diff --git a/src/org.mate.marco.gschema.xml b/src/org.mate.marco.gschema.xml index 70a72337..6632e6b1 100644 --- a/src/org.mate.marco.gschema.xml +++ b/src/org.mate.marco.gschema.xml @@ -948,6 +948,26 @@ <summary>Move window to center of screen</summary> <description>The format looks like "<Control>a" or "<Shift><Alt>F1". The parser is fairly liberal and allows lower or upper case, and also abbreviations such as "<Ctl>" and "<Ctrl>". If you set the option to the special string "disabled", then there will be no keybinding for this action.</description> </key> + <key name="move-to-monitor-n" type="s"> + <default>'disabled'</default> + <summary>Move window to north (top) monitor</summary> + <description>The format looks like "<Control>a" or "<Shift><Alt>F1". The parser is fairly liberal and allows lower or upper case, and also abbreviations such as "<Ctl>" and "<Ctrl>". If you set the option to the special string "disabled", then there will be no keybinding for this action.</description> + </key> + <key name="move-to-monitor-s" type="s"> + <default>'disabled'</default> + <summary>Move window to south (bottom) monitor</summary> + <description>The format looks like "<Control>a" or "<Shift><Alt>F1". The parser is fairly liberal and allows lower or upper case, and also abbreviations such as "<Ctl>" and "<Ctrl>". If you set the option to the special string "disabled", then there will be no keybinding for this action.</description> + </key> + <key name="move-to-monitor-e" type="s"> + <default>'disabled'</default> + <summary>Move window to east (right) monitor</summary> + <description>The format looks like "<Control>a" or "<Shift><Alt>F1". The parser is fairly liberal and allows lower or upper case, and also abbreviations such as "<Ctl>" and "<Ctrl>". If you set the option to the special string "disabled", then there will be no keybinding for this action.</description> + </key> + <key name="move-to-monitor-w" type="s"> + <default>'disabled'</default> + <summary>Move window to west (left) monitor</summary> + <description>The format looks like "<Control>a" or "<Shift><Alt>F1". The parser is fairly liberal and allows lower or upper case, and also abbreviations such as "<Ctl>" and "<Ctrl>". If you set the option to the special string "disabled", then there will be no keybinding for this action.</description> + </key> </schema> </schemalist> |