Disconnect from WiFi button?


Anyone know a way to disconnect from wifi through AppleScript or terminal command?

I can get a button to appear when connected, that turns wifi off completely when pressed. But can’t find anything on disconnecting.

This would be awesome if it could disconnect from an iPhone hotspot as well.

You should be able to disconnect using Apple script.
Also, I think there is a possibility to toggle WiFi on/off in the BTT actions, but I'm not sure about it.

I’ll have to do some more digging to find the apple script commands.

I can’t see any BTT options to turn wifi on and off. But I do currently have a TouchBar button that runs the terminal command to turn on/off

use framework "CoreWLan"

current application's CWWiFiClient's ¬
	sharedWiFiClient()'s ¬
	interface()'s disassociate()
use framework "CoreWLan"

tell the current application's CWWiFiClient's ¬
	sharedWiFiClient()'s interface() to ¬
	setPower:(not powerOn()) |error|:(missing value)