AppleScript: Get connected VPN names from Tunnelblick

21st May 2021

Tunnelblick is the de facto OpenVPN client for macOS. Amongst other things, it conveniently supports AppleScript which means you can easily use it with Xbar:

#!/usr/bin/env osascript

tell application "Tunnelblick"
    get name of configurations where state = "CONNECTED"
end tell