-
-
Save 4rc0s/267696 to your computer and use it in GitHub Desktop.
This file contains 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 | |
# | |
# toggle_app | |
# Toggle the visibility of any app on Mac OS X | |
# Use with Quicksilver or something to toggle with shortcut keys | |
# | |
# by: Thomas Aylott -- SubtleGradient.com | |
# license: MIT | |
# | |
if [ ! -n "$1" ] | |
then | |
echo "Usage: `basename $0` AppName" 1>&2 | |
exit $E_BADARGS | |
fi | |
osascript\ | |
-e "if frontmost of the application \"$1\" then"\ | |
-e "tell application \"System Events\" to set visible of process \"$1\" to false"\ | |
-e "else"\ | |
-e "tell application \"$1\" to activate"\ | |
-e "end if"\ | |
|| exit 1 | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment