-
-
Save pandrewhk/e781c51c3de7ee47fe8ba3a6c0f3d2a1 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
function ssidChangedCallback() | |
newSSID = hs.wifi.currentNetwork() | |
if newSSID ~= lastSSID then | |
hs.alert.show("WiFi changed, muting speakers", 5) | |
hs.audiodevice.findOutputByName("MacBook Pro Speakers"):setOutputVolume(20) | |
hs.audiodevice.findOutputByName("MacBook Pro Speakers"):setOutputMuted(true) | |
end | |
lastSSID = newSSID | |
end | |
wifiWatcher = hs.wifi.watcher.new(ssidChangedCallback) | |
wifiWatcher:start() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment