diff --git a/.osx b/.osx
index 4c265b9..f1f196d 100755
--- a/.osx
+++ b/.osx
@@ -28,7 +28,6 @@ if [[ $EUID -ne 0 ]]; then
printf "Certain commands will not be run without sudo privileges. To run as root, run the same command prepended with 'sudo', for example: $ sudo $0\n\n" | fold -s -w 80
else
RUN_AS_ROOT=true
- # Update existing `sudo` timestamp until `.osx` has finished
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
fi
@@ -36,189 +35,117 @@ fi
# General UI/UX #
###############################################################################
-# Expand save panel by default
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
-
-# Expand print panel by default
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true
-
-# Save to disk (not to iCloud) by default
defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false
-
-# Automatically quit printer app once the print jobs complete
defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true
-# Restart automatically if the computer freezes
if [[ "$RUN_AS_ROOT" = true ]]; then
systemsetup -setrestartfreeze on
fi
-# Disable smart quotes as they’re annoying when typing code
defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false
-
-# Disable smart dashes as they’re annoying when typing code
defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false
-# Set background to dark-grey color
osascript -e 'tell application "Finder" to set desktop picture to POSIX file "/System/Library/Desktop Pictures/Solid Colors/Stone.png"'
###############################################################################
# Trackpad, mouse, keyboard, Bluetooth accessories, and input #
###############################################################################
-# Trackpad: Haptic feedback (light, silent clicking)
defaults write com.apple.AppleMultitouchTrackpad FirstClickThreshold -int 0
defaults write com.apple.AppleMultitouchTrackpad ActuationStrength -int 0
-# Trackpad: secondary click to bottom-right (requires restart!)
-
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadRightClick -bool true
defaults write com.apple.AppleMultitouchTrackpad TrackpadRightClick -bool true
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadCornerSecondaryClick -int 2
defaults write com.apple.AppleMultitouchTrackpad TrackpadCornerSecondaryClick -int 2
-
defaults write NSGlobalDomain ContextMenuGesture -int 1
-# Set a blazingly fast keyboard repeat rate, and make it happen more quickly.
-# (The KeyRepeat option requires logging out and back in to take effect.)
defaults write NSGlobalDomain InitialKeyRepeat -int 20
defaults write NSGlobalDomain KeyRepeat -int 1
-# Disable auto-correct
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false
###############################################################################
# Screen #
###############################################################################
-# Save screenshots to Downloads folder.
defaults write com.apple.screencapture location -string "${HOME}/Downloads"
-
-# Save screenshots in PNG format (other options: BMP, GIF, JPG, PDF, TIFF)
defaults write com.apple.screencapture type -string "png"
-
-# Disable shadow in screenshots
defaults write com.apple.screencapture disable-shadow -bool true
+###############################################################################
+# Keyboard Shortcuts #
+###############################################################################
+
+# Disable screenshot shortcuts
+defaults write com.apple.symbolichotkeys AppleSymbolicHotKeys -dict-add 28 "enabled"
+defaults write com.apple.symbolichotkeys AppleSymbolicHotKeys -dict-add 29 "enabled"
+defaults write com.apple.symbolichotkeys AppleSymbolicHotKeys -dict-add 30 "enabled"
+defaults write com.apple.symbolichotkeys AppleSymbolicHotKeys -dict-add 31 "enabled"
+
+# Disable Spotlight shortcuts
+defaults write com.apple.symbolichotkeys AppleSymbolicHotKeys -dict-add 64 "enabled"
+defaults write com.apple.symbolichotkeys AppleSymbolicHotKeys -dict-add 65 "enabled"
+
###############################################################################
# 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"
defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/Desktop/"
-# Show icons for hard drives, servers, and removable media on the desktop
defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true
defaults write com.apple.finder ShowHardDrivesOnDesktop -bool true
defaults write com.apple.finder ShowMountedServersOnDesktop -bool true
defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool true
-# Finder: show hidden files by default
-# defaults write com.apple.finder AppleShowAllFiles -bool true
-
-# Finder: show all filename extensions (Set to True to enable)
defaults write NSGlobalDomain AppleShowAllExtensions -bool false
-# Finder: show status bar
defaults write com.apple.finder ShowStatusBar -bool true
-
-# Finder: allow text selection in Quick Look
defaults write com.apple.finder QLEnableTextSelection -bool true
-
-# Display full POSIX path as Finder window title
defaults write com.apple.finder _FXShowPosixPathInTitle -bool true
-
-# When performing a search, search the current folder by default
defaults write com.apple.finder FXDefaultSearchScope -string "SCcf"
-
-# Disable the warning when changing a file extension
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
-# Enable spring loading for directories
defaults write NSGlobalDomain com.apple.springing.enabled -bool true
-
-# Remove the spring loading delay for directories
defaults write NSGlobalDomain com.apple.springing.delay -float 0.1
-# Avoid creating .DS_Store files on network volumes
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
-# Enable snap-to-grid for icons on the desktop and in other icon views
-/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist
-/usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist
-/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist
-
-# Set the size of icons on the desktop and in other icon views
-/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:iconSize 64" ~/Library/Preferences/com.apple.finder.plist
-/usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:iconSize 64" ~/Library/Preferences/com.apple.finder.plist
-/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:iconSize 64" ~/Library/Preferences/com.apple.finder.plist
-
-# Use column view in all Finder windows by default
-# Four-letter codes for the other view modes: `icnv`, `Nlsv`, `clmv`, `Flwv`
-defaults write com.apple.finder FXPreferredViewStyle -string "clmv"
-
-# Show the ~/Library folder
-chflags nohidden ~/Library
-
###############################################################################
-# Dock, Dashboard, and hot corners #
+# Dock #
###############################################################################
-# Set the icon size of Dock items
defaults write com.apple.dock tilesize -int 30
-
-# Speed up Mission Control animations
defaults write com.apple.dock expose-animation-duration -float 0.15
-
-# Make Dock icons of hidden applications translucent
defaults write com.apple.dock showhidden -bool true
-
-# Enable the 'reduce transparency' option. Save GPU cycles.
defaults write com.apple.universalaccess reduceTransparency -bool true
-# Hot corners
-# Possible values:
-# 0: no-op
-# 2: Mission Control
-# 3: Show application windows
-# 4: Desktop
-# 5: Start screen saver
-# 6: Disable screen saver
-# 7: Dashboard
-# 10: Put display to sleep
-# 11: Launchpad
-# 12: Notification Center
-# Bottom right screen corner → Mission Control
defaults write com.apple.dock wvous-br-corner -int 2
defaults write com.apple.dock wvous-br-modifier -int 0
-# Top right screen corner → Put display to sleep
+
defaults write com.apple.dock wvous-tr-corner -int 10
defaults write com.apple.dock wvous-tr-modifier -int 0
-# Bottom left screen corner → Desktop
+
defaults write com.apple.dock wvous-bl-corner -int 4
defaults write com.apple.dock wvous-bl-modifier -int 0
###############################################################################
-# Safari & WebKit #
+# Safari #
###############################################################################
-# Enable the Develop menu and the Web Inspector in Safari
defaults write com.apple.Safari IncludeDevelopMenu -bool true
defaults write com.apple.Safari WebKitDeveloperExtrasEnabledPreferenceKey -bool true
-defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled -bool true
-
-# Add a context menu item for showing the Web Inspector in web views
defaults write NSGlobalDomain WebKitDeveloperExtras -bool true
###############################################################################
# Mail #
###############################################################################
-# Copy email addresses as `foo@example.com` instead of `Foo Bar ` in Mail.app
defaults write com.apple.mail AddressesIncludeNameOnPasteboard -bool false
###############################################################################
@@ -226,12 +153,7 @@ defaults write com.apple.mail AddressesIncludeNameOnPasteboard -bool false
###############################################################################
if [[ "$RUN_AS_ROOT" = true ]]; then
- # Disable Spotlight indexing for any volume that gets mounted and has not yet
- # been indexed before.
- # Use `sudo mdutil -i off "/Volumes/foo"` to stop indexing any volume.
sudo defaults write /.Spotlight-V100/VolumeConfiguration Exclusions -array "/Volumes"
-
- # Restart spotlight
killall mds > /dev/null 2>&1
fi
@@ -239,38 +161,32 @@ fi
# Activity Monitor #
###############################################################################
-# Show the main window when launching Activity Monitor
defaults write com.apple.ActivityMonitor OpenMainWindow -bool true
-
-# Show all processes in Activity Monitor
defaults write com.apple.ActivityMonitor ShowCategory -int 0
###############################################################################
# Messages #
###############################################################################
-# Disable smart quotes as it’s annoying for messages that contain code
defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "automaticQuoteSubstitutionEnabled" -bool false
-
-# Disable continuous spell checking
defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "continuousSpellCheckingEnabled" -bool false
###############################################################################
# App Store #
###############################################################################
-# Disable in-app rating requests from apps downloaded from the App Store.
defaults write com.apple.appstore InAppReviewEnabled -int 0
###############################################################################
# Kill/restart affected applications #
###############################################################################
-# Restart affected applications if `--no-restart` flag is not present.
if [[ ! ($* == *--no-restart*) ]]; then
for app in "cfprefsd" "Dock" "Finder" "Mail" "SystemUIServer" "Terminal"; do
killall "${app}" > /dev/null 2>&1
done
fi
+killall SystemUIServer > /dev/null 2>&1
+
printf "Please log out and log back in to make all settings take effect.\n"