86

I use spaces for having multiple desktops, but often need to move a program from one space to another.

I am aware of the various ways to do that with a mouse:

  • Click-and-hold on the title bar of window and drag to edge
  • F8 to show all Spaces and drag to desired location
  • Click-and-hold on the title bar, and use Ctrl+# or Ctrl+Scroll Arrow

But have not been able to find a keyboard-only method. I use Linux for one of my primary workstations which has this ability and I would LOVE to use it with OSX as well.

1

7 Answers 7

43

While dragging a window, press key combo to move window to numbered space:

  • Control + 1
  • Control + 2
  • Control + 3
  • etc ...

EDIT: For Lion, I had to go to System Preferences -> Keyboard -> Keyboard Shortcuts -> Mission Control and enable these hotkeys.

4
  • 18
    This just moves the screen to another space, you actually have to click the window with the mouse and then use that shortcut to move the window.
    – Winder
    Commented Sep 14, 2010 at 11:56
  • 1
    Looks like you need to enable these keyboard shortcuts for every release since Lion. To your credit, this is easier for my fingers than what I'd been doing before: ctrl + → while dragging a window.
    – Merchako
    Commented Mar 6, 2017 at 10:41
  • 11
    −1. The OP asked for “a keyboard-only method”. “Dragging a window” requires the mouse. Commented Oct 26, 2021 at 7:00
  • 1
    Hi, is there any solution for this in 2024 for Sonoma 14.5? Commented Jul 22 at 11:15
19

SizeUp

You could have a look at SizeUp, which has been recommended on apple.se at least once before - it has some nice keyboard tools for throwing windows around multiple monitors (as I use it) and also for throwing them around multiple 'spaces'.

It's not free, but it's very useful and certainly worth the small registration fee.

1
  • Spectacle does work for multiple displays, as long as the app being moved is not in full screen mode. Commented Jan 16, 2018 at 16:25
12

Amethyst

With Amethyst, you can send windows to specific spaces using configurable keyboard shortcuts. One possible setup is:

  • Command + Control + 1   [send to Desktop 1]
  • Command + Control + 2   [send to Desktop 2]
  • Command + Control + 3   [send to Desktop 3]
  • and so on . . .

By default, Amethyst automatically tiles your macOS windows. If you do not want automatic tiling or the extra layout features that Amethyst provides, then add "floating" to Layouts under Preferences and remove all other layouts. Also, disable any keyboard shortcuts you do not need under the "Shortcuts" tab.

2
  • 1
    On the off chance anyone's looking at this thread years later, try Amethyst with BetterTouchTool (paid). Changed my life. The BetterTouchTool 'keyboard gestures' can be set up to do Ctrl+Alt+Shift+L/H to send a window one space to the right/left respectively; this complements the normal shortcuts perfectly. Then set up trackpad or magic mouse gestures to perform the Amethyst shortcuts, like TipTaps for resizing the main window, or my favourite, 'two finger touch top' to left click and then set current window to main window (alt-shift-enter). Beautiful.
    – zelk
    Commented Mar 14, 2016 at 15:29
  • Amethyst is great! Unfortunately, its throw window action has been broken since Sonoma
    – Noel Yap
    Commented Aug 24 at 16:03
8

yabai and skhd

yabai

yabai is a window management utility that is designed to work as an extension to the built-in window manager of macOS.

yabai on github: https://github.com/koekeishiya/yabai

yabai provides a command to move a window to the next screen:

yabai -m window --space next

If you want to move a window to the next screen and also focus the next screen then use:

yabai -m window --space next && yabai -m window --space next

yabai automatically tiles your windows per default. You can configure the layout float to disable that. To do that add following line to ~/.yabairc:

yabai -m config layout float

skhd

skhd is a simple hotkey daemon for macOS.

skhd on github: https://github.com/koekeishiya/skhd

Install skhd and add this line to ~/.skhdrc:

ctrl + cmd + alt - right : yabai -m window --space next

Then you can move a window to another space with the shortcut ctrl + cmd + alt + right arrow

You can further extend that. Following you see how I configured it in ~/.skhdrc to move windows between spaces:

# move window to next space and focus next space if next space is not last space of display
ctrl + shift + alt - right : [[ $(yabai -m query --spaces --space | jq '.index') != $(yabai -m query --displays --display | jq '.spaces | max') ]] \
                             && yabai -m window --space next \
                             && yabai -m window --space next
3
  • Note that Yabai needs you to (at least temporarily) disable SIP and injects its code into WindowServer, which is security-critical. This is a show-stopper for many people.
    – Atemu
    Commented Jan 14, 2022 at 12:18
  • @Atemu Not all features of Yabai require you to do that but many do.
    – Silv
    Commented Jan 25, 2022 at 15:55
  • 1
    yabai is trash, requires endless configuration and tampering with important Mac files, do not force this upon your OS.
    – Odaym
    Commented Aug 17, 2022 at 21:23
5

BetterTouchTool: free and does the job plus a lot of extra ;) I use it in combination with ShiftIt for window resizing.

4
  • 1
    a great tool, but no longer free. Still well worth the few dollars, though.
    – iconoclast
    Commented Mar 8, 2016 at 18:57
  • ShiftIt is kind of dead now but I fully replaced it with BTT.
    – AsTeR
    Commented Feb 22, 2018 at 14:07
  • BTT is long dead now too. Commented Jul 14, 2023 at 0:37
  • Still using it. Works fine.
    – AsTeR
    Commented Jul 14, 2023 at 16:30
1

There is one built in way to do this without using the mouse. It involves using the Mouse Keys, so this is really only a good option for when you have a full external keyboard connected.

Steps:

  1. Enable Mouse Keys if it's not already enabled (the standard shortcut is hitting the left option button 5x)

  2. Use the numeric pad to position the mouse pointer on the menu bar of the app. Use the #5 key to click, then hold that, and make the window drag a little by clicking one of the other numbers (the directional keys)

  3. Then, once that mode is active, you can stop dragging (but hold the mouse key #5 down), and use the Ctrl-Left/Right shortcut and the window will follow

For more on using Mouse Keys - https://support.apple.com/en-us/HT204434#mousekeys

1
-1

Shiftit is awesome...

I use shiftit which is an open-source tool for resizing/moving windows.

To move a window you can click_hold_window + CTRL + space_number

4
  • 2
    Welcome to Ask Different! Please refrain from 1-sentence answers. We're trying to find the best answers and those answers will provide info as to why they're the best. Short answers like this don't explain why they're the best approach or the best tool. Also, providing a link to the tool can be very helpful to the OP. See How to Answer on how to provide a quality answer. - From Review -
    – fsb
    Commented Aug 18, 2016 at 16:42
  • How do you "click_hold_window" without using the mouse?
    – Elezar
    Commented Jan 14, 2017 at 23:01
  • 1
    Elezar, ShiftIt requires the mouse... Commented Jan 16, 2017 at 15:10
  • 2
    Requires mouse, moves between screens, not spaces, which is what the question asked.
    – Benjamin R
    Commented Sep 13, 2017 at 3:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .