I have many automations that I rely on with both Shortcuts and Keyboard Maestro on my Mac. But one I can’t seem to solve is with Wireguard.
Wireguard is how I access my company’s VPN, and I don’t need it on all day. It operates in the menu bar which is great, but without a keyboard shortcut that lets me open the full app, where I could then toggle the VPN with Command-T.
I’ve tried Keyboard Maestro’s macro based on cursor location but it constantly needs pixel adjustments or it eventually starts clicking in the wrong place. It’s not very reliable.
Any thoughts on how to do this?
Bartender lets you assign keyboard shortcuts to menu bar apps, which might get you what you need using Keyboard Maestro for the rest.
Hope that works!
Thank you. That gets me so close. I can use that to make the first click on the Wireguard menu bar icon, but then I still have to select the tunnel to activate it. I’ll look at what I can at that point.
I do know that Keysmith can do this, but it has a couple limitations too.
How about running a shell script with Keyboard Maestro
# Script to toggle VPN Connection
if [[ $(scutil --nc list | grep "Connected" | grep "$CONNECTION") ]];then
# is connected, disconnect
scutil --nc stop "$CONNECTION"
# not connected, connect
scutil --nc start "$CONNECTION"
you could install wireguard through homebrew, which would give you the full CLI options and can use those to start, stop and configure your wireguard vpn
The CLI options are very easy to include in shortcuts (even remotely)