Keyboard shortcut to move window to a side in Gnome
Solution 1
There's no predefined shortcut, but you can make your own. Install the xdotool utility. The following commands move a window to the top and bottom respectively:
xdotool windowmove $(xdotool getwindowfocus) x 0
xdotool windowmove $(xdotool getwindowfocus) x 9999
(Some installations have the unfortunate bug that using x
or y
, which is supposed to leave that coordinate unchanged, doesn't take the width of the window border into account.)
To bind a command like this to a key, go to the system settings, in the “Keyboard” panel, in the “Shortcuts” tab. Select “Custom Shortcuts” and click the +
sign to add a new shortcut.
Solution 2
Taken from comments, here's the answer that helped me, no tools needed.
Ubuntu 16.04 LTS.
Ctrl+Super+Left Arrow - Dock to the left side of your monitor
Ctrl+Super+Right Arrow - Dock to the right side of your monitor
Ctrl+Super+Up Arrow - Maximize the window
Ctrl+Super+Down Arrow (When docked or maximized) - Restore the window.
Ctrl+Super+Down Arrow (When restored) - Minimize the window.
This won't move windows between monitors like it does in Windows. I haven't figured out a way to do that.
Solution 3
Yes...there is a way in Linux to do so ( and to your surprise, it will also work in Windows too )
Just press Alt+Spacebar
then hit the key m
and then move wherever you want by usin the arrow keys. Once you done, hit the Enter
key.
And, oh yeah, It will work if and only if the window in question is not fully maximized
Solution 4
tested in the current gnome 3.28 on ubuntu 18.04
- SUPER+← moves the window to the left
- SUPER+→ moves the window to the right
Solution 5
If you use xbindkeys
and have xdotool
utility installed, you can add the following lines to your ~/.xbindkeysrc
to enable win+left
and win+right
to move current active window to the left/right half of the screen:
"xdotool windowsize $(xdotool getwindowfocus) 50% 100% && xdotool windowmove $(xdotool getwindowfocus) 0 y"
Mod2+Mod4 + Left
"xdotool windowsize $(xdotool getwindowfocus) 50% 100% && xdotool windowmove $(xdotool getwindowfocus) 9999 y"
Mod2+Mod4 + Right
Related videos on Youtube
Maria Ines Parnisari
Updated on September 18, 2022Comments
-
Maria Ines Parnisari over 1 year
In Windows I can press Windows + left/right/up/down keys to press a window against the upper, right, down, or left side respectively. Is there an equivalent in Ubuntu?
Distro: Ubuntu 12.04, using Gnome.
-
Gilles 'SO- stop being evil' over 10 yearsYou can condense
Alt+space M
intoAlt+F7
(but it's less easy to memorize). But that's not quite the same thing, you have to align the window with the screen border manually. -
Tran almost 10 yearsAnd the window gets moved in steps, so won't be able to to fit snuggly against a side
-
nilsocket about 9 yearsa somewhat cleaner way is using getactivewindow:
xdotool getactivewindow windowmove x 0
-
sappjw over 8 years@glS You can also use
getwindowfocus
in your suggestion -
Brandon over 7 yearsI'm running the Prism window manager in Ubuntu and
Alt+Spacebar
is the default combination for opening the search bar. FYI for prism users. -
Raffi Khatchadourian over 6 yearsSomehow the left and right sides aren't working. Everything else seems to work. Any ideas why?
-
matthew_360 over 6 yearsthanks for this. Accidentally moved the window so the toolbar was out of the field of view.
-
Arnold Roa over 6 yearsIt's possible to change the Ctrl + Alt + Keypad for others keys? Like Ctrl + Alt + Shift + Keypad
-
Jonathan over 6 yearsNo longer works in Gnome on Ubuntu 17.10
-
Jonathan over 6 yearsTo get left/right to work, I just used <kbd>Super</kbd>+<kbd>Left Arrow</kbd>. That seemed to pull the window over. Also this worked to bring it from offscreen
-
Justas over 6 yearsJust a tip, Super = "Windows" key on most keyboards
-
Flimm about 6 yearsAren't these shortcuts for Unity, not for GNOME Shell?
-
rubynorails about 6 yearsI have no idea why this had a downvote. This exactly what I was looking for. Have an upvote to get back in there.
-
Pratik Gaikwad almost 6 yearsCtrl + Alt + Keypad for others movements don't work in 18.04, any idea how to fix?
-
user8162 almost 6 yearsCTRL+ALT+↓/↑ for workspace switching is working fine. For others, you can define it in settings→keyboard. Note that ubuntu now used gnome.
-
AdminBee almost 3 yearsWelcome to the site, and thank you for your contribution. You may want to add a short summary on how to configura this extension to achieve the OPs desired behavior.
-
Admin about 2 yearsIn Gnome 3.28
Shift
+Super
+Arrow
moves window between screens. Using justSuper
+Arrow
changes window's size and location in current screen.