[zsh] Fix up init and screenshot path setting on Darwin

This commit is contained in:
Eryn Wells 2019-11-08 16:27:53 -08:00 committed by Eryn Wells
parent 39294aa58e
commit fbe786d40e

View file

@ -24,22 +24,24 @@ unset SOUNDSDIR
function darwin-icloud-drive-path function darwin-icloud-drive-path
{ {
return "$HOME/Library/Mobile\ Documents/com\~apple\~CloudDocs" echo "$HOME/Library/Mobile\ Documents/com\~apple\~CloudDocs"
} }
function init-macos function darwin-init
{ {
# Dim dock icons of apps that have been hidden. # Dim dock icons of apps that have been hidden.
print_info "Auto-hiding Dock"
defaults write com.apple.Dock showhidden -boolean yes defaults write com.apple.Dock showhidden -boolean yes
killall Dock killall Dock
# Put screenshots in Google Drive, in a directory according to hostname # Put screenshots in iCloud Drive, in a directory according to hostname
icloud=`darwin-icloud-drive-path` icloud=`darwin-icloud-drive-path`
if [[ -d "$icloud" ]]; then if [[ -d "$icloud" ]]; then
name=`hostname -s | tr A-Z a-z` local name=`hostname -s | tr A-Z a-z`
loc="$icloud/Screenshots/$name" local loc="`darwin-icloud-drive-path`/Screenshots/$name"
mkdir -p "$loc" print_info "Setting screenshot directory: $loc"
defaults write com.apple.screencapture location "$loc" mkdir -p "$loc"
defaults write com.apple.screencapture location "$loc"
else else
echo "iCloud directory doesn't exist: $icloud" echo "iCloud directory doesn't exist: $icloud"
fi fi