-
Notifications
You must be signed in to change notification settings - Fork 1
/
run_once_after_configure-apps-darwin.sh.tmpl
113 lines (101 loc) · 6.45 KB
/
run_once_after_configure-apps-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
109
110
111
112
113
#!/bin/bash
{{ if (eq .chezmoi.os "darwin") -}}
# ---------------------------------------------------------------------------------------------------------------------
# Amphetamine settings
# ---------------------------------------------------------------------------------------------------------------------
killall Amphetamine
# Start session as soon as Amphetamine starts
defaults write com.if.Amphetamine "Start Session At Launch" -bool true
# ---------------------------------------------------------------------------------------------------------------------
# Docker settings
# ---------------------------------------------------------------------------------------------------------------------
# Disable automatic updates
killall Docker
defaults write com.docker.docker SUAutomaticallyUpdate -bool false
defaults write com.docker.docker SUEnableAutomaticChecks -bool false
open -a Docker
# ---------------------------------------------------------------------------------------------------------------------
# GPG settings
# ---------------------------------------------------------------------------------------------------------------------
gpg-connect-agent reloadagent /bye
# ---------------------------------------------------------------------------------------------------------------------
# Homebrew settings
# ---------------------------------------------------------------------------------------------------------------------
# https://github.com/Homebrew/homebrew-autoupdate/issues/10
mkdir -p ~/Library/LaunchAgents
# https://github.com/Homebrew/homebrew-autoupdate/issues/14
sudo touch ~/Library/LaunchAgents/com.github.domt4.homebrew-autoupdate.plist
sudo chown $(whoami) ~/Library/LaunchAgents/com.github.domt4.homebrew-autoupdate.plist
# Auto-upgrade apps every week
echo "Deleting any autoupdate plist before enabling autoupdate"
brew autoupdate delete && brew autoupdate start 604800 --upgrade
# ---------------------------------------------------------------------------------------------------------------------
# Mail settings
# ---------------------------------------------------------------------------------------------------------------------
killall Mail
# Copy email addresses as `[email protected]` instead of `Foo Bar <[email protected]>` in Mail.app
defaults write com.apple.mail AddressesIncludeNameOnPasteboard -bool false
# ---------------------------------------------------------------------------------------------------------------------
# Moom settings
# ---------------------------------------------------------------------------------------------------------------------
killall Moom
# Disable automatic updates
defaults write com.manytricks.Moom SUEnableAutomaticChecks -bool false
# Run as faceless mode
defaults write com.manytricks.Moom "Application Mode" -int 2
open -a Moom
# ---------------------------------------------------------------------------------------------------------------------
# OneDrive settings
# ---------------------------------------------------------------------------------------------------------------------
# iPhone backups are located in OneDrive
mkdir -p ~/Library/Application\ Support/MobileSync
ln -s ~/Library/CloudStorage/OneDrive-Personal/iPhone\ backup ~/Library/Application\ Support/MobileSync/Backup
# ---------------------------------------------------------------------------------------------------------------------
# Safari settings
# ---------------------------------------------------------------------------------------------------------------------
killall Safari
# Privacy: don’t send search queries to Apple
defaults write com.apple.Safari UniversalSearchEnabled -bool false
defaults write com.apple.Safari SuppressSearchSuggestions -bool true
# Privacy: Enable “Do Not Track”
defaults write com.apple.Safari SendDoNotTrackHTTPHeader -bool true
# Disable AutoFill
defaults write com.apple.Safari AutoFillFromAddressBook -bool false
defaults write com.apple.Safari AutoFillPasswords -bool false
defaults write com.apple.Safari AutoFillCreditCardData -bool false
defaults write com.apple.Safari AutoFillMiscellaneousForms -bool false
# Update extensions automatically
defaults write com.apple.Safari InstallExtensionUpdatesAutomatically -bool true
# ---------------------------------------------------------------------------------------------------------------------
# Terminal settings
# ---------------------------------------------------------------------------------------------------------------------
# Make sure Terminal is using the Basic profile
defaults write com.apple.Terminal "Default Window Settings" -string Basic
defaults write com.apple.Terminal "Startup Window Settings" -string Basic
# Only use UTF-8
defaults write com.apple.terminal StringEncodings -array 4
# Set font preferences
# To get the current font name, use: osascript -e "tell application \"Terminal\" to get the font name of window 1"
osascript -e "tell application \"Terminal\" to set font name of settings set \"Basic\" to \"MesloLGLNerdFontComplete-Regular\""
osascript -e "tell application \"Terminal\" to set font size of settings set \"Basic\" to 18"
# Enable numpad support for Logitech MX Keys
/usr/libexec/PlistBuddy -c "Delete :'Window Settings':Basic:StrictVTKeypad" ~/Library/Preferences/com.apple.Terminal.plist
/usr/libexec/PlistBuddy -c "Add :'Window Settings':Basic:StrictVTKeypad bool false" ~/Library/Preferences/com.apple.Terminal.plist
# https://docs.brew.sh/Shell-Completion#configuring-completions-in-zsh
chmod -R go-w "$(brew --prefix)/share"
# ---------------------------------------------------------------------------------------------------------------------
# TextEdit settings
# ---------------------------------------------------------------------------------------------------------------------
killall TextEdit
# Set default TextEdit document format as plain text
defaults write com.apple.TextEdit "RichText" -bool "false"
# Open and save files as UTF-8
defaults write com.apple.TextEdit PlainTextEncoding -int 4
defaults write com.apple.TextEdit PlainTextEncodingForWrite -int 4
# ---------------------------------------------------------------------------------------------------------------------
# Make chezmoi use Git with SSH
# ---------------------------------------------------------------------------------------------------------------------
cd "{{ .chezmoi.sourceDir }}"
CHEZMOI_SSH_URL=$(git remote get-url origin | sed -Ene's#https://([^/]*)/([^/]*/.*.git)#git@\1:\2#p')
[[ -z $CHEZMOI_SSH_URL ]] || git remote set-url origin $CHEZMOI_SSH_URL
{{ end -}}