Skip to content

Show and switch the Mac's VPNs with a native vpn provider #823

Open

Description

@M4n0x

Problem

Each VPN app needs its own store package, and each one polls a script for the same few facts:

  • Proton VPN greps scutil --nc list every 5 s for its status, and opens the app's menu to connect.
  • Tunnelblick asks the app over AppleScript every 5 s.
  • OpenVPN Connect (stablebar-packages#60, #61) reads scutil --nc list, show and status, netstat and the app's profile store with jq. While connected it runs every 2 s for its speeds and graph, about 0.1 s of CPU each time, and keeps the graph's history in a file in $TMPDIR between runs. It connects and disconnects with scutil --nc start and stop, because the app's own command line shows its window.

Most of that is what System Settings → VPN already knows: every VPN configured in macOS (IKEv2, IPSec, L2TP) and every app VPN built on Network Extension (OpenVPN Connect, Tailscale, Proton VPN, WireGuard, recent corporate clients), each with its status and an on/off switch. The network provider can't help here: it leaves virtual VPN interfaces out on purpose, so showing a VPN's own speed takes a script reading netstat.

Proposal

A native vpn provider for the VPN services in the current network set, as scutil --nc list lists them:

  • lists.services: a row per service with id (the service ID), name, type (what scutil shows in parentheses: the app's bundle ID, such as org.openvpn.client.app, or Apple's for a VPN configured in macOS), status (connected, connecting, disconnecting or disconnected), interface while it's up (such as utun7), download and upload in bytes per second, and downloadRate and uploadRate formatted with units, as network does.
  • values.connected: how many are connected. fields.connected: their names. icon: one symbol while any is connected, another while none is.
  • A types option that keeps only some services, such as "types": ["org.openvpn.client.app"], so a package for one app can use the provider for its tunnels and add only what the app adds.
  • Status follows macOS as it changes, without polling, as wifi does. Rates update on interval and add graph samples, like network.
  • connectVPNField and disconnectVPNField, reading a service ID from the current row as selectOutputDeviceField does, start or stop the service the way System Settings does.

Things to settle:

  • Stopping works for every service. Starting an app's VPN from outside the app depends on its extension. OpenVPN Connect's reads the profile named in the service's configuration (ovpnProfileId) and connects it cleanly; another app's may connect its last server or need its app. A row could offer Connect only for types known to start cleanly, or for all of them.
  • Listing app VPNs and reading their status may need SystemConfiguration calls that aren't public. Show connected Bluetooth devices and their battery #220 allows a native provider to run a macOS tool off the main actor and without a shell, so the provider could run scutil itself where no public API covers it.
  • VPNs that don't use Network Extension, such as Tunnelblick, don't appear, so their packages stay.

This adds a provider type, so it needs a maintainer's OK.

Possible today

Yes, with a script per app: scutil --nc list for the status, scutil --nc show <id> for an app's configuration, scutil --nc status <id> for the interface, netstat -ibn -I <interface> for the byte counts kept in a file to compute speeds and history, and scutil --nc start or stop <id> to switch it. The OpenVPN Connect package does all of it. Each package repeats it, polls every few seconds, and keeps its graph's history in a file instead of the widget's samples.

Related

Triaged by Claude Code (Claude Opus 5.5).

Activity

  1. added
    enhancement
    P3
    on Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions