feat: install script re-org
This commit is contained in:
181
install.d/90-macos.sh
Executable file
181
install.d/90-macos.sh
Executable file
@@ -0,0 +1,181 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Description:
|
||||
# (macOS only) Configure defaults
|
||||
#
|
||||
|
||||
# macOS only
|
||||
[[ "$DOTS_OS" != "macos" ]] && { log_skip "Not macOS"; return 0; }
|
||||
|
||||
# Keyboard
|
||||
# --------
|
||||
# off -- Keyboard: Capitalize words automatically
|
||||
defaults write -globalDomain NSAutomaticCapitalizationEnabled -bool false
|
||||
|
||||
# off -- Keyboard: Add period with double-space
|
||||
defaults write -globalDomain NSAutomaticPeriodSubstitutionEnabled -bool false
|
||||
|
||||
# off -- Keyboard: Quote substitution
|
||||
defaults write -globalDomain NSAutomaticQuoteSubstitutionEnabled -bool false
|
||||
|
||||
# off -- Keyboard: Dash substitution
|
||||
defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false
|
||||
|
||||
# off -- Keyboard: Auto-correct
|
||||
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false
|
||||
defaults write NSGlobalDomain WebAutomaticSpellingCorrectionEnabled -bool false
|
||||
|
||||
# Appearance
|
||||
# ----------
|
||||
# Graphite -- Appearance (prevent top-left window colours)
|
||||
defaults write -globalDomain AppleAquaColorVariant -int 6
|
||||
|
||||
# on -- Appearance: Dark mode
|
||||
defaults write -globalDomain AppleInterfaceStyle -string "Dark"
|
||||
|
||||
# #2CB494 -- Highlight color
|
||||
defaults write -globalDomain AppleHighlightColor -string "0.172549 0.705882 0.580392"
|
||||
|
||||
# Control Center
|
||||
# --------------
|
||||
# off -- Control Center: Show Bluetooth icon in menu bar
|
||||
defaults write \
|
||||
~/Library/Preferences/ByHost/com.apple.controlcenter.plist \
|
||||
Bluetooth \
|
||||
-int 24
|
||||
|
||||
# off -- Control Center: Show Wi-Fi icon in menu bar
|
||||
defaults write \
|
||||
~/Library/Preferences/ByHost/com.apple.controlcenter.plist \
|
||||
WiFi \
|
||||
-int 24
|
||||
|
||||
# off -- Control Center: Show Now Playing icon in menu bar
|
||||
defaults write \
|
||||
~/Library/Preferences/ByHost/com.apple.controlcenter.plist \
|
||||
NowPlaying \
|
||||
-int 24
|
||||
|
||||
# off -- Control Center: Show Battery icon in menu bar
|
||||
defaults write \
|
||||
~/Library/Preferences/ByHost/com.apple.controlcenter.plist \
|
||||
Battery \
|
||||
-int 24
|
||||
|
||||
# Finder
|
||||
# ------
|
||||
# on -- Finder: Add quit option
|
||||
defaults write com.apple.finder QuitMenuItem -bool true
|
||||
|
||||
# on -- Finder: Show hidden files
|
||||
defaults write com.apple.finder AppleShowAllFiles -bool true
|
||||
|
||||
# on -- Finder: Show all filename extensions
|
||||
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
|
||||
|
||||
# off -- Finder: Show warning before changing an extension
|
||||
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
|
||||
|
||||
# on -- Finder: Show path bar
|
||||
defaults write com.apple.finder ShowPathbar -bool true
|
||||
|
||||
# on -- Finder: Show status bar
|
||||
defaults write com.apple.finder ShowStatusBar -bool true
|
||||
|
||||
# on -- Finder: Keep folders on top
|
||||
defaults write com.apple.finder _FXSortFoldersFirst -bool true
|
||||
|
||||
# off -- Finder: Use macOS Crash Reporter
|
||||
defaults write com.apple.CrashReporter DialogType -string "none"
|
||||
|
||||
# off -- Finder: Enable dashboard widgets
|
||||
defaults write com.apple.dashboard mcx-disabled -bool true
|
||||
|
||||
# on -- Finder: Show hard drives on desktop
|
||||
defaults write com.apple.finder ShowHardDrivesOnDesktop -bool true
|
||||
|
||||
# on -- Finder: Show external hard drives on desktop
|
||||
defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true
|
||||
|
||||
# on -- Finder: Show removable media on desktop
|
||||
defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool true
|
||||
|
||||
# on -- Finder: Show mounted servers on desktop
|
||||
defaults write com.apple.finder ShowMountedServersOnDesktop -bool true
|
||||
|
||||
# off -- Finder: Show recent tags
|
||||
defaults write com.apple.finder ShowRecentTags -bool false
|
||||
|
||||
# off -- Finder: Create .DS_Store files
|
||||
defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true
|
||||
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
|
||||
|
||||
# home -- Finder: New Finder windows show
|
||||
defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/"
|
||||
|
||||
# list -- Finder: Preferred view style
|
||||
defaults write com.apple.finder FXPreferredViewStyle -string "nlsv"
|
||||
|
||||
# Spotlight
|
||||
# ---------
|
||||
# on -- Spotlight: Hide menu bar icon
|
||||
defaults write com.apple.Spotlight MenuItemHidden -int 1
|
||||
|
||||
# Dock
|
||||
# ----
|
||||
# off -- Dock: Show recent applications
|
||||
defaults write com.apple.dock show-recents -bool false
|
||||
|
||||
# on -- Dock: Use scroll gestures
|
||||
defaults write com.apple.dock scroll-to-open -bool true
|
||||
|
||||
# Remove default apps from the dock
|
||||
default_apps=(
|
||||
"Messages"
|
||||
"Mail"
|
||||
"Maps"
|
||||
"Photos"
|
||||
"FaceTime"
|
||||
"Calendar"
|
||||
"Contacts"
|
||||
"Reminders"
|
||||
"Freeform"
|
||||
"TV"
|
||||
"Music"
|
||||
"News"
|
||||
"Keynote"
|
||||
"Numbers"
|
||||
"Pages"
|
||||
)
|
||||
for default_app in "${default_apps[@]}"; do
|
||||
dockutil --remove "$default_app" --no-restart 1>/dev/null 2>&1 || true
|
||||
done
|
||||
|
||||
# Set up apps in the dock
|
||||
dock_order=(
|
||||
"/System/Library/CoreServices/Finder.app" # Cannot be moved
|
||||
"/System/Applications/App Store.app"
|
||||
"/System/Applications/Apps.app"
|
||||
"/System/Applications/System Settings.app"
|
||||
"/System/Applications/Utilities/Activity Monitor.app"
|
||||
"/Applications/iTerm.app"
|
||||
)
|
||||
dock_state=$(defaults read com.apple.dock persistent-apps 2>/dev/null || echo "")
|
||||
for i in "${!dock_order[@]}"; do
|
||||
if [[ $i -ne 0 ]]; then
|
||||
path="${dock_order[$i]}"
|
||||
name=$(basename "$path" | sed 's/\.app$//')
|
||||
if [[ $dock_state == *"$name"* ]]; then
|
||||
dockutil --move "${path}" --position "$i" --no-restart 2>/dev/null || true
|
||||
else
|
||||
dockutil --add "${path}" --position "$i" --no-restart 2>/dev/null || true
|
||||
fi
|
||||
fi
|
||||
done
|
||||
if [[ ! $dock_state == *"spacer"* ]]; then
|
||||
dockutil --add '' --type spacer --section apps --position "${#dock_order[@]}" --no-restart 2>/dev/null || true
|
||||
fi
|
||||
|
||||
log_info "Restart Finder/Dock to apply: osascript -e 'quit app \"Finder\"'"
|
||||
log_pass "macOS defaults configured"
|
||||
Reference in New Issue
Block a user