I have been trying to figure this out for a long time. I have a pretty typical Mac OS provisioning script:
https://gist.github.com/ryanpcmcquen/b2e608311f286a4ab3e1
I would like to change the Mission control shortcuts to all be Ctrl+Alt+... instead of Ctrl+.... For example, the default is: Ctrl+Up to activate Mission Control. I would like to change this to Ctrl+Alt+Up, because the current shortcut conflicts with other programs I use.
Note that I am already aware of how to do this through System Preferences > Keyboard > Shortcuts
, I am looking for a scriptable, command line solution.
EDIT: Thanks to @user3439894 I went through and made a script to change all the plist keys to what I want them to be. The only issue is, it does not work. :-(
Here is what I have so far:
#!/bin/bash
defaults write ~/Library/Preferences/com.apple.symbolichotkeys.plist AppleSymbolicHotKeys -dict-add 32 "{enabled = 1; value = { parameters = (65535, 126, 2883584); type = standard; }; }"
defaults write ~/Library/Preferences/com.apple.symbolichotkeys.plist AppleSymbolicHotKeys -dict-add 33 "{enabled = 1; value = { parameters = (65535, 125, 2883584); type = standard; }; }"
defaults write ~/Library/Preferences/com.apple.symbolichotkeys.plist AppleSymbolicHotKeys -dict-add 34 "{enabled = 1; value = { parameters = (65535, 126, 3014656); type = standard; }; }"
defaults write ~/Library/Preferences/com.apple.symbolichotkeys.plist AppleSymbolicHotKeys -dict-add 35 "{enabled = 1; value = { parameters = (65535, 125, 3014656); type = standard; }; }"
defaults write ~/Library/Preferences/com.apple.symbolichotkeys.plist AppleSymbolicHotKeys -dict-add 79 "{enabled = 1; value = { parameters = (65535, 123, 2883584); type = standard; }; }"
defaults write ~/Library/Preferences/com.apple.symbolichotkeys.plist AppleSymbolicHotKeys -dict-add 80 "{enabled = 1; value = { parameters = (65535, 123, 3014656); type = standard; }; }"
defaults write ~/Library/Preferences/com.apple.symbolichotkeys.plist AppleSymbolicHotKeys -dict-add 81 "{enabled = 1; value = { parameters = (65535, 124, 2883584); type = standard; }; }"
defaults write ~/Library/Preferences/com.apple.symbolichotkeys.plist AppleSymbolicHotKeys -dict-add 82 "{enabled = 1; value = { parameters = (65535, 124, 3014656); type = standard; }; }"
chown -Rf `whoami` ~/Library/Preferences/com.apple.symbolichotkeys.plist;
defaults read com.apple.symbolichotkeys
type = standard;
should actually betype = 'standard';
note the quotes around'standard'
. That said though, sometimes even with a properly formed command line the change just does not take effect, even with; killall -u $USER cfprefsd
added to the end of thedefaults
command. Also the full path to the.plist
file in this use case is not necessary and simply e.g.defaults write com.apple.symbolichotkeys AppleSymbolicHotKeys ...
and the remainder of the command is all that's necessary.