Keyboard shortcut to move window to a side in Gnome

44,780

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
Share:
44,780

Related videos on Youtube

Maria Ines Parnisari
Author by

Maria Ines Parnisari

Updated on September 18, 2022

Comments

  • Maria Ines Parnisari
    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'
    Gilles 'SO- stop being evil' over 10 years
    You can condense Alt+space M into Alt+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
    Tran almost 10 years
    And the window gets moved in steps, so won't be able to to fit snuggly against a side
  • nilsocket
    nilsocket about 9 years
    a somewhat cleaner way is using getactivewindow: xdotool getactivewindow windowmove x 0
  • sappjw
    sappjw over 8 years
    @glS You can also use getwindowfocus in your suggestion
  • Brandon
    Brandon over 7 years
    I'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
    Raffi Khatchadourian over 6 years
    Somehow the left and right sides aren't working. Everything else seems to work. Any ideas why?
  • matthew_360
    matthew_360 over 6 years
    thanks for this. Accidentally moved the window so the toolbar was out of the field of view.
  • Arnold Roa
    Arnold Roa over 6 years
    It's possible to change the Ctrl + Alt + Keypad for others keys? Like Ctrl + Alt + Shift + Keypad
  • Jonathan
    Jonathan over 6 years
    No longer works in Gnome on Ubuntu 17.10
  • Jonathan
    Jonathan over 6 years
    To 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
    Justas over 6 years
    Just a tip, Super = "Windows" key on most keyboards
  • Flimm
    Flimm about 6 years
    Aren't these shortcuts for Unity, not for GNOME Shell?
  • rubynorails
    rubynorails about 6 years
    I 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
    Pratik Gaikwad almost 6 years
    Ctrl + Alt + Keypad for others movements don't work in 18.04, any idea how to fix?
  • user8162
    user8162 almost 6 years
    CTRL+ALT+↓/↑ for workspace switching is working fine. For others, you can define it in settings→keyboard. Note that ubuntu now used gnome.
  • AdminBee
    AdminBee almost 3 years
    Welcome 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
    Admin about 2 years
    In Gnome 3.28 Shift + Super + Arrow moves window between screens. Using just Super + Arrow changes window's size and location in current screen.