Created
January 9, 2015 19:18
-
-
Save bradjasper/1d48239f211c43876114 to your computer and use it in GitHub Desktop.
Small BASH script to check if Focus is currently activated
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
ACTIVE_NETWORK=$(echo "open|||get Setup:/Network/Service/$(echo "open|||get State:/Network/Global/IPv4|||d.show" | tr '|||' '\n' | scutil | grep "PrimaryService" | awk '{print $3}') |||d.show" | tr '|||' '\n' | scutil | grep "UserDefinedName" | awk -F': ' '{print $2}') | |
FOCUS_BLACKHOLE_PID=$(ps aux | grep FocusBlackholeProxy | grep -v grep | awk '{print $2}') | |
PROXY_URL_OUTPUT=$(networksetup -getautoproxyurl "$ACTIVE_NETWORK") | |
if [[ $PROXY_URL_OUTPUT == *"focus"* ]] | |
then | |
echo "Focus is active!" | |
else | |
echo "Focus is not active" | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment