Improve macOS defaults

This commit is contained in:
Billy-George Price-Sprackland
2026-05-16 23:34:09 +01:00
parent 482148b900
commit c37c58cb78
2 changed files with 58 additions and 9 deletions
Vendored
+35 -9
View File
@@ -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}" "<dict><key>enabled</key><${enabled}/><key>value</key><dict><key>parameters</key><array><integer>${key_char}</integer><integer>${key_code}</integer><integer>${modifiers}</integer></array><key>type</key><string>standard</string></dict></dict>"
# 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 "<dict><key>enabled</key><false/><key>value</key><dict><key>parameters</key><array><integer>51</integer><integer>20</integer><integer>1179648</integer></array><key>type</key><string>standard</string></dict></dict>"
defaults write com.apple.symbolichotkeys AppleSymbolicHotKeys -dict-add 29 "<dict><key>enabled</key><true/><key>value</key><dict><key>parameters</key><array><integer>51</integer><integer>20</integer><integer>1441792</integer></array><key>type</key><string>standard</string></dict></dict>"
defaults write com.apple.symbolichotkeys AppleSymbolicHotKeys -dict-add 30 "<dict><key>enabled</key><true/><key>value</key><dict><key>parameters</key><array><integer>52</integer><integer>21</integer><integer>1179648</integer></array><key>type</key><string>standard</string></dict></dict>"
defaults write com.apple.symbolichotkeys AppleSymbolicHotKeys -dict-add 31 "<dict><key>enabled</key><false/><key>value</key><dict><key>parameters</key><array><integer>52</integer><integer>21</integer><integer>1441792</integer></array><key>type</key><string>standard</string></dict></dict>"
defaults write com.apple.symbolichotkeys AppleSymbolicHotKeys -dict-add 184 "<dict><key>enabled</key><false/><key>value</key><dict><key>parameters</key><array><integer>53</integer><integer>23</integer><integer>1179648</integer></array><key>type</key><string>standard</string></dict></dict>"
# 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 "<dict><key>enabled</key><false/><key>value</key><dict><key>parameters</key><array><integer>32</integer><integer>49</integer><integer>1048576</integer></array><key>type</key><string>standard</string></dict></dict>"
defaults write com.apple.symbolichotkeys AppleSymbolicHotKeys -dict-add 65 "<dict><key>enabled</key><false/><key>value</key><dict><key>parameters</key><array><integer>32</integer><integer>49</integer><integer>1572864</integer></array><key>type</key><string>standard</string></dict></dict>"
# 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