-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.macos
More file actions
executable file
·108 lines (92 loc) · 4.78 KB
/
Copy path.macos
File metadata and controls
executable file
·108 lines (92 loc) · 4.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#!/usr/bin/env bash
set -euo pipefail
# Minimal, modern macOS defaults
log() { printf -- "--> %s\n" "$*"; }
macos_major() {
sw_vers -productVersion | awk -F. '{print $1}'
}
MAJOR="$(macos_major)"
log "Detected macOS major version: ${MAJOR}"
# Dark mode
defaults write NSGlobalDomain AppleInterfaceStyle -string "Dark"
# Save to disk by default, instead of iCloud
defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false
# Finder
log "Configuring Finder preferences"
defaults write com.apple.finder AppleShowAllFiles -bool true
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
defaults write NSGlobalDomain AppleWindowTabbingMode -string "always"
defaults write com.apple.finder ShowPathbar -bool true
defaults write com.apple.finder ShowStatusBar -bool true
defaults write com.apple.finder _FXSortFoldersFirst -bool true
defaults write com.apple.finder FXDefaultSearchScope -string "SCcf" # Search current folder by default
defaults write com.apple.finder FXEnableExtensionsChangeWarning -bool false
chflags nohidden "$HOME/Library" 2>/dev/null || true
# Dock
log "Configuring Dock"
defaults write com.apple.dock autohide -bool true
defaults write com.apple.dock mineffect -string "genie"
defaults write com.apple.dock minimize-to-application -bool true
defaults write com.apple.dock persistent-apps -array
defaults write com.apple.dock expose-group-by-app -bool true
defaults write com.apple.dashboard mcx-disabled -bool true
defaults write com.apple.dock dashboard-in-overlay -bool true
defaults write com.apple.dock mru-spaces -bool false
defaults write com.apple.dock autohide-delay -float 0
defaults write com.apple.dock show-recents -bool false
defaults write com.apple.dock tilesize -int 64
# Keyboard
log "Configuring keyboard and input"
defaults write NSGlobalDomain KeyRepeat -int 2
defaults write NSGlobalDomain InitialKeyRepeat -int 15
defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false
defaults write NSGlobalDomain NSAutomaticCapitalizationEnabled -bool false
defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false
defaults write NSGlobalDomain NSAutomaticPeriodSubstitutionEnabled -bool false
defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false
defaults write NSGlobalDomain AppleKeyboardUIMode -int 3 # keyboard navigation between control elements
# Trackpad: tap to click
defaults write com.apple.AppleMultitouchTrackpad Clicking -bool true 2>/dev/null || true
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true 2>/dev/null || true
# Screenshots
log "Configuring screenshots"
SCREENSHOT_DIR="$HOME/Desktop/Screenshots"
mkdir -p "$SCREENSHOT_DIR"
defaults write com.apple.screencapture location -string "$SCREENSHOT_DIR"
defaults write com.apple.screencapture type -string "png"
defaults write com.apple.screencapture disable-shadow -bool true
# Desktop services: avoid .DS_Store on network/USB
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true
# Spotlight
log "Configuring Spotlight"
SPOTLIGHT_ENABLED=("APPLICATIONS" "SYSTEM_PREFS")
SPOTLIGHT_ALL=(APPLICATIONS MENU_EXPRESSION CONTACT MENU_CONVERSION MENU_DEFINITION \
SOURCE DOCUMENTS EVENT_TODO DIRECTORIES FONTS IMAGES MESSAGES \
MOVIES MUSIC MENU_OTHER PDF PRESENTATIONS MENU_SPOTLIGHT_SUGGESTIONS \
SPREADSHEETS SYSTEM_PREFS TIPS BOOKMARKS)
SPOTLIGHT_PLIST="<array>"
for name in "${SPOTLIGHT_ALL[@]}"; do
state=0
for e in "${SPOTLIGHT_ENABLED[@]}"; do [ "$name" = "$e" ] && state=1; done
SPOTLIGHT_PLIST+="<dict><key>enabled</key><integer>${state}</integer><key>name</key><string>${name}</string></dict>"
done
SPOTLIGHT_PLIST+="</array>"
defaults write com.apple.Spotlight orderedItems "$SPOTLIGHT_PLIST"
defaults write com.apple.controlcenter "NSStatusItem Visible Spotlight" -bool false
/usr/libexec/PlistBuddy -c "Set :AppleSymbolicHotKeys:64:enabled false" "$HOME/Library/Preferences/com.apple.symbolichotkeys.plist" || true
/usr/libexec/PlistBuddy -c "Set :AppleSymbolicHotKeys:65:enabled false" "$HOME/Library/Preferences/com.apple.symbolichotkeys.plist" || true
log "Note: manually add \$HOME to System Settings > Spotlight > Search Privacy (SIP blocks scripting it)"
# Display sleep timers
log "Configuring power management (display sleep)"
# 5 minutes on battery, 10 minutes when plugged in
sudo pmset -b displaysleep 5 || true
sudo pmset -c displaysleep 10 || true
# Apply changes
log "Restarting affected services"
killall Finder 2>/dev/null || true
killall Dock 2>/dev/null || true
killall SystemUIServer 2>/dev/null || true
killall cfprefsd 2>/dev/null || true
log "Done. Some changes may require logout/restart to fully apply."