Jump to content

Workflow for managing spaces / desktops

Recommended Posts

I've looked around and haven't been able to find what I'm looking for.  Any pointers? I would think my imagined workflow would be a no brainer.


I have 2 monitors. I have a personal setup: mail, chrome, calendar, messages, spotify, etc.  Then I have a development setup: iterm, chrome, sublime, pycharm, etc. 


I'd like a workflow where I could say "dev" and my two OSX spaces / desktops for development would be switched to.

Or I could type "pers" and my other spaces would jump to the front.


Is there an existing way to do this?  I'm reluctant to build my own workflow because I know nothing of apple script.


(Separately I used Moom to lay out windows within a given space.) 

Share this post

Link to post

Don't know if there is a simpler way to do this, but it seems I have found a way and it is working for me.


let's say we have 'Desktop 1' on the first screen for personal use and ' 'Desktop 2' for development

in the second screen we have 'Desktop 3'  for personal use and ' 'Desktop 4' for development


In System preferences -> keyboard -> shortcut -> Mission Control we can enable the various 'Go to desktop', using Ctrl and the desktop number


now you can create a really simple workflow:


add and input element, with keyword 'pers', decheck 'with space', select 'no argument';

link it to an NSApplescript object, with this code


on alfred_script(q)
    tell application "System Events" to key code 18 using control down
    tell application "System Events" to key code 20 using control down
end alfred_script


this will switch both screens to personal use.


add another two linked objects the same way, set the input keyword to 'dev', and on the linked NSApplescript object put this code:


on alfred_script(q)
    tell application "System Events" to key code 19 using control down
    tell application "System Events" to key code 21 using control down
end alfred_script


this should switch both screens to development use.


hope it works for you!






Share this post

Link to post

That's clever! Thanks Giulio.


Question - when I started playing with that, I found that desktops are ordered such that the main screen goes 1,2,3 and then the next is 4,5,6. So if I ever add a 4th space to my main screen, now my script misaligns, right? Have you just not found that to be an issue for you, or do you know a way to hard wire the space numbers?

Share this post

Link to post

yes, unfortunately yes,

this solution works for a fixed number of screens.


and more if you add more desktops, i imagine you should also change the preferences to enable the shortcut to them


anyway if you change the number of desktops, is also really easy to adjust the script.

just keep in mind to start from keycode 18. (Ctrl 1), and go on (19 for Ctrl 2 and so on)


yes, I admit is quite tricky  :)




Share this post

Link to post

yes, I confirm.


if you add a new desktop, it is not automatically enbled the corrispondent shortcut, and the script relies on the shortcut


so, if we even  could find a way to count the desktops, we should anyway goto the preferences to add their shortcut, so nothing automagically working  :(

Share this post

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...