Give the VPN a toggle, an indicator, and a way back
Turning on a WireGuard profile whose server was unreachable used to cost the whole network stack, and the only way out was nmcli typed into a terminal. Quickshell's Networking module has no VPN surface, so this arrives as the one sanctioned nmcli exception: a helper that lists, raises and lowers profiles, a service that watches NetworkManager for changes made anywhere, a quick settings tile (left-click toggles the most recently used profile, right-click picks among them), and a bar glyph while a tunnel is up. The safety property is in the helper, where it cannot be skipped: activation waits a bounded 25 seconds, and a failure is rolled back down and reported instead of leaving a black-hole default route. The contract pins exactly that, against a stateful stub NetworkManager. Claude-Session: https://claude.ai/code/session_01Epx9ZC1gwm81K3jm9x9CKh
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import QtQuick
|
||||
|
||||
import qs.services
|
||||
|
||||
// Drives services/Vpn.qml for tests/quickshell/vpn-contract. The contract
|
||||
// stands a stub nmcli on PATH, so everything the service believes comes from
|
||||
// fixtures and everything it does is recorded — no real tunnel is touched.
|
||||
|
||||
ShellRoot {
|
||||
IpcHandler {
|
||||
target: "vpn-test"
|
||||
|
||||
function status(): string {
|
||||
return JSON.stringify({
|
||||
scanned: Vpn.scanned,
|
||||
available: Vpn.available,
|
||||
anyActive: Vpn.anyActive,
|
||||
activeSummary: Vpn.activeSummary,
|
||||
busy: Vpn.busy,
|
||||
lastError: Vpn.lastError,
|
||||
connections: Vpn.connections
|
||||
});
|
||||
}
|
||||
function refresh(): void { Vpn.refresh(); }
|
||||
function toggle(): void { Vpn.toggle(); }
|
||||
function setActive(uuid: string, on: bool): void { Vpn.setActive(uuid, on); }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user