Created
January 25, 2021 03:28
-
-
Save felix021/2454c596a7af46f617b2595c726f2a44 to your computer and use it in GitHub Desktop.
Automatically mute your speaker according to specific wifi ssid.
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
#!/bin/bash | |
# USAGE: register in crontab with "*/10 0 0 0 0" | |
YourSSID="YOUR WIFI SSID" | |
YourDevice="MacBook Pro Speakers" | |
source /etc/profile | |
which AdjustVolume &>/dev/null | |
if [ $? -eq 1 ]; then | |
echo | |
echo Please download device-volume-adjuster, unzip AdjustVolume.zip and put the binary to /usr/local/bin/ | |
echo " URL: https://github.com/jonomuller/device-volume-adjuster/releases/tag/v1.0.0" | |
echo | |
exit 1 | |
fi | |
ssid=`/System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport -I | grep ' SSID:' | awk -FSSID:\ '{print $2}'` | |
if [ "$ssid" == "$YourSSID" ]; then | |
AdjustVolume -s 0 -n "$YourDevice" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment