Last active
January 27, 2023 15:04
-
-
Save yi-jiayu/5383cd268a1aa038e50c863f3d814784 to your computer and use it in GitHub Desktop.
A script to quickly configure Hot Corners from a file on macOS (https://blog.jiayu.co/2018/12/quickly-configuring-hot-corners-on-macos/)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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