I would like to know if it is possible (with XCode or any other development tool) to make an application that can change to the right or left Space without sending the keyboard shortcut (Ctrl+Left arrow or Ctrl+Right arrow).
The original reason is that I have a Logitech MX Vertical mouse that allows you to assign actions to the buttons, but if I disable the Mission Control keyboard shortcut the options brought by the Logi Options+ application do not work and that's why I wanted to make an application that I could link it to those keyboard shortcuts.
I have deactivated the keyboard shortcuts because from macOS I connect by remote desktop using WindowsApp and it is very good for me to be able to move between the Mac desktop and the remote desktop that I have in full screen. However, if I do not disable the Mission Control keyboard shortcuts (Ctrl + Left arrow, Ctrl + Right arrow and F11), working with Windows is tedious because it changes my desktop instead of moving cursor by words or when I trying to debugging and I press F11 key of Visual Studio).
I would like to know if it is possible (with XCode or any other development tool) to make an application that can change to the right or left Space without sending the keyboard shortcut (Ctrl+Left arrow or Ctrl+Right arrow).
The original reason is that I have a Logitech MX Vertical mouse that allows you to assign actions to the buttons, but if I disable the Mission Control keyboard shortcut the options brought by the Logi Options+ application do not work and that's why I wanted to make an application that I could link it to those keyboard shortcuts.
I have deactivated the keyboard shortcuts because from macOS I connect by remote desktop using WindowsApp and it is very good for me to be able to move between the Mac desktop and the remote desktop that I have in full screen. However, if I do not disable the Mission Control keyboard shortcuts (Ctrl + Left arrow, Ctrl + Right arrow and F11), working with Windows is tedious because it changes my desktop instead of moving cursor by words or when I trying to debugging and I press F11 key of Visual Studio).
Share Improve this question edited 2 days ago HangarRash 15.1k5 gold badges19 silver badges55 bronze badges asked 2 days ago Asier Cayón FranciscoAsier Cayón Francisco 16311 bronze badges 6 | Show 1 more comment1 Answer
Reset to default 0I found a solution.
First I create next scripts:
LeftSpace.sh
#!/bin/sh
# Enable Keyboard -> Shortcuts -> Mission Control -> Move left/right a space.
/usr/libexec/PlistBuddy -c "Set :AppleSymbolicHotKeys:79:enabled true" ~/Library/Preferences/com.apple.symbolichotkeys.plist
/usr/libexec/PlistBuddy -c "Set :AppleSymbolicHotKeys:81:enabled true" ~/Library/Preferences/com.apple.symbolichotkeys.plist
# Ask the system to read the hotkey plist file and ignore the output. Likely updates an in-memory cache with the new plist values.
defaults read com.apple.symbolichotkeys.plist > /dev/null
# Run reactivateSettings to apply the updated settings.
/System/Library/PrivateFrameworks/SystemAdministration.framework/Resources/activateSettings -u
# Move to right Space
osascript -e 'tell application "System Events" to key code 123 using control down'
# Disable Keyboard -> Shortcuts -> Mission Control -> Move left/right a space.
/usr/libexec/PlistBuddy -c "Set :AppleSymbolicHotKeys:79:enabled false" ~/Library/Preferences/com.apple.symbolichotkeys.plist
/usr/libexec/PlistBuddy -c "Set :AppleSymbolicHotKeys:81:enabled false" ~/Library/Preferences/com.apple.symbolichotkeys.plist
# Ask the system to read the hotkey plist file and ignore the output. Likely updates an in-memory cache with the new plist values.
defaults read com.apple.symbolichotkeys.plist > /dev/null
# Run reactivateSettings to apply the updated settings.
/System/Library/PrivateFrameworks/SystemAdministration.framework/Resources/activateSettings -u
and RightSpace.sh (same code changing key code 123
by key code 124
.
Then I tested, being sure that the Apple Script Editor utility has Accessibility permissions. Then I disabled the Key shortcuts of Mission Control and I tested. One it works, I created and App:
- Create de folder structure LeftSpace.app/Contents/MacOS
- Move the LeftSpace.sh to this folder
- Remove the extension of LeftSpace.sh to be LeftSpace
- Do the same with RightSpace
And at the end, I add these two applications to Accessibility permissions like I do before with Apple Script Editor.
Ctrl-Shift-<=
to move to left space? – Philippe Commented 2 days ago