chore(shell): make everything bit faster

This commit is contained in:
2023-09-27 10:38:10 +03:00
parent 6f854ddbfd
commit a87b33b8c2
18 changed files with 159 additions and 109 deletions

View File

@@ -8,6 +8,11 @@
[ "$(uname)" != "Darwin" ] && echo "Not a macOS system" && exit 0
# shellcheck source=shared.sh
source "$HOME/.dotfiles/scripts/shared.sh"
msg_run "Starting to set macOS defaults, these require sudo privileges:"
# Ask for the administrator password upfront
sudo -v
@@ -19,6 +24,8 @@ while true; do
kill -0 "$$" || exit
done 2> /dev/null &
msg_nested "Change user shell to zsh if it is available and not the current"
# Change user shell to zsh if not that already.
if hash zsh 2> /dev/null; then
[[ "$SHELL" != $(which zsh) ]] && chsh -s "$(which zsh)"
@@ -28,6 +35,8 @@ fi
# General UI/UX #
###############################################################################
msg_nested "Setting General UI/UX settings"
# Disable the sound effects on boot
sudo nvram SystemAudioVolume=" "
@@ -80,6 +89,8 @@ defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false
# SSD-specific tweaks #
###############################################################################
msg_nested "Setting SSD-specific tweaks"
# Disable hibernation (speeds up entering sleep mode)
sudo pmset -a hibernatemode 0
@@ -90,6 +101,8 @@ sudo pmset -a sms 0
# Trackpad, mouse, keyboard, Bluetooth accessories, and input #
###############################################################################
msg_nested "Settings for Trackpad, mouse, keyboard, Bluetooth accessories, and input"
# Increase sound quality for Bluetooth headphones/headsets
defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Max (editable)" 80
defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" 80
@@ -124,6 +137,8 @@ defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false
# Screen #
###############################################################################
msg_nested "Settings for Screen"
# Require password immediately after sleep or screen saver begins
defaults write com.apple.screensaver askForPassword -int 1
defaults write com.apple.screensaver askForPasswordDelay -int 0
@@ -132,6 +147,8 @@ defaults write com.apple.screensaver askForPasswordDelay -int 0
# Finder #
###############################################################################
msg_nested "Settings for Finder"
# Set Desktop as the default location for new Finder windows
# For other paths, use `PfLo` and `file:///full/path/here/`
defaults write com.apple.finder NewWindowTarget -string "PfDe"
@@ -190,6 +207,8 @@ defaults write com.apple.finder FXInfoPanesExpanded -dict \
# Screenshots #
###############################################################################
msg_nested "Settings for Screenshots"
# Set default screenshot location
mkdir -p "$HOME/Documents/Screenshots"
defaults write com.apple.screencapture "location" -string "$HOME/Documents/Screenshots"
@@ -204,6 +223,8 @@ defaults write com.apple.screencapture "name" -string "screenshot"
# Dock, Dashboard, and hot corners #
###############################################################################
msg_nested "Settings for Dock, Dashboard, and hot corners"
# Prevent applications from bouncing in Dock
defaults write com.apple.dock no-bouncing -bool true
@@ -234,6 +255,8 @@ defaults write com.apple.dock showhidden -bool true
# Safari & WebKit #
###############################################################################
msg_nested "Settings for Safari & WebKit"
# Enable Safaris debug menu
defaults write com.apple.Safari IncludeInternalDebugMenu -bool true
@@ -258,6 +281,8 @@ defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true
# Activity Monitor #
###############################################################################
msg_nested "Settings for ActivityMonitor"
# Show the main window when launching Activity Monitor
defaults write com.apple.ActivityMonitor OpenMainWindow -bool true
@@ -275,6 +300,8 @@ defaults write com.apple.ActivityMonitor SortDirection -int 0
# Address Book, Dashboard, iCal, TextEdit, and Disk Utility #
###############################################################################
msg_nested "Settings for Address Book, Dashboard, iCal, TextEdit, and Disk Utility"
# Use plain text mode for new TextEdit documents
defaults write com.apple.TextEdit RichText -int 0
@@ -286,6 +313,8 @@ defaults write com.apple.TextEdit PlainTextEncodingForWrite -int 4
# Messages #
###############################################################################
msg_nested "Settings for Messages"
# Disable smart quotes as its annoying for messages that contain code
defaults write com.apple.messageshelper.MessageController \
SOInputLineSettings \
@@ -298,6 +327,8 @@ defaults write com.apple.messageshelper.MessageController \
-dict-add "continuousSpellCheckingEnabled" \
-bool false
msg_nested "Restarting applications to apply changes"
###############################################################################
# Kill affected applications #
###############################################################################
@@ -307,4 +338,5 @@ for app in "Activity Monitor" "Address Book" "Calendar" "Contacts" "cfprefsd" \
"Terminal" "Transmission" "Twitter" "iCal"; do
killall "${app}" > /dev/null 2>&1
done
echo "Done. Note that some of these changes require a logout/restart to take effect."
msg_yay "Done. Note that some of these changes require a logout/restart to take effect."