Instantly share code, notes, and snippets.

Embed
What would you like to do?
A script to quickly configure Hot Corners from a file on macOS (https://blog.jiayu.co/2018/12/quickly-configuring-hot-corners-on-macos/)
#!/usr/bin/env bash
set -e
config_dir=${HOTCORNERS_CONFIG_DIR:-$HOME/.hotcorners}
if [ -z "$1" ]; then
echo "usage: hotcorners profile" 1>&2
exit 1
fi
profile=$1
config_file_path=$config_dir/$profile
if [ ! -f "$config_file_path" ]; then
echo "couldn't find config file for profile $profile ($config_file_path)" 1>&2
exit 1
fi
awk -F\= '/^[^#]/ {cmd=sprintf("defaults write com.apple.dock %s -int %s", $1, $2); print cmd; system(cmd)}' $config_file_path
killall Dock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment