local usbWatcher = hs.usb.watcher.new(function(device) if device.productName == "EMEET SmartCam C960" then if device.eventType == "added" then hs.execute("networksetup -setairportpower en0 off") hs.notify.new({title="Wi-Fi", informativeText="Disabled (USB device connected)"}):send() elseif device.eventType == "removed" then hs.execute("networksetup -setairportpower en0 on") hs.notify.new({title="Wi-Fi", informativeText="Re-enabled (USB device removed)"}):send() end end end) usbWatcher:start()
https://support.apple.com/en-ca/guide/mac-help/mchlp2711/mac