Add macOS defaults

This commit is contained in:
Marley Rae 2024-02-04 15:52:43 -08:00
parent 12e191edb3
commit c040179761
16 changed files with 211 additions and 26 deletions

View file

@ -5,3 +5,6 @@
find "$DOT/os/macos/" -name "*.pref.fish" | while read file
fish -c "$file"
end
killall SystemUIServer &>/dev/null
killall cfprefsd &>/dev/null

View file

@ -0,0 +1,22 @@
#!/usr/bin/env fish
source "$DOT/script/utils.fish"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
print_subtitle "Activity Monitor"
execute "defaults write com.apple.ActivityMonitor OpenMainWindow -bool true" \
"Show the main window on launch"
execute "defaults write com.apple.ActivityMonitor IconType -int 5" \
"Show CPU usage as the dock icon"
execute "defaults write com.apple.ActivityMonitor ShowCategory -int 0" \
"Show all processes"
execute "defaults write com.apple.ActivityMonitor SortColumn -string 'CPUUsage' && \
defaults write com.apple.ActivityMonitor SortDirection -int 0" \
"Sort results by CPU usage"
killall "Activity Monitor" &>/dev/null

View file

@ -18,4 +18,7 @@ execute "defaults write come.apple.SoftwareUpdate AutomaticDownload -int 1" \
execute "defaults write com.apple.SoftwareUpdate CriticalUpdateInstall -int 1" \
"Install system data files and security updates"
execute "defaults write com.apple.SoftwareUpdate ConfigDataInstall -int 1" \
"Automatically download apps purchased on other Macs"
killall "App Store" &>/dev/null

20
os/macos/battery.pref.fish Executable file
View file

@ -0,0 +1,20 @@
#!/usr/bin/env fish
source "$DOT/script/utils.fish"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
execute "sudo pmset -a lidwake 1" \
"Enable lid wakeup"
execute "sudo systemsetup -setrestartfreeze on" \
"Restart automatically if the computer freezes"
execute "sudo pmset -a displaysleep 15" \
"Display sleep after 15 minutes"
execute "sudo pmset -c sleep 30" \
"Machine sleep after 30 minutes while charging"
execute "sudo pmset -b sleep 10" \
"Machine sleep after 10 minutes on battery"

View file

@ -6,6 +6,15 @@ source "$DOT/script/utils.fish"
print_subtitle Dock
execute "defaults write com.apple.dock tilesize -int 50" \
"Set icon size"
execute "defaults write com.apple.dock magnification -bool true" \
"Enable magnification"
execute "defaults write com.apple.dock largesize -int 75" \
"Set magnification icon size"
execute "defaults write com.apple.dock autohide -bool true" \
"Automatically hide/show the dock"
@ -27,4 +36,34 @@ execute "defaults write com.apple.dock mru-spaces -bool false" \
execute "defaults write com.apple.dock show-recents -bool false" \
"Do not show recent applications in dock"
execute "defaults write com.apple.dock show-process-indicators -bool true" \
"Show indicator lights for open applications"
execute "defaults write com.apple.dashboard mcx-disabled -bool false" \
"Disable dashboard"
execute "defaults write com.apple.dock dashboard-in-overlay -bool true" \
"Don't show dashboard as a space"
execute "defaults write com.apple.dock showhidden -bool true" \
"Show hidden applications in dock"
print_subtitle "Hot Corners"
execute "defaults write com.apple.dock wvous-tl-corner -int 4 && \
defaults write com.apple.dock wvous-tl-modifier -int 0" \
"Set top left corner -> show desktop"
execute "defaults write com.apple.dock wvous-bl-corner -int 11 && \
defaults write com.apple.dock wvous-bl-modifier -int 0" \
"Set bottom left corner -> show launchpad"
execute "defaults write com.apple.dock wvous-tr-corner -int 0 && \
defaults write com.apple.dock wvous-tr-modifier -int 0" \
"Set top right corner -> do nothing"
execute "defaults write com.apple.dock wvous-br-corner -int 0 && \
defaults write com.apple.dock wvous-br-modifier -int 0" \
"Set bottom right corner -> do nothing"
killall Dock &>/dev/null

View file

@ -6,6 +6,10 @@ source "$DOT/script/utils.fish"
print_subtitle Finder
execute "defaults write com.apple.finder NewWindowTarget -string 'PfHm' && \
defaults write com.apple.finder NewWindowTargetPath -string 'file:///Users/marley/'" \
"Set ~ as the default location for new Finder windows"
execute "defaults write com.apple.finder _FXShowPosixPathInTitle -bool true" \
"Use full POSIX path as window title"
@ -39,10 +43,24 @@ execute "defaults write com.apple.finder FXRemoveOldTrashItems -bool true" \
execute "defaults write com.apple.universalaccess showWindowTitlebarIcons -bool true" \
"Show folder icons in the title bar"
execute "defaults write com.apple.finder FXPreferredViewStyle -string 'icnv'" \
"Use icon view by default"
execute "/usr/libexec/PlistBuddy -c 'Set :DesktopViewSettings:IconViewSettings:arrangeBy name' ~/Library/Preferences/com.apple.finder.plist && \
/usr/libexec/PlistBuddy -c 'Set :FK_StandardViewSettings:IconViewSettings:arrangeBy name' ~/Library/Preferences/com.apple.finder.plist && \
/usr/libexec/PlistBuddy -c 'Set :StandardViewSettings:IconViewSettings:arrangeBy name' ~/Library/Preferences/com.apple.finder.plist" \
"Set sort method"
execute "defaults write -g com.apple.springing.enabled -bool true" \
"Enable spring loading for directories"
execute "defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true && \
defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true" \
"Don't create .DS_Store files on network or USB volumes"
execute "defaults write com.apple.frameworks.diskimages auto-open-ro-root -bool false && \
defaults write com.apple.frameworks.diskimages auto-open-rw-root -bool false && \
defaults write com.apple.finder OpenWindowForNewRemoveableDisk -bool true" \
"Don't automatically open a Finder window when a volume is mounted"
killall Finder &>/dev/null
killall cfprefsd &>/dev/null

View file

@ -4,7 +4,7 @@ source "$DOT/script/utils.fish"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
print_subtitle Trackpad
print_subtitle "Input Devices"
execute "defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true && \
@ -20,3 +20,16 @@ execute "defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Track
defaults write com.apple.AppleMultitouchTrackpad TrackpadCornerSecondaryClick -int 0 && \
defaults -currentHost write -g com.apple.trackpad.trackpadCornerClickBehavior -int 0" \
"Map 'click or tap with two fingers' to the secondary click"
execute "defaults write -g AppleKeyboardUIMode -int 3" \
"Allow tab-to-navigate in all windows"
execute "defaults write com.apple.HIToolbox AppleFnUsageType -int 2" \
"Remap the emoji picker to the Fn key"
execute "defaults write com.apple.universalaccess closeViewScrollWheelToggle -bool true && \
defaults write com.apple.universalaccess HIDScrollZoomModifierMask -int 262144" \
"Use <ctrl-scroll> to zoom"
execute "defaults write com.apple.universalaccess closeViewZoomFollowsFocus -bool true" \
"Follow the keyboard focus while zoomed in"

View file

@ -1,19 +0,0 @@
#!/usr/bin/env fish
source "$DOT/script/utils.fish"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
print_subtitle Keyboard
execute "defaults write -g AppleKeyboardUIMode -int 3" \
"Enable full keyboard access for all controls"
execute "defaults write NSGlobalDomain NSAutomaticCapitalizationEnabled -bool false" \
"Disable automatic capitalization"
execute "defaults write -g NSAutomaticSpellingCorrectionEnabled -bool false" \
"Disable automatic correction"
execute "defaults write com.apple.HIToolbox AppleFnUsageType -int 2" \
"Remap the emoji picker to the Fn key"

View file

@ -9,5 +9,14 @@ print_subtitle "Language & Region"
execute "defaults write -g AppleLanguages -array 'en'" \
"Set language"
execute "defaults write -g AppleLocale -string 'en_US@currency=USD'" \
"Set currency"
execute "defaults write -g AppleMeasurementUnits -string 'Inches'" \
"Set measurement unit"
execute "defaults write -g AppleMetricUnits -bool false" \
"Use imperial measurement system"
execute "defaults write -g AppleICUDateFormatStrings -dict 2 'd MMM y' 3 'd MMMM y' 4 'EEEE, d MMMM y'" \
"Set date formats"

View file

@ -9,5 +9,4 @@ print_subtitle Photos
execute "defaults -currentHost write com.apple.ImageCapture disableHotPlug -bool true" \
"Prevent Photos from opening automatically when devices are plugged in"
killall Photos &>/dev/null

View file

@ -10,4 +10,7 @@ execute "defaults write com.apple.Safari SuppressSearchSuggestions -bool true &&
defaults write com.apple.Safari UniversalSearchEnabled -bool false" \
"Dont send search queries to Apple"
execute "defaults write com.apple.Safari SendDoNotTrackHTTPHeader -bool true" \
"Enable 'Do Not Track'"
killall Safari &>/dev/null

View file

@ -8,3 +8,7 @@ print_subtitle "Security & Privacy"
execute "defaults write com.apple.AdLib allowApplePersonalizedAdvertising -int 0" \
"Disable personalized ads"
execute "defaults write com.apple.screensaver askForPassword -int 1 && \
defaults write com.apple.screensaver askForPasswordDelay -int 0" \
"Require password immediately after sleep or screensaver begins"

40
os/macos/spotlight.pref.fish Executable file
View file

@ -0,0 +1,40 @@
#!/usr/bin/env fish
source "$DOT/script/utils.fish"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
print_subtitle Spotlight
execute "defaults write com.apple.spotlight orderedItems -array \
'{\"enabled\" = 1;\"name\" = \"APPLICATIONS\";}' \
'{\"enabled\" = 1;\"name\" = \"SYSTEM_PREFS\";}' \
'{\"enabled\" = 1;\"name\" = \"DIRECTORIES\";}' \
'{\"enabled\" = 1;\"name\" = \"PDF\";}' \
'{\"enabled\" = 1;\"name\" = \"FONTS\";}' \
'{\"enabled\" = 1;\"name\" = \"DOCUMENTS\";}' \
'{\"enabled\" = 1;\"name\" = \"MESSAGES\";}' \
'{\"enabled\" = 1;\"name\" = \"CONTACT\";}' \
'{\"enabled\" = 0;\"name\" = \"EVENT_TODO\";}' \
'{\"enabled\" = 0;\"name\" = \"IMAGES\";}' \
'{\"enabled\" = 0;\"name\" = \"BOOKMARKS\";}' \
'{\"enabled\" = 0;\"name\" = \"MUSIC\";}' \
'{\"enabled\" = 0;\"name\" = \"MOVIES\";}' \
'{\"enabled\" = 0;\"name\" = \"PRESENTATIONS\";}' \
'{\"enabled\" = 0;\"name\" = \"SPREADSHEETS\";}' \
'{\"enabled\" = 0;\"name\" = \"SOURCE\";}' \
'{\"enabled\" = 1;\"name\" = \"MENU_DEFINITION\";}' \
'{\"enabled\" = 0;\"name\" = \"MENU_OTHER\";}' \
'{\"enabled\" = 1;\"name\" = \"MENU_CONVERSION\";}' \
'{\"enabled\" = 1;\"name\" = \"MENU_EXPRESSION\";}' \
'{\"enabled\" = 0;\"name\" = \"MENU_WEBSEARCH\";}' \
'{\"enabled\" = 0;\"name\" = \"MENU_SPOTLIGHT_SUGGESTIONS\";}'" \
"Customize Spotlight search categories"
killall mds &>/dev/null
# Make sure indexing is enabled for the main volume.
sudo mdutil -i on / >/dev/null
# Rebuild index from scratch.
sudo mdutil -E / >/dev/null

View file

@ -7,6 +7,11 @@ source "$DOT/script/utils.fish"
print_subtitle Terminal
if ! grep -q "pam_tid.so" "/etc/pam.d/sudo"
execute "sudo sh -c 'echo \"auth sufficient pam_tid.so\" >> /etc/pam.d/sudo'" \
execute "sudo sh -c 'echo \"auth sufficient pam_tid.so\" >> /etc/pam.d/sudo'"
"Use Touch ID to authenticate sudo"
end
execute "defaults write com.apple.terminal StringEncodings -array 4" \
"Only use UTF-8 encoding"
killall Terminal &>/dev/null

8
os/macos/timemachine.pref.fish Executable file
View file

@ -0,0 +1,8 @@
#!/usr/bin/env fish
source "$DOT/script/utils.fish"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
execute "defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true" \
"Do not ask to use new hard drives as a backup volume"

View file

@ -6,6 +6,12 @@ source "$DOT/script/utils.fish"
print_subtitle "UI & UX"
execute "defaults write -g AppleAccentColor -int 6" \
"Set accent color to pink"
execute "defaults write -g AppleHighlightColor -string '1.000000 0.749020 0.823529 Pink'" \
"Set highlight color to pink"
execute "defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true && \
defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true" \
"Avoid creating '.DS_Store' files on network or USB volumes"
@ -28,7 +34,19 @@ execute "defaults write com.apple.screencapture type -string 'png'" \
execute "defaults write -g AppleFontSmoothing -int 2" \
"Enable subpixel font rendering on non-Apple LCDs"
execute "defaults write -g NSNavPanelExpandedStateForSaveMode -bool true" \
execute "defaults write -g NSNavPanelExpandedStateForSaveMode -bool true; \
defaults write -g NSNavPanelExpandedStateForSaveMode2 -bool true" \
"Expand save panel by default"
killall SystemUIServer &>/dev/null
execute "defaults write -g PMPrintingExpandedStateForPrint -bool true && \
defaults write -g PMPrintingExpandedStateForPrint2 -bool true" \
"Expand print panel by default"
execute "defaults write com.apple.print.PrintingPrefs 'Quit When Finished' -bool true" \
"Automatically quite printer app once print jobs complete"
execute "defaults write -g NSAutomaticCapitalizationEnabled -bool false" \
"Disable automatic capitalization"
execute "defaults write -g NSAutomaticSpellingCorrectionEnabled -bool false" \
"Disable automatic spelling correction"