23

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.

  • 1
    "Move around" or being pressed against the upper, right, down, left side? – Braiam Dec 5 '13 at 1:45
  • @Braiam, what you said :P – Maria Ines Parnisari Dec 5 '13 at 1:51
  • 3
    In GNOME shell only Ctrl + Super + Left/Right works, others don't. – Braiam Dec 5 '13 at 2:47
  • You should clarify in your title and question body what desktop environment or window manager you are using. Your answer will be specific to that and not the distro. Ubuntu probably means you are using Unity, but I wont assume that. – casey Dec 5 '13 at 5:24
4

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.

  • 1
    a somewhat cleaner way is using getactivewindow: xdotool getactivewindow windowmove x 0 – glS Apr 27 '15 at 13:11
  • @glS You can also use getwindowfocus in your suggestion – sappjw Feb 10 '16 at 21:29
18

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.

  • Somehow the left and right sides aren't working. Everything else seems to work. Any ideas why? – Raffi Khatchadourian Aug 21 '17 at 21:12
  • 1
    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 – Jonathan Nov 16 '17 at 22:46
  • 2
    Just a tip, Super = "Windows" key on most keyboards – Justas Jan 25 '18 at 21:29
  • 1
    Aren't these shortcuts for Unity, not for GNOME Shell? – Flimm Mar 16 '18 at 11:30
13

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

  • 1
    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. – Gilles Dec 5 '13 at 22:49
  • 1
    And the window gets moved in steps, so won't be able to to fit snuggly against a side – Peter V. Mørch Jul 18 '14 at 4:51
  • 1
    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. – Brandon Jan 16 '17 at 15:13
  • thanks for this. Accidentally moved the window so the toolbar was out of the field of view. – matthew_360 Oct 12 '17 at 20:59
  • No longer works in Gnome on Ubuntu 17.10 – Jonathan Nov 16 '17 at 22:44
2

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
1

There's a more flexible builtin way, as Ctrl+Super+Arrow doesn't allow a window to take only a quarter of the screen (for example top left or bottom right).

You can use Ctrl+Alt+Keypad. Which keypad number is pressed (1, 2...) will determine the position of the window (bottom left, bottom...).

  • It's possible to change the Ctrl + Alt + Keypad for others keys? Like Ctrl + Alt + Shift + Keypad – Arnold Roa Nov 2 '17 at 1:13
  • 1
    I have no idea why this had a downvote. This exactly what I was looking for. Have an upvote to get back in there. – rubynorails Mar 26 '18 at 20:44
0

I'm using ubuntu 12.04 gnome classic, but i think it's the same thing for all ubuntu.

Here is what I do:

First of all, you need to install "stiller".

1) Open terminal Ctrl+Alt+T and type:

sudo add-apt-repository ppa:fossfreedom/xfwm4
sudo apt-get update
sudo apt-get install stiler

Second, now you can edit keyboard shortcuts by:

2) Go to "System Settings" -> Keyboard -> Shortcuts ->

Press "Custom Shortcuts" (at the left pane)

Press "+" symbol (at down left of the window)

3) In the "Custom Shortcut" window that is just open, type:

(for example)

"View split on left" as a name, and

"stiler.py left" as a command, and press "Apply".

4) Press "Disable" (it's on the same line with the "View split on left" you just created)

and press the keys combination "Ctrl+Supper+Left" on your keyboard.


  • The same thing for any combination shortcut as for example:

"View split on Right" as a name,

"stiler.py right" as a command,

"Ctrl+Supper+Right" as a keys combination.

OR

"Gnome Search Tool" as a name,

"gnome-search-tool" as a command,

"Super+F" as a keys combination.

OR

"System Monitor" as a name,

"gnome-system-monitor" as a command,

"Ctrl+Shift+Esc" as a keys combination.

This is just an example, it's up to you which name, command, and keys combination you need to use.

0

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
  • Ctrl + Alt + Keypad for others movements don't work in 18.04, any idea how to fix? – Pratik Gaikwad Jul 7 '18 at 18:23
  • CTRL+ALT+↓/↑ for workspace switching is working fine. For others, you can define it in settings→keyboard. Note that ubuntu now used gnome. – user8162 Jul 9 '18 at 15:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.