diff --git a/.osx b/.osx
index c5326e2..d211492 100755
--- a/.osx
+++ b/.osx
@@ -31,6 +31,28 @@ else
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
fi
+set_symbolic_hotkey() {
+ local id="$1"
+ local enabled="$2"
+ local key_char="$3"
+ local key_code="$4"
+ local modifiers="$5"
+ local plist="${HOME}/Library/Preferences/com.apple.symbolichotkeys.plist"
+
+ defaults write com.apple.symbolichotkeys AppleSymbolicHotKeys -dict-add "${id}" "enabled<${enabled}/>valueparameters${key_char}${key_code}${modifiers}typestandard"
+
+ # Keep the on-disk plist honest even when cfprefsd has a stale cached value.
+ /usr/libexec/PlistBuddy -c "Set :AppleSymbolicHotKeys:${id}:enabled ${enabled}" "${plist}" >/dev/null 2>&1 || true
+}
+
+refresh_symbolic_hotkeys() {
+ defaults read com.apple.symbolichotkeys AppleSymbolicHotKeys >/dev/null 2>&1 || true
+
+ if [[ -x /System/Library/PrivateFrameworks/SystemAdministration.framework/Resources/activateSettings ]]; then
+ /System/Library/PrivateFrameworks/SystemAdministration.framework/Resources/activateSettings -u >/dev/null 2>&1 || true
+ fi
+}
+
###############################################################################
# General UI/UX #
###############################################################################
@@ -59,6 +81,7 @@ defaults write com.apple.AppleMultitouchTrackpad ActuationStrength -int 0
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadRightClick -bool true
defaults write com.apple.AppleMultitouchTrackpad TrackpadRightClick -bool true
+# Use the bottom-right trackpad corner for secondary click.
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadCornerSecondaryClick -int 2
defaults write com.apple.AppleMultitouchTrackpad TrackpadCornerSecondaryClick -int 2
@@ -81,16 +104,18 @@ defaults write com.apple.screencapture disable-shadow -bool true
# Keyboard Shortcuts #
###############################################################################
-# Configure screenshot shortcuts
-defaults write com.apple.symbolichotkeys AppleSymbolicHotKeys -dict-add 28 "enabledvalueparameters51201179648typestandard"
-defaults write com.apple.symbolichotkeys AppleSymbolicHotKeys -dict-add 29 "enabledvalueparameters51201441792typestandard"
-defaults write com.apple.symbolichotkeys AppleSymbolicHotKeys -dict-add 30 "enabledvalueparameters52211179648typestandard"
-defaults write com.apple.symbolichotkeys AppleSymbolicHotKeys -dict-add 31 "enabledvalueparameters52211441792typestandard"
-defaults write com.apple.symbolichotkeys AppleSymbolicHotKeys -dict-add 184 "enabledvalueparameters53231179648typestandard"
+# Disable screenshot shortcuts.
+set_symbolic_hotkey 28 false 51 20 1179648 # Save picture of screen as a file
+set_symbolic_hotkey 29 false 51 20 1441792 # Copy picture of screen to clipboard
+set_symbolic_hotkey 30 false 52 21 1179648 # Save picture of selected area as a file
+set_symbolic_hotkey 31 false 52 21 1441792 # Copy picture of selected area to clipboard
+set_symbolic_hotkey 184 false 53 23 1179648 # Screenshot and recording options
-# Disable Spotlight shortcuts
-defaults write com.apple.symbolichotkeys AppleSymbolicHotKeys -dict-add 64 "enabledvalueparameters32491048576typestandard"
-defaults write com.apple.symbolichotkeys AppleSymbolicHotKeys -dict-add 65 "enabledvalueparameters32491572864typestandard"
+# Disable Spotlight and Show Apps shortcuts.
+set_symbolic_hotkey 64 false 32 49 1048576 # Show Spotlight search
+set_symbolic_hotkey 65 false 32 49 1572864 # Show Finder search window
+set_symbolic_hotkey 160 false 65535 65535 0 # Show Apps
+refresh_symbolic_hotkeys
###############################################################################
# Finder #
@@ -124,6 +149,7 @@ defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
defaults write com.apple.dock tilesize -int 30
defaults write com.apple.dock expose-animation-duration -float 0.15
defaults write com.apple.dock showhidden -bool true
+defaults write com.apple.dock show-recents -bool false
defaults write com.apple.universalaccess reduceTransparency -bool true
defaults write com.apple.dock wvous-br-corner -int 2
diff --git a/README.md b/README.md
index f97c562..9387cb7 100644
--- a/README.md
+++ b/README.md
@@ -2,4 +2,27 @@
My configuration. Minimalist, but helps save a few thousand keystrokes a day. I use macOS, so I can only guarantee they'll work on a Mac, but I use some of these dotfiles on various linux servers, and they seem to be pretty flexible.
+## macOS settings
+Run `.osx` to apply macOS defaults:
+
+```sh
+./.osx
+```
+
+Use `--no-restart` while iterating:
+
+```sh
+./.osx --no-restart
+```
+
+The script configures:
+
+- Bottom-right trackpad corner as secondary click.
+- Screenshot output to `~/Downloads`.
+- Screenshot keyboard shortcuts disabled.
+- Spotlight and Show Apps keyboard shortcuts disabled.
+- Dock recent apps disabled.
+- Dock hot corners, Finder defaults, Safari developer settings, and other UI preferences.
+
+Some settings are cached by macOS services. If System Settings still shows stale shortcut checkbox state after running the script, log out and back in.