ZZQZL2APVQWSZQB3LU22QBJ4XABXFO3P57IDEARTSDUHARGFMOCAC
VQ2DEF34BLM3WZP2NQXT2US6T6Q5AH2KAHCU5JUV4FLR3Z2SB7XAC
TV3UCUKAIECQR4QCXWDN3YZVSZ3RKXE6466TWLWGCKDJ2JAIYLMQC
JYWJMGAXOKDI6WWDRIZYEKJV67PROQI3RVGNFAIR6QAGEGNHBMTAC
4BXYTJPI3YWWXJ4JFUNFUO6ANCMJNALQ7L3XK3U3AXQGFDV7CAEQC
674WSHB4WR6RY67PKK53GYUBY22BRMFHYNRLOTWE66CWJI2RNMJAC
57YU55IK55Q4QDV45LD3ILNQDQV46NKLYK3HS6VWR2SDTOFSYXKAC
T43Q2EZ2JQWK4WMW7RRYU7MNP3QJJXW4BQKIQMRYFCGKHL7FJ7SQC
K5PQ626TQQRIYJPYDZ5OM77ZIBX2G2QXALFRJCSKVF3PKO37C7KAC
RBBBDTNM7J6BR3SUIZQQ3FATAVWTXFQ5472JJGVH3TC37VYGSTFAC
73ADP3OYJPH4DOQU3G3VS4T66GCP5EQF5FWRRLTLCTSTDGHCEAUQC
QJLEFROGUIQZ2UTL4EIGVXNBX5QJ5PSDAPWNYQESZDL6WHJPXF7AC
alias to_plain_text='textutil -convert txt -stdin -stdout -encoding 30'
alias copy='to_plain_text | pbcopy'
alias fullcopy=pbcopy
alias paste=pbpaste
# open finder in $PWD
alias finder="open -a Finder ."
# change directories into the directory of top most finder window
alias cdfinder="cd `osascript < $DOTFILES/applescripts/finder_cwd.applescript`"
function preview {
# open a file in the default macOS preview
qlmanage -p "$@" &> /dev/null
}
function trash {
# put a file in the macOS default trash folder
command mv "$@" ~/.Trash
}
function start_screensaver {
/System/Library/CoreServices/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine
}
function lock_computer {
/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend
}
function toggle_desktop_icons {
case `defaults read com.apple.finder CreateDesktop 2> /dev/null` in
0) enable="true";;
1) enable="false";;
*) enable="false";;
esac
defaults write \
com.apple.finder \
CreateDesktop -bool $enable \
&& killall Finder
}
function toggle_autocorrect_mode {
case `defaults read -g NSAutomaticSpellingCorrectionEnabled 2> /dev/null` in
0) enable="true";;
1) enable="false";;
*) enable="false";;
esac
defaults write -g NSAutomaticSpellingCorrectionEnabled -bool $enable
}
function toggle_system_ui_keyboard_behavior {
# 0 is default, 3 enables things like tab in system dialogs
# https://github.com/herrbischoff/awesome-macos-command-line#full-keyboard-access
case `defaults read NSGlobalDomain AppleKeyboardUIMode 2> /dev/null` in
0) value=3;;
3) value=0;;
*) value=0;;
esac
defaults write NSGlobalDomain AppleKeyboardUIMode -int $value
}
function toggle_hidden_files_in_finder {
case `defaults read com.apple.finder AppleShowAllFiles 2> /dev/null` in
"false") value="true";;
"true") value="false";;
*) value="true";;
esac
defaults write com.apple.finder AppleShowAllFiles $value && killall Finder
}
MACOS_FUNCTIONS=$DOTFILES/zsh/macos_functions
fpath=($MACOS_FUNCTIONS $fpath)
for func in $(ls $MACOS_FUNCTIONS); do autoload $func; done;
# put a file in the macOS default trash folder
command mv "$@" ~/.Trash
# 0 is default, 3 enables things like tab in system dialogs
# https://github.com/herrbischoff/awesome-macos-command-line#full-keyboard-access
case `defaults read NSGlobalDomain AppleKeyboardUIMode 2> /dev/null` in
0) value=3;;
3) value=0;;
*) value=0;;
esac
defaults write NSGlobalDomain AppleKeyboardUIMode -int $value
case `defaults read com.apple.finder AppleShowAllFiles 2> /dev/null` in
"false") value="true";;
"true") value="false";;
*) value="true";;
esac
defaults write com.apple.finder AppleShowAllFiles $value && killall Finder
case `defaults read com.apple.finder CreateDesktop 2> /dev/null` in
0) enable="true";;
1) enable="false";;
*) enable="false";;
esac
defaults write \
com.apple.finder \
CreateDesktop -bool $enable \
&& killall Finder
case `defaults read -g NSAutomaticSpellingCorrectionEnabled 2> /dev/null` in
0) enable="true";;
1) enable="false";;
*) enable="false";;
esac
defaults write -g NSAutomaticSpellingCorrectionEnabled -bool $enable
textutil -convert txt -stdin -stdout -encoding 30
/System/Library/CoreServices/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine
# open a file in the default macOS preview
qlmanage -p "$@" &> /dev/null
/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend
# open finder in $PWD
open -a Finder .
to_plain_text | pbcopy
cd `osascript < $DOTFILES/applescripts/finder_cwd.applescript`
# remove empty lines, leading and trailing whitespace
sed '/^$/d' | sed -e 's/^ *//' | sed -e 's/ *$//'
date +%Y-%m-%d
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
export NVM_DIR="$HOME/.nvm"
[ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh" # This loads nvm
[ -s "/usr/local/opt/nvm/etc/bash_completion.d/nvm" ] && . "/usr/local/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion