MacOS – Shortcut used by another action/reboot breaks shortcut

bugdisplaykeyboardmacos

I think this is a bug, but perhaps it is a unique problem to me for some reason. I really like independent display switching in Mavericks, and I set it up in what I guess is a unique way. I have two monitors with 4 displays each. Displays 1&5 are activated by the same keyboard shortcut ctrl-1. All the other displays are activated individually with ctrl-2 through ctrl-7. This worked really well and I liked it until I rebooted. Then, it broke.

After rebooting, ctrl-1 still activates display 1, but not display 5. I figured this was not an intended usage, and so I fixed the keyboard shortcut so that display 5 was activated by a different shortcut. However, the shortcut for display 5 is completely broken until another reboot, regardless of what key is is set to.

What I want is for this to work the way I want – to support one shortcut key for multiple displays. I do not expect to get that, unless someone knows of a good utility or plug in that will create that behavior.

Best Answer

As I thought about it this morning, I realized I could get this functionality pretty simply - with a macro. An automator script, as a service, was bound to the ctrl-1. The spaces were moved to option-1. The service takes no input, and here is the script:

on run
    tell application "System Events"
        key code 18 using {option down}
        key code 23 using {option down}
    end tell
    return "success"
end run

A list of key codes can be found here: How do I automate a key press in AppleScript?