rr326 Posted January 23, 2018 Posted January 23, 2018 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.)
juliosecco Posted January 23, 2018 Posted January 23, 2018 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! Giulio
rr326 Posted January 24, 2018 Author Posted January 24, 2018 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?
juliosecco Posted January 24, 2018 Posted January 24, 2018 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
juliosecco Posted January 24, 2018 Posted January 24, 2018 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
Kelson01 Posted October 24, 2021 Posted October 24, 2021 Is there an alfred workflow to switch between spaces (mission control) If not is there any way I would be able to achieve this? I use command + tab but that doesn't always work for what I need I also app switch with alfred and that switches spaces but sometimes I just want a new empty space or to switch to a specific space quickly.
vitor Posted October 27, 2021 Posted October 27, 2021 On 10/24/2021 at 1:09 AM, Undertaker01 said: Is there an alfred workflow to switch between spaces (mission control) Yes, though it requires an extra tool and some setup. I haven’t checked if it still works fine. On 10/24/2021 at 1:09 AM, Undertaker01 said: If not is there any way I would be able to achieve this? I looked into it a few times in the past but haven’t found a simple generic way to do it. Solutions I found always seemed more trouble than worth it. It may be possible by using macOS’ APIs but I haven’t looked that far. On 10/24/2021 at 1:09 AM, Undertaker01 said: but sometimes I just want a new empty space or to switch to a specific space quickly. To switch to different spaces, see (or change) the shortcuts under System Preferences → Keyboard → Shortcuts → Mission Control. I’m merging this post with a previous one with the same question. You may want to check the previous comments.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now