AppleSpacesSwitchOnActivate
is represented by the second button on print below
In the code below, I get the current value and after I change. This can be tested in terminal with
defaults read -g AppleSpacesSwitchOnActivate
// getting value of AppleSpacesSwitchOnActivate
let switchOnActivate = CFPreferencesCopyAppValue("AppleSpacesSwitchOnActivate" as CFString, ".GlobalPreferences" as CFString)
print(switchOnActivate as! Bool)
// setting value of AppleSpacesSwitchOnActivate to false
CFPreferencesSetAppValue("AppleSpacesSwitchOnActivate" as CFString, false as CFBoolean, ".GlobalPreferences" as CFString)
CFPreferencesAppSynchronize(".GlobalPreferences" as CFString)
Basically, the value AppleSpacesSwitchOnActivate
is changed, but the change is not effective until killall Dock
.
Is there some way to update dock preferences plist without killall Dock
?