From 325f62f2aa84e9186ab446e2c1a81d7e56456ade Mon Sep 17 00:00:00 2001 From: Ein Verne Date: Sun, 19 Jul 2020 11:00:39 +0800 Subject: [PATCH] Add mac initial setup (#2) --- .github/workflows/setup.yml | 13 ++ .vim/startup/vundle_vimrc | 2 +- .zshrc | 6 +- Brewfile | 116 +++++++++++++++++ README.md | 6 + bootstrap.sh | 77 ++++++++++++ brew.sh | 39 ++++++ curl.cmd | 12 -- git/global.gitconfig | 123 ++++++++++++++++++ git/work.gitconfig | 3 + init_mac.sh | 245 ++++++++++++++++++++++++++++++++++++ 11 files changed, 628 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/setup.yml create mode 100644 Brewfile create mode 100644 bootstrap.sh create mode 100644 brew.sh delete mode 100644 curl.cmd create mode 100644 git/global.gitconfig create mode 100644 git/work.gitconfig create mode 100755 init_mac.sh diff --git a/.github/workflows/setup.yml b/.github/workflows/setup.yml new file mode 100644 index 0000000..abd961a --- /dev/null +++ b/.github/workflows/setup.yml @@ -0,0 +1,13 @@ +name: build +on: [push, pull_request] +jobs: + ci: + name: bootstrap + runs-on: macos-latest + steps: + - uses: actions/checkout@master + - name: build + env: + CI_MODE: true + run: bash ./bootstrap.sh + diff --git a/.vim/startup/vundle_vimrc b/.vim/startup/vundle_vimrc index ce9b664..dcd7dd0 100644 --- a/.vim/startup/vundle_vimrc +++ b/.vim/startup/vundle_vimrc @@ -71,7 +71,7 @@ Plug 'ntpeters/vim-better-whitespace' Plug '907th/vim-auto-save' Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': '.install -all'} Plug 'junegunn/fzf.vim' -Plug 'Valloric/YouCompleteMe', { 'do': './install.py' } +Plug 'Valloric/YouCompleteMe', { 'do': 'python3 install.py --all' } " Git plugin not hosted on GitHub Plug 'git://git.wincent.com/command-t.git' diff --git a/.zshrc b/.zshrc index 1911857..44bd114 100644 --- a/.zshrc +++ b/.zshrc @@ -20,13 +20,15 @@ antigen bundle git-flow antigen bundle mvn antigen bundle tig antigen bundle heroku -antigen bundle pip antigen bundle lein antigen bundle command-not-found antigen bundle tmux antigen bundle tmuxinator antigen bundle docker antigen bundle docker-compose +# macos +antigen bundle brew +antigen bundle osx # Syntax highlighting bundle. antigen bundle zsh-users/zsh-syntax-highlighting @@ -117,6 +119,8 @@ if [[ -f ~/.zshrc.local ]]; then source $HOME/.zshrc.local fi +ZSH_DISABLE_COMPFIX=true + fpath=(~/.zsh/completions $fpath) autoload -U compinit && compinit diff --git a/Brewfile b/Brewfile new file mode 100644 index 0000000..840462f --- /dev/null +++ b/Brewfile @@ -0,0 +1,116 @@ +tap "homebrew/cask", "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git" +tap "homebrew/cask-drivers", "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask-drivers.git" +tap "homebrew/cask-fonts", "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask-fonts.git" +tap "homebrew/core", "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git" +tap "homebrew/bundle" +tap "homebrew/services" +tap "homebrew/cask-versions" +tap "adoptopenjdk/openjdk" + +# primitives +# https://en.wikipedia.org/wiki/List_of_GNU_Core_Utilities_commands +brew "coreutils" +brew "git" +brew "neovim" +brew "zsh" +brew "zsh-completions" +brew "tmux" +brew "gnupg" +brew "gnupg2" +brew "fzf" +brew "hub" +brew "tmux" +brew "tree" +brew "wget" + +# tools +brew "mas" +brew "p7zip" +brew "dos2unix" +brew "proxychains-ng" +brew "htop" +brew "neofetch" +brew "syncthing" +brew "openssl@1.1" +brew "readline" +brew "asdf" +brew "boost@1.60", link: true +brew "cmake" +brew "jenv" +brew "node" +brew "pyenv" +brew "rbenv" +brew "sqlite" +brew "xz" +brew "zlib" + +# productivity +brew "exa" +brew "fzf" +brew "ripgrep" +brew "fd" +brew "hexyl" +brew "xsv" +brew "jq" +brew "hledger" + +# dev +brew "ruby" +brew "go" +brew "cmake" +# brew "mysql@5.7" +brew "sqlite" +# brew "postgresql" +brew "youtube-dl" +# brew "heroku" +brew "node" +brew "yarn" +# brew "wrk" + +if ENV.key? 'CI_MODE' +cask "iterm2" +cask "eudic" +cask "java" +cask "licecap" +cask "nextcloud" +# cask "1password" +cask "alfred" +cask "google-chrome" +# cask "firefox-developer-edition" +# cask "sublime-text" +cask "visual-studio-code" +cask "font-source-code-pro" +cask "font-fira-code" +cask "dash" +cask "karabiner-elements" +cask "dozer" +cask "shadowsocksx-ng" +cask "iina" +cask "neteasemusic" +# cask "qqmusic" +cask "google-trends" +cask "appcleaner" +cask "oversight" +# open broadcaster software +cask "obs" +# note-taking app +cask "obsidian" +# cask "dropbox" +cask "nitroshare" +cask "qmk-toolbox" +cask "via" +cask "vlc" + +mas "WeChat", id: 836500024 +mas "Unsplash Wallpapers", id: 1284863847 +mas "Microsoft ToDo", id: 1274495053 +mas "Microsoft OneNote", id: 784801555 +# mas "Bear", id: 1091189122 +# mas "Lungo", id: 1263070803 +mas "Pages", id: 409201541 +mas "Numbers", id: 409203825 +mas "Keynote", id: 409183694 +end + + + diff --git a/README.md b/README.md index 017cca2..d8118e9 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,11 @@ dotfiles config contain vim, zsh, tmux configurations. +## MacOS setup + + git clone git@github.com:einverne/dotfiles.git + cd dotfiles + bash bootstrap.sh + ## Overview - zsh diff --git a/bootstrap.sh b/bootstrap.sh new file mode 100644 index 0000000..c17760c --- /dev/null +++ b/bootstrap.sh @@ -0,0 +1,77 @@ +#!/usr/bin/env bash +# https://github.com/crispgm/dotfiles/blob/master/bootstrap + +set -e + +echo "Install Homebrew" +if test ! $(which brew); then + echo "Installing homebrew..." + /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" +fi + +echo "Setup hostname" +sudo scutil --set HostName mac + +echo "Install from brew.sh" +bash brew.sh + +echo "Install with Brew Bundle" +set +e +brew bundle +set -e + +echo "Setup workspace" +mkdir -p ~/projects + +echo "Setup Git" +ln -s ./git/work.gitconfig ~/projects/.gitconfig +if [ -f $HOME/.gitconfig ]; then + cat $HOME/.gitconfig + mv $HOME/.gitconfig $HOME/.gitconfig.bak +fi +ln -s $PWD/git/global.gitconfig $HOME/.gitconfig + +# echo "Setup Bash" +# sudo cp ./motd /etc/motd +# cp ./bash/.bashrc ~/.bashrc +# cp ./bash/.bash_profile ~/.bash_profile + +echo "Setup Zsh" +sudo sh -c 'echo /usr/local/bin/zsh >> /etc/shells' +sudo chsh -s $(which zsh) +if [ -f ~/.zshrc ]; then + cat ~/.zshrc + mv ~/.zshrc ~/zshrc.bak +fi +ln -s $PWD/.zshrc $HOME/.zshrc + +echo "Setup Vim" +ln -s $PWD/.vimrc $HOME/.vimrc + +echo "Setup Tmux" +ln -s $PWD/tmux/.tmux.conf $HOME/.tmux.conf +ln -s $PWD/tmux/.tmux.conf.local $HOME/.tmux.conf.local + +ls -al $HOME + +echo "Setup applications" +echo "- fzf" +$(brew --prefix)/opt/fzf/install +# echo "- neovim" +# ./neovim/neovim + +echo "Link editors" +mkdir -p ~/Applications/ +sudo ln -s /Applications/Visual\ Studio\ Code.app/Contents/Resources/app/bin/code /usr/local/bin/code + +# echo "Setup Ruby" +# ./ruby/ruby +# +# echo "Setup Go" +# mkdir -p ~/go +# +# echo "Setup Shadowsocks" +# ./Shadowsocks/init + +echo "Setup macOS defaults" +bash init_mac.sh diff --git a/brew.sh b/brew.sh new file mode 100644 index 0000000..e5a54a8 --- /dev/null +++ b/brew.sh @@ -0,0 +1,39 @@ +# https://github.com/mathiasbynens/dotfiles/blob/main/brew.sh +brew update +brew upgrade + +# https://en.wikipedia.org/wiki/List_of_GNU_Core_Utilities_commands +brew install coreutils +# Install GNU `find`, `locate`, `updatedb`, and `xargs`, `g`-prefixed. +brew install findutils +# Install GNU `sed`, overwriting the built-in `sed`. +brew install gnu-sed --with-default-names + +# Install `wget` with IRI support. +brew install wget --with-iri +# Install GnuPG to enable PGP-signing commits. +brew install gnupg + +# Install more recent versions of some macOS tools. +brew install vim --with-override-system-vi +brew install grep +brew install openssh +# GNU multiple precision arithmetic library +brew install gmp + +# Install font tools. +# brew tap bramstein/webfonttools +# brew install sfnt2woff +# brew install sfnt2woff-zopfli +# brew install woff2 + +brew install ack +brew install git +brew install git-lfs +brew install imagemagick --with-webp +brew install p7zip +brew install ssh-copy-id +brew install tree + +# Remove outdated versions from the cellar. +brew cleanup diff --git a/curl.cmd b/curl.cmd deleted file mode 100644 index 2753fc4..0000000 --- a/curl.cmd +++ /dev/null @@ -1,12 +0,0 @@ -@rem Do not use "echo off" to not affect any child calls. -@setlocal - -@rem Get the abolute path to the parent directory, which is assumed to be the -@rem Git installation root. -@for /F "delims=" %%I in ("%~dp0..") do @set git_install_root=%%~fI -@set PATH=%git_install_root%\bin;%git_install_root%\mingw\bin;%PATH% - -@if not exist "%HOME%" @set HOME=%HOMEDRIVE%%HOMEPATH% -@if not exist "%HOME%" @set HOME=%USERPROFILE% - -@curl.exe %* \ No newline at end of file diff --git a/git/global.gitconfig b/git/global.gitconfig new file mode 100644 index 0000000..bb38b3d --- /dev/null +++ b/git/global.gitconfig @@ -0,0 +1,123 @@ +[user] + email = einverne@gmail.com + name = Ein Verne + signingkey = 926634D64ACAD792 +[push] + default = matching +[http] + postBuffer = 524288000 +[alias] + unstage = reset HEAD -- + a = add + b = branch + c = commit + d = diff + f = fetch + g = grep + l = log + m = merge + o = checkout + p = pull + r = remote + s = status + st = status + w = whatchanged + + ### commit ### + ca = commit --amend + + ### checkout ### + co = checkout + + ### cherry-pick ### + + ### diff ### + # diff - show changes not yet staged + dc = diff --cache + + # diff - changes about to be commited + ds = diff --staged + + ### log ### + # log key - our favorite way to show our key performance indicators, i.e. our most useful summary. + lk = log --graph --topo-order --abbrev-commit --date=short --decorate --all --boundary --pretty=format:'%Cgreen%ad %Cred%h%Creset -%C(yellow)%d%Creset %s %Cblue[%cn]%Creset %Cblue%G?%Creset' + + ### merge ### + + ### pull ### + # pull if a merge can be resolved as a fast-forward, otherwise fail. + pf = pull --ff-only + + # pull with rebase - to provide a cleaner, linear, bisectable history. + # + # To integrate changes between branches, you can merge or rebase. + # + # When we use "git pull", git does a fetch then a merge. + # If we've made changes locally and someone else has pushed changes + # to our git host then git will automatically merge these together + # and create a merge commit that looks like this in the history: + # + # 12345678 - Merge branch 'foo' of bar into master + # + # When we use "git pull --rebase", git does a fetch then a rebase. + # A rebase resets the HEAD of your local branch to be the same as + # the remote HEAD, then replays your local commits back into repo. + # This means you don't get any noisy merge messages in your history. + # This gives us a linear history, and also helps with git bisect. + # + # To automatically do "pull --rebase" for any branch based on master: + # + # git config branch.master.rebase true + # + # To automatically do "pull --rebase" for all branches: + # + # git config --global branch.autosetuprebase always + # + # pr = pull --rebase + pr="!f() { \ + BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD); \ + git push -u origin $BRANCH_NAME; \ + hub pull-request; \ + };f " + + ### rebase ### + + # rebase - forward-port local commits to the updated upstream head. + rb = rebase + + # rebase - continue the rebasing process after resolving a conflict manually and updating the index with the resolution. + rbc = rebase --continue + + # rebase - restart the rebasing process by skipping the current patch. + rbs = rebase --skip + + ### remote ### + + + ### tags ### + lasttag = describe --tags --abbrev=0 + tags = tag -n1 --list + +# Stash aliases + save = stash save + pop = stash pop + +[branch] + autosetuprebase = always +[core] + editor = vim + autocrlf = input + quotepath = false +[pull] + rebase = true + +[merge] + tool = meld + conflictstyle = diff3 +[mergetool "meld"] + cmd = meld $LOCAL $BASE $REMOTE --output=$MERGED --auto-merge +[gpg] + program = gpg + +[includeIf "gitdir:~/projects/"] + path = ~/projects/.gitconfig diff --git a/git/work.gitconfig b/git/work.gitconfig new file mode 100644 index 0000000..f560356 --- /dev/null +++ b/git/work.gitconfig @@ -0,0 +1,3 @@ +[user] + name = Ein Verne + email = i@einverne.info diff --git a/init_mac.sh b/init_mac.sh new file mode 100755 index 0000000..0a8f865 --- /dev/null +++ b/init_mac.sh @@ -0,0 +1,245 @@ +# https://github.com/mathiasbynens/dotfiles/blob/master/.macos +# Disable Notification Center and remove the menu bar icon +launchctl unload -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plist 2> /dev/null +# Trackpad: enable tap to click for this user and for the login screen +defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true +defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1 +defaults write NSGlobalDomain com.apple.mouse.tapBehavior -int 1 +# Trackpad: map bottom right corner to right-click +defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadCornerSecondaryClick -int 2 +defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadRightClick -bool true +defaults -currentHost write NSGlobalDomain com.apple.trackpad.trackpadCornerClickBehavior -int 1 +defaults -currentHost write NSGlobalDomain com.apple.trackpad.enableSecondaryClick -bool true +# Open Desktop +defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/Desktop/" +defaults write com.apple.finder ShowPathbar -bool true +# Dock +defaults write com.apple.dock tilesize -int 36 +defaults write com.apple.dock show-process-indicators -bool true +defaults write com.apple.dock minimize-to-application -bool true +defaults write com.apple.dock show-recents -bool false +# Terminal utf-8 +defaults write com.apple.terminal StringEncodings -array 4 +# Left corner to screensaver +defaults write com.apple.dock wvous-bl-corner -int 5 +# Avoid create DS_Store to USB +defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true +defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true + +# Show all hidden files +defaults write com.apple.finder AppleShowAllFiles ture + +############################################################################### +# General UI/UX # +############################################################################### + +# Enable transparency in the menu bar and elsewhere on Yosemite +defaults write com.apple.universalaccess reduceTransparency -bool false + +# Always show scrollbars +defaults write NSGlobalDomain AppleShowScrollBars -string "Always" +# Possible values: `WhenScrolling`, `Automatic` and `Always` + +# Save to disk (not to iCloud) by default +defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false + +# Disable the “Are you sure you want to open this application?” dialog +defaults write com.apple.LaunchServices LSQuarantine -bool false + +############################################################################### +# Trackpad, mouse, keyboard, Bluetooth accessories, and input # +############################################################################### + +# Trackpad: enable tap to click for this user and for the login screen +defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true +defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1 +defaults write NSGlobalDomain com.apple.mouse.tapBehavior -int 1 + +# Trackpad: map bottom right corner to right-click +defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadCornerSecondaryClick -int 2 +defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadRightClick -bool true +defaults -currentHost write NSGlobalDomain com.apple.trackpad.trackpadCornerClickBehavior -int 1 +defaults -currentHost write NSGlobalDomain com.apple.trackpad.enableSecondaryClick -bool true + +# Enable full keyboard access for all controls +# (e.g. enable Tab in modal dialogs) +defaults write NSGlobalDomain AppleKeyboardUIMode -int 3 + +# Disable press-and-hold for keys in favor of key repeat +defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false + +# Set a blazingly fast keyboard repeat rate +defaults write NSGlobalDomain KeyRepeat -int 1 +defaults write NSGlobalDomain InitialKeyRepeat -int 10 + +############################################################################### +# Energy saving # +############################################################################### + + +# Sleep the display after 15 minutes +sudo pmset -a displaysleep 15 + +# Disable machine sleep while charging +sudo pmset -c sleep 0 + +# Set machine sleep to 5 minutes on battery +sudo pmset -b sleep 5 + +# Set standby delay to 24 hours (default is 1 hour) +sudo pmset -a standbydelay 86400 + +############################################################################### +# 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 + +# Save screenshots to the desktop +defaults write com.apple.screencapture location -string "${HOME}/Desktop" + +# 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 + +# Enable subpixel font rendering on non-Apple LCDs +# Reference: https://github.com/kevinSuttle/macOS-Defaults/issues/17#issuecomment-266633501 +defaults write NSGlobalDomain AppleFontSmoothing -int 1 + +# Enable HiDPI display modes (requires restart) +sudo defaults write /Library/Preferences/com.apple.windowserver DisplayResolutionEnabled -bool true + +############################################################################### +# Finder # +############################################################################### + +# Finder: allow quitting via ⌘ + Q; doing so will also hide desktop icons +defaults write com.apple.finder QuitMenuItem -bool true + +# Finder: disable window animations and Get Info animations +defaults write com.apple.finder DisableAllAnimations -bool true + +# 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 +defaults write NSGlobalDomain AppleShowAllExtensions -bool true + +# Finder: show status bar +defaults write com.apple.finder ShowStatusBar -bool true + +# Finder: show path bar +defaults write com.apple.finder ShowPathbar -bool true + +# Display full POSIX path as Finder window title +defaults write com.apple.finder _FXShowPosixPathInTitle -bool true + +# Keep folders on top when sorting by name +defaults write com.apple.finder _FXSortFoldersFirst -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 + +# Avoid creating .DS_Store files on network or USB volumes +defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true +defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true + +# Disable disk image verification +defaults write com.apple.frameworks.diskimages skip-verify -bool true +defaults write com.apple.frameworks.diskimages skip-verify-locked -bool true +defaults write com.apple.frameworks.diskimages skip-verify-remote -bool true + +# Automatically open a new Finder window when a volume is mounted +defaults write com.apple.frameworks.diskimages auto-open-ro-root -bool true +defaults write com.apple.frameworks.diskimages auto-open-rw-root -bool true +defaults write com.apple.finder OpenWindowForNewRemovableDisk -bool true + +# Show item info near icons on the desktop and in other icon views +/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist +/usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist +/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist + +# Show item info to the right of the icons on the desktop +/usr/libexec/PlistBuddy -c "Set DesktopViewSettings:IconViewSettings:labelOnBottom false" ~/Library/Preferences/com.apple.finder.plist + +# 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 + +# Increase grid spacing for icons on the desktop and in other icon views +/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:gridSpacing 100" ~/Library/Preferences/com.apple.finder.plist +/usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:gridSpacing 100" ~/Library/Preferences/com.apple.finder.plist +/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:gridSpacing 100" ~/Library/Preferences/com.apple.finder.plist + +# Increase the size of icons on the desktop and in other icon views +/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:iconSize 80" ~/Library/Preferences/com.apple.finder.plist +/usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:iconSize 80" ~/Library/Preferences/com.apple.finder.plist +/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:iconSize 80" ~/Library/Preferences/com.apple.finder.plist + +# Use list view in all Finder windows by default +# Four-letter codes for the other view modes: `icnv`, `clmv`, `glyv` +defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv" + +# Disable the warning before emptying the Trash +defaults write com.apple.finder WarnOnEmptyTrash -bool false + +# Show the ~/Library folder +chflags nohidden ~/Library && xattr -d com.apple.FinderInfo ~/Library + +# Show the /Volumes folder +sudo chflags nohidden /Volumes + + +############################################################################### +# Dock, Dashboard, and hot corners # +############################################################################### + + + +# 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 +# 13: Lock Screen +# Top left screen corner → Mission Control +defaults write com.apple.dock wvous-tl-corner -int 2 +defaults write com.apple.dock wvous-tl-modifier -int 0 +# Top right screen corner → Desktop +defaults write com.apple.dock wvous-tr-corner -int 11 +defaults write com.apple.dock wvous-tr-modifier -int 0 +# Bottom left screen corner → Start screen saver +defaults write com.apple.dock wvous-bl-corner -int 4 +defaults write com.apple.dock wvous-bl-modifier -int 0