Mission Control allows for multiple desktop (spaces). Does there exist a keyboard shortcut for moving an application's window from one to another?
4 Answers
You can hold the window with your mouse and use the usual keyboard shortcuts to move the window across desktops.
- Works in Ventura. This is the best compromise I can find without extra software. BetterTouchTool's download page gave me a 404.Anton– Anton2022-12-19 17:26:27 +00:00Commented Dec 19, 2022 at 17:26
No, but you can use a third party application, like BetterTouchTool, which allows you to bind key combinations to user defined actions, including moving windows between spaces.
- This is the best solution I have found. In BetterTouchTool's preferences, choose "Add New Shortcut.., and then choose "Move Window One Space/Desktop Left|Right" from "Trigger Predefined Action"ezrock– ezrock2017-08-14 16:33:23 +00:00Commented Aug 14, 2017 at 16:33
This requires you to use the touchpad or mouse, but: Hold the window (at the top bar) with your touchpad or mouse and use Control-1, Control-2, Control-3, etc. to move a window to another space. ( control is the ^ key).
- This shortcut can also be customized in System Settings->Keyboard->Keyboard Shortcuts->Mission Control->Mission Control.Luke Davis– Luke Davis2023-06-15 23:24:53 +00:00Commented Jun 15, 2023 at 23:24
I wrote a blog post on how you can use a hammerspoon script to move windows around spaces with just shortcuts on macOS: Install hammerspoon and add the following script to your init.lua:
-- Set up the logger local log = hs.logger.new('WindowMover', 'info') -- Function to get spaceId by space name function getSpaceIdByName(spaceName) local spaceNames = hs.spaces.missionControlSpaceNames() for uuid, desktops in pairs(spaceNames) do log.i("UUID: " .. uuid) -- Log the UUID for index, name in pairs(desktops) do log.i("Index: " .. index .. ", Name: " .. tostring(name)) -- Log the index and name if name == spaceName then log.i("Found spaceId for " .. spaceName .. ": " .. index) return index end end end log.w("Space not found: " .. spaceName) return nil end -- Function to move focused window to a specific space function moveFocusedWindowToSpace(spaceNumber) local spaceName = "Desktop " .. spaceNumber log.i("Attempting to move window to " .. spaceName) local spaceId = getSpaceIdByName(spaceName) if spaceId then local focusedWindow = hs.window.focusedWindow() if focusedWindow then log.i("Moving window " .. focusedWindow:title() .. " to spaceId " .. spaceId) hs.spaces.moveWindowToSpace(focusedWindow:id(), spaceId) else log.w("No focused window") hs.alert.show("No focused window") end else log.w("Space not found: " .. spaceName) hs.alert.show("Space not found: " .. spaceName) end end -- Bind keys cmd + shift + 1-6 for i = 1, 6 do hs.hotkey.bind({"cmd", "shift"}, tostring(i), function() log.i("Hotkey pressed: cmd + shift + " .. i) moveFocusedWindowToSpace(i) end) end https://konradstaniszewski.com/blog/windows-between-spaces
This is a small script, and can be customized to use whatever shortcuts you want.