-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_once_system_preferences-darwin.sh.tmpl
108 lines (78 loc) · 4.12 KB
/
run_once_system_preferences-darwin.sh.tmpl
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
{{- if (eq .chezmoi.os "darwin") -}}
#!/usr/bin/env bash
# Inspired by https://mths.be/macos with some digging by myself
# to see what still applies in macOS Big Sur
# Close any open System Preferences panes, to prevent them from overriding
# settings we're about to change
osascript -e 'tell application "System Preferences" to quit'
# Ask for the administrator password upfront
sudo -v
# Keep-alive: update existing `sudo` time stamp until `.macos` has finished
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
# ~~~~~ #
# I prefer to disable all "helpers" such as automatic capitalisation and so on
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
# Show me file extensions out of the box
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
# I don't want .DS_Store files on USB devices or network devices
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true
# Column view is my preferred style when using Finder
defaults write com.apple.finder FXPreferredViewStyle "clmv"
# Open Finder to my home directory by default
defaults write com.apple.finder NewWindowTarget -string "PfHm"
defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/"
# Show absolute path in Finder
defaults write com.apple.finder _FXShowPosixPathInTitle -bool true
# Don't try to reopen windows when logging back in / restarting
defaults write com.apple.loginwindow TALLogoutSavesState -bool false
# Disable Quick Note which is set by default on macOS Monterey and above
defaults write com.apple.dock wvous-br-corner -int 0
# Only use Plain Text for TextEdit documents
defaults write com.apple.TextEdit "RichText" -bool false
# Don't try to quarantine downloaded applications
defaults write com.apple.LaunchServices "LSQuarantine" -bool false
# Always save to disk over iCloud
defaults write NSGlobalDomain "NSDocumentSaveNewDocumentsToCloud" -bool false
# Hide thumbnails when taking a screenshot
defaults write com.apple.screencapture "show-thumbnail" -bool false
# Place screenshots in ~/Pictures/Screenshots
defaults write com.apple.screencapture "location" -string "~/Screenshots"
# Don't show recently opened applications in Dock
defaults write com.apple.dock "show-recents" -bool false
# Enable "natural" style scrolling for trackpad gestures
defaults write NSGlobalDomain com.apple.swipescrolldirection -bool true
# Only show scroll bars when scrolling
defaults write NSGlobalDomain "AppleShowScrollBars" -string "WhenScrolling"
# Jump scrollbar to where you click, not just page down a little bit
defaults write NSGlobalDomain "AppleScrollerPagingBehavior" -bool true
# Increase sound quality for Bluetooth headphones/headsets
defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" -int 40
# Show the ~/Library folder if it isn't already visible
if xattr ~/Library | grep com.apple.FinderInfo; then
chflags nohidden ~/Library && xattr -d com.apple.FinderInfo ~/Library
fi
# Autohide Dock
defaults write com.apple.dock "autohide" -bool true
# Set Dock to a relatively small size
defaults write com.apple.dock tilesize -int 30
# Add ability to drag windows with Ctrl + Cmd + <drag>
# https://mmazzarolo.com/blog/2022-04-16-drag-window-by-clicking-anywhere-on-macos/
defaults write -g NSWindowShouldDragOnGesture -bool true
# Enable Developer Tools for some Webviews
defaults write NSGlobalDomain WebKitDeveloperExtras -bool true
defaults write -g WebKitDeveloperExtras -bool YES
# Kill affected applications
for app in "cfprefsd" \
"ControlCenter" \
"Dock" \
"Finder" \
"SystemUIServer"; do
killall "${app}" > /dev/null 2>&1
done
echo "~ system preferences have been configured (some entries might require a restart)"
{{ end -}}