Skip to content

Instantly share code, notes, and snippets.

@jellea
Created November 23, 2020 10:26
Show Gist options
  • Save jellea/909abf1716f4d4ef44855e891f046f07 to your computer and use it in GitHub Desktop.
Save jellea/909abf1716f4d4ef44855e891f046f07 to your computer and use it in GitHub Desktop.
function ssidChangedCallback()
newSSID = hs.wifi.currentNetwork()
if newSSID ~= lastSSID then
hs.alert.show("Wifi Change - Zeroing Volume", 5)
hs.audiodevice.defaultOutputDevice():setVolume(0)
end
lastSSID = newSSID
end
wifiWatcher = hs.wifi.watcher.new(ssidChangedCallback)
wifiWatcher:start()
@pandrewhk
Copy link

Nice, muting just the speakers for myself now. Tested with music playing through AirPods — no interruptions whatsoever.

https://gist.github.com/pandrewhk/e781c51c3de7ee47fe8ba3a6c0f3d2a1/revisions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment