Skip to content

Disconnect VPNs automatically, and reach their settings from the menu - #56

Merged
GarageDeveloper merged 1 commit into
mainfrom
auto-disconnect
Nov 13, 2026
Merged

GarageDeveloper merged 1 commit into
mainfrom
auto-disconnect

Conversation

@GarageDeveloper

Copy link
Copy Markdown
Owner

Automatic disconnection

A profile can end its session by itself (auto_disconnect = { after = "9:00", idle = "1:00", at = "19:30" }, each optional, H:MM); the first limit reached disconnects.

  • Enforced by the daemon, with the app closed too, checked every 15 s against the wall clock (sleep counts). Reconnections after a drop keep the deadlines.
  • Idle = no keyboard or mouse input (HIDIdleTime), not network traffic. macOS only.
  • Warning 5 minutes before (at most half the limit): Expiring event, sent only to clients announcing the auto_disconnect feature in Hello; PROTOCOL_VERSION unchanged.
  • Postpone (Request::Postpone, omnitunctl postpone, notification action, menu item): the time connected starts again, a time of day moves an hour later; idleness ends with the user's next input.
  • Switch: enabled = false keeps the limits without applying them.

App

  • Editor: a Schedule tab, with the switch and a checkbox + value per limit.
  • Menu: "ends at HH:MM" on the row, a gear after each VPN's switch that opens its settings in Manage VPNs.
  • While one of its windows is open, the app is regular (Dock, ⌘-Tab), back to menu bar only when they close.
  • Reconnect after update compares version and build, so a rebuilt package of the same version is an update.

Tests

  • cargo fmt --check, cargo clippy --workspace --all-targets -D warnings, cargo test --workspace (384 passed), swift build, swift test.
  • Installed locally: a 5-minute limit disconnected locala-eu at 5 min 05 s, reason logged and shown.

🤖 Generated with Claude Code

A profile can end its session by itself: after a time connected, after a
time without keyboard or mouse input, or at a time of day (H:MM each, the
first one reached wins). The daemon enforces it, with the app closed too,
against the wall clock so that sleep counts. Watchers that announce the
auto_disconnect feature get an Expiring event 5 minutes before (at most
half the limit), and Postpone starts the time connected again or moves
the time of day an hour later. Reconnections keep the deadlines. The
protocol version does not change: older clients get no new event.

- CLI: status shows the deadline; `postpone <profile>`.
- App: a Schedule tab in the editor, with a switch for the whole (limits
  kept while off, `enabled = false`) and a checkbox per limit; a warning
  notification with a Postpone action; "ends at" in the menu.
- Menu: a gear after each VPN's switch opens its settings.
- While one of its windows is open, the app is a regular one, in the Dock
  and in Command-Tab.
- Reconnecting after an update compares the build too, so a package of
  the same version built again counts as an update.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@GarageDeveloper
GarageDeveloper merged commit 1f68207 into main Nov 13, 2026
6 checks passed
@GarageDeveloper
GarageDeveloper deleted the auto-disconnect branch November 13, 2026 14:59
@GarageDeveloper GarageDeveloper mentioned this pull request Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant