From 2c348ec9041c341bf512947082e543a8c5e690bf Mon Sep 17 00:00:00 2001 From: Clayton Parker Date: Wed, 31 Jul 2024 14:21:20 -0400 Subject: [PATCH] attempt to set up macos with my preferred defaults --- create_links.sh | 8 +++++ macos_defaults.sh | 86 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 94 insertions(+) create mode 100755 macos_defaults.sh diff --git a/create_links.sh b/create_links.sh index 766dc37..4d260b7 100755 --- a/create_links.sh +++ b/create_links.sh @@ -307,5 +307,13 @@ if [ ! -d "$HOME/work" ]; then chmod 700 "$HOME/work" fi +if [ $(defaults read -g com.apple.swipescrolldirection) -eq 1 ]; then + "$HOME"/.dotfiles/macos_defaults.sh + echo + echo "Setting up macos defaults since natural scrolling was on" + echo "Some settings may require a reboot / or logout" + echo +fi + # Set up zi / zplugin / zinit sh -c "$(curl -fsSL https://git.io/get-zi)" -- -i skip diff --git a/macos_defaults.sh b/macos_defaults.sh new file mode 100755 index 0000000..dd1c74a --- /dev/null +++ b/macos_defaults.sh @@ -0,0 +1,86 @@ +#!/usr/bin/env bash +set -eo pipefail + +usage() { + cat << EOF +usage: $0 + +OPTIONS: + -d Set debug mode + -h Show this message +EOF +} + +while getopts "hd" OPTION +do + case $OPTION in + d) + set -x + ;; + h) + usage + exit 0 + ;; + ?) + usage + exit 1 + ;; + esac +done + +# TODO list +# - Turn off all prediction and autocorrect when typing (Accessibility -> zoom -> use scroll gesture with keyboard shortcut) +# - Enable zoom with keyboard shortcut (keyboard -> Text input -> input sources -> edit) +# - Trackpad tap to click (trackpad -> point & click -> tap to click) +# - Trackpad secondary click with two fingers (trackpad -> point & click -> secondary click) + +# Turn off natural scrolling +defaults write -g com.apple.swipescrolldirection -bool false + +# Speed up key repeats +defaults write -g InitialKeyRepeat -int 25 +defaults write -g KeyRepeat -int 2 +# Disable popup menu when holding down key +defaults write -g "ApplePressAndHoldEnabled" -bool "false" + +# Expand save panel by default +defaults write -g NSNavPanelExpandedStateForSaveMode -bool true + +# Expand print panel by default +defaults write -g PMPrintingExpandedStateForPrint -bool true + +# Disable the "Are you sure you want to open this application?" dialog. Yes I am sure. +defaults write com.apple.LaunchServices LSQuarantine -bool false + +# Finder in column mode by default +defaults write com.apple.finder "FXPreferredViewStyle" -string "clmv" +# Don't warn when changing file suffix +defaults write com.apple.finder "FXEnableExtensionChangeWarning" -bool "false" + +# Make the dock smaller and hide it +defaults write com.apple.dock "tilesize" -int "36" +defaults write com.apple.dock "autohide" -bool "true" + +# Set the screenshots dir to a folder on the desktop +if [ ! -d "$HOME/Desktop/screenshots" ]; then + mkdir "$HOME"/Desktop/screenshots +fi +defaults write com.apple.screencapture "location" -string "~/Desktop/screenshots" +# Don't show the thumbnail after taking it +defaults write com.apple.screencapture "show-thumbnail" -bool "false" + +# Set the regional time / data settings +# TODO: this doesn't work +# defaults write -g AppleFirstWeekday "{ gregorian = 2; }" + +# Kill affected applications +APPS=( + SystemUIServer + Finder + Dock + Calendar +) + +for APP in "${APPS[@]}"; do + killall "$APP" &>/dev/null || true +done