Skip to content

Instantly share code, notes, and snippets.

@hnrck
Created June 27, 2019 09:30
Show Gist options
  • Save hnrck/1476886c85319a482b354a398c7328fe to your computer and use it in GitHub Desktop.
Save hnrck/1476886c85319a482b354a398c7328fe to your computer and use it in GitHub Desktop.
Resize the OS X launcher
#!/bin/bash
usage()
{
echo -e ""
echo -e "resize_launcher"
echo -e ""
echo -e "Change or revert the number of icons in the launcher"
echo -e ""
echo -e "Usage:"
echo -e "\t./resize_launcher --help"
echo -e "\tprint help"
echo -e ""
echo -e "\t./resize_launcher --revert"
echo -e "\trevert to default launcher"
echo -e ""
echo -e "\t./resize_launcher X Y"
echo -e "\tresize the launcher to X * Y"
echo -e ""
}
resize_launcher()
{
defaults write com.apple.dock springboard-columns -int $1
defaults write com.apple.dock springboard-rows -int $2
defaults write com.apple.dock ResetLaunchPad -bool TRUE;killall Dock
}
revert_launcher()
{
defaults delete com.apple.dock springboard-rows
defaults delete com.apple.dock springboard-columns
defaults write com.apple.dock ResetLaunchPad -bool TRUE;killall Dock
}
one_arg_handler()
{
while [ "$1" != "" ]; do
case $1 in
-h | --help ) usage
exit
;;
-r | --revert ) revert_launcher
exit
;;
* ) usage
exit 1
esac
done
}
case "$#" in
0 ) usage
exit 1
;;
1 ) one_arg_handler "$1"
exit
;;
2 ) resize_launcher "$1" "$2"
exit
;;
* ) usage
exit 1
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment