Move window between desktops?

I would like to create a shortcut that when pressed, moves the current window to another desktop. Is there an action for this?

eg. from desktop 3 to desktop 2.
image

If click and hold in the title bar of a window in Desktop 1 (say) and press Control-4 (say), it will move the window to Desktop 4. I'm not sure an action would improve on that built-in shortcut.

1 Like

Adding to @mrpasini's response - The Mission Control Desktop shortcuts are under System Preferences - Keyboard - Shortcuts. You can modify them there if you wish.

KC

2 Likes

Perhaps I was unclear. I was hoping to create a shortcut that move the current window between desktops (like to move the current chrome window to desktop 2), not to switch between them.

1 Like

Gotcha. I was piggybacking on @mrpasini's response. As far from your OP, there were a few past posts that discuss this, in the past, but I think it was determined that there was no Apple issued API that KM could tap into. I remember @ccstone attempted an Apple Script in the past but I don't know how that worked out.

What I do, as mitigation, is have certain apps open in certain desktops by clicking the dock icon - Options and selecting the desktop that I want.

Other than that, maybe the scripting gurus have developed solution. I remember when researching this, a while ago, that there was an app called SizeUp. There is a trial version. Try that if the scripters are unable to chime in or find an adequate solution.

KC

1 Like

I think I have a solution for you.

Make sure you've enabled the keyboard shortcuts the way kcwhat has already described.

Then create as many macros like this one as you have different Spaces (you've called them desktops)

You need to change the bits highlighted in red to suit you as follows:

  1. Use the same hotkey trigger for each one so you get a conflict palette allowing you to choose desktop 1, desktop 2, etc. In my version, I use control-option-shift-command-P as the trigger.

  2. Name each of the macros the same except for the digit: 1, 2, 3, etc so when the conflict palette is show you then just have to press the digit key to make the switch.

  3. In each macro, change the keystroke typed appropriately: for example ^1 for desktop 1, ^2 for desktop 2, etc. Obviously these should match the setting you made in System Preferences as described by kcwhat.

That's it. It works here for me provided the window of the app I want to move to a different space is at the front and activated.

Hope this helps.

Extra: I've just been playing with this and noticed some odd behaviour. Like, the first time you use this the app gets moved to the desired space but you're left sitting in the space you've just moved it from. Also, some apps seem not to like having this done to them: for example, iTerm just quits. So, this may not be a total solution, but is probably best considered as a starting point! Good luck!

Addendum: I now know what the problem is: change the value "15" in the mouse click action to "70". The macro was accidentally closing the app by clicking on the red button.

4 Likes

@tiffle to the rescue!

Nope! Keyboard Maestro to the rescue!! Thanks.

I forgot to mention that BetterTouchTool does this as an action.

1 Like

What's the click left button for (15 to the right and 5 down)?

That's my guess...

Hi, @bocciaman. On this topic, you might want to check out: Desktop Spaces • Macros to Improve Navigation and Window Management

1 Like

I have this '1 functionality' setup with BetterTouchTool (BTT). It was much easier to set up in BTT because BTT had an action for moving the frontmost app one space to the right or left of the current one using hotkeys.