2026-05-15 19:10:50 -07:00
|
|
|
|
import QtQuick
|
2026-05-15 19:28:37 -07:00
|
|
|
|
import QtQuick.Layouts
|
2026-05-15 19:10:50 -07:00
|
|
|
|
import qs.Common
|
|
|
|
|
|
import qs.Services
|
|
|
|
|
|
import qs.Widgets
|
|
|
|
|
|
import qs.Modules.Plugins
|
2026-05-18 18:27:41 +00:00
|
|
|
|
import "./lib.js" as TailscaleLib
|
2026-05-15 19:10:50 -07:00
|
|
|
|
|
|
|
|
|
|
PluginComponent {
|
|
|
|
|
|
id: root
|
|
|
|
|
|
|
2026-05-15 19:14:49 -07:00
|
|
|
|
property bool isConnected: false
|
2026-05-15 19:19:01 -07:00
|
|
|
|
property string tailscaleIP: ""
|
|
|
|
|
|
property string currentExitNode: ""
|
2026-05-17 21:59:59 +00:00
|
|
|
|
property var peers: []
|
2026-05-21 06:37:14 +00:00
|
|
|
|
property string _copyText: ""
|
2026-05-22 21:35:07 +00:00
|
|
|
|
property int _copyIndex: 0
|
2026-05-15 19:19:01 -07:00
|
|
|
|
|
2026-05-15 19:28:37 -07:00
|
|
|
|
layerNamespacePlugin: "tailscalectl"
|
|
|
|
|
|
popoutWidth: 360
|
2026-05-17 21:59:59 +00:00
|
|
|
|
popoutHeight: 400
|
2026-05-15 19:28:37 -07:00
|
|
|
|
|
feat(proc): direct drop-in port from 4x raw Process to Proc singleton (exact poll-act-poll behavior preserved)
- Removed import Quickshell.Io + all 4 Process { toggleProcess, copyProcess, exitNodeProcess, statusCheck }
- All one-shot commands now use Proc.runCommand(id, argv, (stdout, exitCode) => {...})
- _pendingAction moved to clean root property (was hacked onto statusCheck object)
- Introduced _runStatusCheck() helper + updated wrappers (toggleTailscale, refreshStatus, setExitNode, copyToClipboard, _runNextCopy)
- Exact same sequencing and defensive logic:
* toggle: set pending → status poll for truth → decide up/down → act → post-act status verify
* copy retry state machine unchanged (just Proc instead of .command/.running)
* exit-node and generic refresh paths identical
- Added explicit comment documenting why the poll-act-poll exists (defensive, not forbidden state per AGENTS.md)
- stderr detail dropped from action errors (per chosen A strategy; generic messages only)
- All new JS follows repo ; + {} style
- I18n wrappers already in place from prior slice
Written by AI agent working for @jtmorris. Model: grok-build-0.1.
2026-05-24 20:58:31 +00:00
|
|
|
|
// Transient coordination for the defensive poll-act-poll toggle (exact behavior preserved).
|
|
|
|
|
|
// We poll for on-the-ground truth (so we choose the correct "up"/"down" and don't lie to the user),
|
|
|
|
|
|
// act, then poll again for verification. This is *not* long-term cached state (see AGENTS.md).
|
|
|
|
|
|
// The _pendingAction is short-lived per user action only.
|
|
|
|
|
|
property string _pendingAction: ""
|
|
|
|
|
|
|
2026-05-18 05:08:15 +00:00
|
|
|
|
Component.onCompleted: {
|
2026-05-22 10:19:56 +00:00
|
|
|
|
// Initial status fetch on load. Subsequent fetches are on-demand (popout open, explicit refresh, or post-action verification).
|
feat(proc): direct drop-in port from 4x raw Process to Proc singleton (exact poll-act-poll behavior preserved)
- Removed import Quickshell.Io + all 4 Process { toggleProcess, copyProcess, exitNodeProcess, statusCheck }
- All one-shot commands now use Proc.runCommand(id, argv, (stdout, exitCode) => {...})
- _pendingAction moved to clean root property (was hacked onto statusCheck object)
- Introduced _runStatusCheck() helper + updated wrappers (toggleTailscale, refreshStatus, setExitNode, copyToClipboard, _runNextCopy)
- Exact same sequencing and defensive logic:
* toggle: set pending → status poll for truth → decide up/down → act → post-act status verify
* copy retry state machine unchanged (just Proc instead of .command/.running)
* exit-node and generic refresh paths identical
- Added explicit comment documenting why the poll-act-poll exists (defensive, not forbidden state per AGENTS.md)
- stderr detail dropped from action errors (per chosen A strategy; generic messages only)
- All new JS follows repo ; + {} style
- I18n wrappers already in place from prior slice
Written by AI agent working for @jtmorris. Model: grok-build-0.1.
2026-05-24 20:58:31 +00:00
|
|
|
|
root._runStatusCheck();
|
2026-05-18 05:08:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
feat(proc): direct drop-in port from 4x raw Process to Proc singleton (exact poll-act-poll behavior preserved)
- Removed import Quickshell.Io + all 4 Process { toggleProcess, copyProcess, exitNodeProcess, statusCheck }
- All one-shot commands now use Proc.runCommand(id, argv, (stdout, exitCode) => {...})
- _pendingAction moved to clean root property (was hacked onto statusCheck object)
- Introduced _runStatusCheck() helper + updated wrappers (toggleTailscale, refreshStatus, setExitNode, copyToClipboard, _runNextCopy)
- Exact same sequencing and defensive logic:
* toggle: set pending → status poll for truth → decide up/down → act → post-act status verify
* copy retry state machine unchanged (just Proc instead of .command/.running)
* exit-node and generic refresh paths identical
- Added explicit comment documenting why the poll-act-poll exists (defensive, not forbidden state per AGENTS.md)
- stderr detail dropped from action errors (per chosen A strategy; generic messages only)
- All new JS follows repo ; + {} style
- I18n wrappers already in place from prior slice
Written by AI agent working for @jtmorris. Model: grok-build-0.1.
2026-05-24 20:58:31 +00:00
|
|
|
|
function _runStatusCheck() {
|
|
|
|
|
|
Proc.runCommand("tailscale-status", TailscaleLib.getStatusCommand(), (stdout, code) => {
|
2026-05-21 20:58:47 +00:00
|
|
|
|
if (code === 0) {
|
feat(proc): direct drop-in port from 4x raw Process to Proc singleton (exact poll-act-poll behavior preserved)
- Removed import Quickshell.Io + all 4 Process { toggleProcess, copyProcess, exitNodeProcess, statusCheck }
- All one-shot commands now use Proc.runCommand(id, argv, (stdout, exitCode) => {...})
- _pendingAction moved to clean root property (was hacked onto statusCheck object)
- Introduced _runStatusCheck() helper + updated wrappers (toggleTailscale, refreshStatus, setExitNode, copyToClipboard, _runNextCopy)
- Exact same sequencing and defensive logic:
* toggle: set pending → status poll for truth → decide up/down → act → post-act status verify
* copy retry state machine unchanged (just Proc instead of .command/.running)
* exit-node and generic refresh paths identical
- Added explicit comment documenting why the poll-act-poll exists (defensive, not forbidden state per AGENTS.md)
- stderr detail dropped from action errors (per chosen A strategy; generic messages only)
- All new JS follows repo ; + {} style
- I18n wrappers already in place from prior slice
Written by AI agent working for @jtmorris. Model: grok-build-0.1.
2026-05-24 20:58:31 +00:00
|
|
|
|
const state = TailscaleLib.parseStatusResult(stdout);
|
|
|
|
|
|
root.isConnected = state.isConnected;
|
|
|
|
|
|
root.tailscaleIP = state.tailscaleIP;
|
|
|
|
|
|
root.currentExitNode = state.currentExitNode;
|
|
|
|
|
|
root.peers = state.peers;
|
2026-05-21 20:58:47 +00:00
|
|
|
|
} else {
|
feat(proc): direct drop-in port from 4x raw Process to Proc singleton (exact poll-act-poll behavior preserved)
- Removed import Quickshell.Io + all 4 Process { toggleProcess, copyProcess, exitNodeProcess, statusCheck }
- All one-shot commands now use Proc.runCommand(id, argv, (stdout, exitCode) => {...})
- _pendingAction moved to clean root property (was hacked onto statusCheck object)
- Introduced _runStatusCheck() helper + updated wrappers (toggleTailscale, refreshStatus, setExitNode, copyToClipboard, _runNextCopy)
- Exact same sequencing and defensive logic:
* toggle: set pending → status poll for truth → decide up/down → act → post-act status verify
* copy retry state machine unchanged (just Proc instead of .command/.running)
* exit-node and generic refresh paths identical
- Added explicit comment documenting why the poll-act-poll exists (defensive, not forbidden state per AGENTS.md)
- stderr detail dropped from action errors (per chosen A strategy; generic messages only)
- All new JS follows repo ; + {} style
- I18n wrappers already in place from prior slice
Written by AI agent working for @jtmorris. Model: grok-build-0.1.
2026-05-24 20:58:31 +00:00
|
|
|
|
root.isConnected = false;
|
|
|
|
|
|
root.tailscaleIP = "";
|
|
|
|
|
|
root.currentExitNode = "";
|
|
|
|
|
|
root.peers = [];
|
|
|
|
|
|
ToastService.showError("tailscalectl", I18n.tr(TailscaleLib.formatError("status")));
|
2026-05-15 19:14:49 -07:00
|
|
|
|
}
|
2026-05-22 06:34:08 +00:00
|
|
|
|
|
feat(proc): direct drop-in port from 4x raw Process to Proc singleton (exact poll-act-poll behavior preserved)
- Removed import Quickshell.Io + all 4 Process { toggleProcess, copyProcess, exitNodeProcess, statusCheck }
- All one-shot commands now use Proc.runCommand(id, argv, (stdout, exitCode) => {...})
- _pendingAction moved to clean root property (was hacked onto statusCheck object)
- Introduced _runStatusCheck() helper + updated wrappers (toggleTailscale, refreshStatus, setExitNode, copyToClipboard, _runNextCopy)
- Exact same sequencing and defensive logic:
* toggle: set pending → status poll for truth → decide up/down → act → post-act status verify
* copy retry state machine unchanged (just Proc instead of .command/.running)
* exit-node and generic refresh paths identical
- Added explicit comment documenting why the poll-act-poll exists (defensive, not forbidden state per AGENTS.md)
- stderr detail dropped from action errors (per chosen A strategy; generic messages only)
- All new JS follows repo ; + {} style
- I18n wrappers already in place from prior slice
Written by AI agent working for @jtmorris. Model: grok-build-0.1.
2026-05-24 20:58:31 +00:00
|
|
|
|
const cmd = TailscaleLib.commandForPendingAction(root._pendingAction, root.isConnected);
|
2026-05-23 04:41:40 +00:00
|
|
|
|
if (cmd) {
|
feat(proc): direct drop-in port from 4x raw Process to Proc singleton (exact poll-act-poll behavior preserved)
- Removed import Quickshell.Io + all 4 Process { toggleProcess, copyProcess, exitNodeProcess, statusCheck }
- All one-shot commands now use Proc.runCommand(id, argv, (stdout, exitCode) => {...})
- _pendingAction moved to clean root property (was hacked onto statusCheck object)
- Introduced _runStatusCheck() helper + updated wrappers (toggleTailscale, refreshStatus, setExitNode, copyToClipboard, _runNextCopy)
- Exact same sequencing and defensive logic:
* toggle: set pending → status poll for truth → decide up/down → act → post-act status verify
* copy retry state machine unchanged (just Proc instead of .command/.running)
* exit-node and generic refresh paths identical
- Added explicit comment documenting why the poll-act-poll exists (defensive, not forbidden state per AGENTS.md)
- stderr detail dropped from action errors (per chosen A strategy; generic messages only)
- All new JS follows repo ; + {} style
- I18n wrappers already in place from prior slice
Written by AI agent working for @jtmorris. Model: grok-build-0.1.
2026-05-24 20:58:31 +00:00
|
|
|
|
// Exact same decision point as before: act based on fresh poll truth, then verify.
|
|
|
|
|
|
Proc.runCommand("tailscale-toggle", cmd, (out, c) => {
|
|
|
|
|
|
if (c !== 0) {
|
|
|
|
|
|
const action = root.isConnected ? "disconnect" : "connect";
|
|
|
|
|
|
// Note: Proc callback provides no stderr (per chosen strategy); generic error only.
|
|
|
|
|
|
ToastService.showError("tailscalectl", I18n.tr(TailscaleLib.formatError(action)));
|
|
|
|
|
|
}
|
|
|
|
|
|
root._pendingAction = "";
|
|
|
|
|
|
root._runStatusCheck(); // post-action verification poll (exact behavior)
|
|
|
|
|
|
});
|
|
|
|
|
|
} else {
|
|
|
|
|
|
root._pendingAction = "";
|
2026-05-22 06:34:08 +00:00
|
|
|
|
}
|
feat(proc): direct drop-in port from 4x raw Process to Proc singleton (exact poll-act-poll behavior preserved)
- Removed import Quickshell.Io + all 4 Process { toggleProcess, copyProcess, exitNodeProcess, statusCheck }
- All one-shot commands now use Proc.runCommand(id, argv, (stdout, exitCode) => {...})
- _pendingAction moved to clean root property (was hacked onto statusCheck object)
- Introduced _runStatusCheck() helper + updated wrappers (toggleTailscale, refreshStatus, setExitNode, copyToClipboard, _runNextCopy)
- Exact same sequencing and defensive logic:
* toggle: set pending → status poll for truth → decide up/down → act → post-act status verify
* copy retry state machine unchanged (just Proc instead of .command/.running)
* exit-node and generic refresh paths identical
- Added explicit comment documenting why the poll-act-poll exists (defensive, not forbidden state per AGENTS.md)
- stderr detail dropped from action errors (per chosen A strategy; generic messages only)
- All new JS follows repo ; + {} style
- I18n wrappers already in place from prior slice
Written by AI agent working for @jtmorris. Model: grok-build-0.1.
2026-05-24 20:58:31 +00:00
|
|
|
|
});
|
2026-05-15 19:14:49 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function toggleTailscale() {
|
feat(proc): direct drop-in port from 4x raw Process to Proc singleton (exact poll-act-poll behavior preserved)
- Removed import Quickshell.Io + all 4 Process { toggleProcess, copyProcess, exitNodeProcess, statusCheck }
- All one-shot commands now use Proc.runCommand(id, argv, (stdout, exitCode) => {...})
- _pendingAction moved to clean root property (was hacked onto statusCheck object)
- Introduced _runStatusCheck() helper + updated wrappers (toggleTailscale, refreshStatus, setExitNode, copyToClipboard, _runNextCopy)
- Exact same sequencing and defensive logic:
* toggle: set pending → status poll for truth → decide up/down → act → post-act status verify
* copy retry state machine unchanged (just Proc instead of .command/.running)
* exit-node and generic refresh paths identical
- Added explicit comment documenting why the poll-act-poll exists (defensive, not forbidden state per AGENTS.md)
- stderr detail dropped from action errors (per chosen A strategy; generic messages only)
- All new JS follows repo ; + {} style
- I18n wrappers already in place from prior slice
Written by AI agent working for @jtmorris. Model: grok-build-0.1.
2026-05-24 20:58:31 +00:00
|
|
|
|
root._pendingAction = "toggle";
|
|
|
|
|
|
root._runStatusCheck();
|
2026-05-23 04:41:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function refreshStatus() {
|
feat(proc): direct drop-in port from 4x raw Process to Proc singleton (exact poll-act-poll behavior preserved)
- Removed import Quickshell.Io + all 4 Process { toggleProcess, copyProcess, exitNodeProcess, statusCheck }
- All one-shot commands now use Proc.runCommand(id, argv, (stdout, exitCode) => {...})
- _pendingAction moved to clean root property (was hacked onto statusCheck object)
- Introduced _runStatusCheck() helper + updated wrappers (toggleTailscale, refreshStatus, setExitNode, copyToClipboard, _runNextCopy)
- Exact same sequencing and defensive logic:
* toggle: set pending → status poll for truth → decide up/down → act → post-act status verify
* copy retry state machine unchanged (just Proc instead of .command/.running)
* exit-node and generic refresh paths identical
- Added explicit comment documenting why the poll-act-poll exists (defensive, not forbidden state per AGENTS.md)
- stderr detail dropped from action errors (per chosen A strategy; generic messages only)
- All new JS follows repo ; + {} style
- I18n wrappers already in place from prior slice
Written by AI agent working for @jtmorris. Model: grok-build-0.1.
2026-05-24 20:58:31 +00:00
|
|
|
|
root._runStatusCheck();
|
2026-05-15 19:14:49 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-18 18:27:41 +00:00
|
|
|
|
function setExitNode(hostname) {
|
feat(proc): direct drop-in port from 4x raw Process to Proc singleton (exact poll-act-poll behavior preserved)
- Removed import Quickshell.Io + all 4 Process { toggleProcess, copyProcess, exitNodeProcess, statusCheck }
- All one-shot commands now use Proc.runCommand(id, argv, (stdout, exitCode) => {...})
- _pendingAction moved to clean root property (was hacked onto statusCheck object)
- Introduced _runStatusCheck() helper + updated wrappers (toggleTailscale, refreshStatus, setExitNode, copyToClipboard, _runNextCopy)
- Exact same sequencing and defensive logic:
* toggle: set pending → status poll for truth → decide up/down → act → post-act status verify
* copy retry state machine unchanged (just Proc instead of .command/.running)
* exit-node and generic refresh paths identical
- Added explicit comment documenting why the poll-act-poll exists (defensive, not forbidden state per AGENTS.md)
- stderr detail dropped from action errors (per chosen A strategy; generic messages only)
- All new JS follows repo ; + {} style
- I18n wrappers already in place from prior slice
Written by AI agent working for @jtmorris. Model: grok-build-0.1.
2026-05-24 20:58:31 +00:00
|
|
|
|
const cmd = TailscaleLib.makeExitNodeCommand(hostname);
|
2026-05-22 20:46:37 +00:00
|
|
|
|
if (!cmd) {
|
feat(proc): direct drop-in port from 4x raw Process to Proc singleton (exact poll-act-poll behavior preserved)
- Removed import Quickshell.Io + all 4 Process { toggleProcess, copyProcess, exitNodeProcess, statusCheck }
- All one-shot commands now use Proc.runCommand(id, argv, (stdout, exitCode) => {...})
- _pendingAction moved to clean root property (was hacked onto statusCheck object)
- Introduced _runStatusCheck() helper + updated wrappers (toggleTailscale, refreshStatus, setExitNode, copyToClipboard, _runNextCopy)
- Exact same sequencing and defensive logic:
* toggle: set pending → status poll for truth → decide up/down → act → post-act status verify
* copy retry state machine unchanged (just Proc instead of .command/.running)
* exit-node and generic refresh paths identical
- Added explicit comment documenting why the poll-act-poll exists (defensive, not forbidden state per AGENTS.md)
- stderr detail dropped from action errors (per chosen A strategy; generic messages only)
- All new JS follows repo ; + {} style
- I18n wrappers already in place from prior slice
Written by AI agent working for @jtmorris. Model: grok-build-0.1.
2026-05-24 20:58:31 +00:00
|
|
|
|
ToastService.showError("tailscalectl", I18n.tr(TailscaleLib.getStrings().invalidExitNodeHostname));
|
|
|
|
|
|
return;
|
2026-05-22 20:46:37 +00:00
|
|
|
|
}
|
feat(proc): direct drop-in port from 4x raw Process to Proc singleton (exact poll-act-poll behavior preserved)
- Removed import Quickshell.Io + all 4 Process { toggleProcess, copyProcess, exitNodeProcess, statusCheck }
- All one-shot commands now use Proc.runCommand(id, argv, (stdout, exitCode) => {...})
- _pendingAction moved to clean root property (was hacked onto statusCheck object)
- Introduced _runStatusCheck() helper + updated wrappers (toggleTailscale, refreshStatus, setExitNode, copyToClipboard, _runNextCopy)
- Exact same sequencing and defensive logic:
* toggle: set pending → status poll for truth → decide up/down → act → post-act status verify
* copy retry state machine unchanged (just Proc instead of .command/.running)
* exit-node and generic refresh paths identical
- Added explicit comment documenting why the poll-act-poll exists (defensive, not forbidden state per AGENTS.md)
- stderr detail dropped from action errors (per chosen A strategy; generic messages only)
- All new JS follows repo ; + {} style
- I18n wrappers already in place from prior slice
Written by AI agent working for @jtmorris. Model: grok-build-0.1.
2026-05-24 20:58:31 +00:00
|
|
|
|
Proc.runCommand("tailscale-exit", cmd, (stdout, code) => {
|
|
|
|
|
|
if (code !== 0) {
|
|
|
|
|
|
// Note: no stderr detail available from Proc (accepted per plan).
|
|
|
|
|
|
ToastService.showError("tailscalectl", I18n.tr(TailscaleLib.formatError("set")));
|
|
|
|
|
|
}
|
|
|
|
|
|
root._runStatusCheck();
|
|
|
|
|
|
});
|
2026-05-18 18:27:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-17 23:00:22 +00:00
|
|
|
|
function copyToClipboard(text) {
|
feat(proc): direct drop-in port from 4x raw Process to Proc singleton (exact poll-act-poll behavior preserved)
- Removed import Quickshell.Io + all 4 Process { toggleProcess, copyProcess, exitNodeProcess, statusCheck }
- All one-shot commands now use Proc.runCommand(id, argv, (stdout, exitCode) => {...})
- _pendingAction moved to clean root property (was hacked onto statusCheck object)
- Introduced _runStatusCheck() helper + updated wrappers (toggleTailscale, refreshStatus, setExitNode, copyToClipboard, _runNextCopy)
- Exact same sequencing and defensive logic:
* toggle: set pending → status poll for truth → decide up/down → act → post-act status verify
* copy retry state machine unchanged (just Proc instead of .command/.running)
* exit-node and generic refresh paths identical
- Added explicit comment documenting why the poll-act-poll exists (defensive, not forbidden state per AGENTS.md)
- stderr detail dropped from action errors (per chosen A strategy; generic messages only)
- All new JS follows repo ; + {} style
- I18n wrappers already in place from prior slice
Written by AI agent working for @jtmorris. Model: grok-build-0.1.
2026-05-24 20:58:31 +00:00
|
|
|
|
root._copyText = text;
|
|
|
|
|
|
root._copyIndex = 0;
|
|
|
|
|
|
root._runNextCopy();
|
2026-05-21 06:37:14 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-22 21:35:07 +00:00
|
|
|
|
function _runNextCopy() {
|
feat(proc): direct drop-in port from 4x raw Process to Proc singleton (exact poll-act-poll behavior preserved)
- Removed import Quickshell.Io + all 4 Process { toggleProcess, copyProcess, exitNodeProcess, statusCheck }
- All one-shot commands now use Proc.runCommand(id, argv, (stdout, exitCode) => {...})
- _pendingAction moved to clean root property (was hacked onto statusCheck object)
- Introduced _runStatusCheck() helper + updated wrappers (toggleTailscale, refreshStatus, setExitNode, copyToClipboard, _runNextCopy)
- Exact same sequencing and defensive logic:
* toggle: set pending → status poll for truth → decide up/down → act → post-act status verify
* copy retry state machine unchanged (just Proc instead of .command/.running)
* exit-node and generic refresh paths identical
- Added explicit comment documenting why the poll-act-poll exists (defensive, not forbidden state per AGENTS.md)
- stderr detail dropped from action errors (per chosen A strategy; generic messages only)
- All new JS follows repo ; + {} style
- I18n wrappers already in place from prior slice
Written by AI agent working for @jtmorris. Model: grok-build-0.1.
2026-05-24 20:58:31 +00:00
|
|
|
|
const cmds = TailscaleLib.getClipboardCommands(root._copyText);
|
2026-05-22 21:35:07 +00:00
|
|
|
|
if (root._copyIndex >= cmds.length) {
|
feat(proc): direct drop-in port from 4x raw Process to Proc singleton (exact poll-act-poll behavior preserved)
- Removed import Quickshell.Io + all 4 Process { toggleProcess, copyProcess, exitNodeProcess, statusCheck }
- All one-shot commands now use Proc.runCommand(id, argv, (stdout, exitCode) => {...})
- _pendingAction moved to clean root property (was hacked onto statusCheck object)
- Introduced _runStatusCheck() helper + updated wrappers (toggleTailscale, refreshStatus, setExitNode, copyToClipboard, _runNextCopy)
- Exact same sequencing and defensive logic:
* toggle: set pending → status poll for truth → decide up/down → act → post-act status verify
* copy retry state machine unchanged (just Proc instead of .command/.running)
* exit-node and generic refresh paths identical
- Added explicit comment documenting why the poll-act-poll exists (defensive, not forbidden state per AGENTS.md)
- stderr detail dropped from action errors (per chosen A strategy; generic messages only)
- All new JS follows repo ; + {} style
- I18n wrappers already in place from prior slice
Written by AI agent working for @jtmorris. Model: grok-build-0.1.
2026-05-24 20:58:31 +00:00
|
|
|
|
ToastService.showError("tailscalectl", I18n.tr(TailscaleLib.formatError("clipboard")));
|
|
|
|
|
|
return;
|
2026-05-20 19:37:08 +00:00
|
|
|
|
}
|
feat(proc): direct drop-in port from 4x raw Process to Proc singleton (exact poll-act-poll behavior preserved)
- Removed import Quickshell.Io + all 4 Process { toggleProcess, copyProcess, exitNodeProcess, statusCheck }
- All one-shot commands now use Proc.runCommand(id, argv, (stdout, exitCode) => {...})
- _pendingAction moved to clean root property (was hacked onto statusCheck object)
- Introduced _runStatusCheck() helper + updated wrappers (toggleTailscale, refreshStatus, setExitNode, copyToClipboard, _runNextCopy)
- Exact same sequencing and defensive logic:
* toggle: set pending → status poll for truth → decide up/down → act → post-act status verify
* copy retry state machine unchanged (just Proc instead of .command/.running)
* exit-node and generic refresh paths identical
- Added explicit comment documenting why the poll-act-poll exists (defensive, not forbidden state per AGENTS.md)
- stderr detail dropped from action errors (per chosen A strategy; generic messages only)
- All new JS follows repo ; + {} style
- I18n wrappers already in place from prior slice
Written by AI agent working for @jtmorris. Model: grok-build-0.1.
2026-05-24 20:58:31 +00:00
|
|
|
|
Proc.runCommand("tailscale-copy-" + root._copyIndex, cmds[root._copyIndex], (stdout, code) => {
|
|
|
|
|
|
if (code === 0) {
|
|
|
|
|
|
ToastService.showInfo(I18n.tr(TailscaleLib.getStrings().copied).arg(root._copyText));
|
|
|
|
|
|
} else {
|
|
|
|
|
|
root._copyIndex += 1;
|
|
|
|
|
|
root._runNextCopy();
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
2026-05-17 23:00:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-15 19:28:37 -07:00
|
|
|
|
popoutContent: Component {
|
|
|
|
|
|
PopoutComponent {
|
2026-05-24 20:57:49 +00:00
|
|
|
|
headerText: I18n.tr(TailscaleLib.getStrings().header)
|
|
|
|
|
|
detailsText: root.isConnected ? I18n.tr(TailscaleLib.getStrings().connected) : I18n.tr(TailscaleLib.getStrings().disconnected)
|
2026-05-15 19:28:37 -07:00
|
|
|
|
showCloseButton: true
|
|
|
|
|
|
|
2026-05-17 21:32:46 +00:00
|
|
|
|
Item {
|
2026-05-17 21:59:59 +00:00
|
|
|
|
id: contentItem
|
2026-05-15 19:28:37 -07:00
|
|
|
|
width: parent.width
|
2026-05-17 21:59:59 +00:00
|
|
|
|
height: Theme.spacingM + statusRow.implicitHeight + Theme.spacingM + peerList.height + Theme.spacingM
|
2026-05-15 19:28:37 -07:00
|
|
|
|
|
|
|
|
|
|
Row {
|
2026-05-17 21:32:46 +00:00
|
|
|
|
id: statusRow
|
|
|
|
|
|
y: Theme.spacingM
|
2026-05-15 19:28:37 -07:00
|
|
|
|
width: parent.width
|
|
|
|
|
|
spacing: Theme.spacingS
|
2026-05-17 21:11:14 +00:00
|
|
|
|
anchors.left: parent.left
|
|
|
|
|
|
anchors.leftMargin: Theme.spacingM
|
2026-05-17 21:32:46 +00:00
|
|
|
|
anchors.right: parent.right
|
2026-05-17 21:11:14 +00:00
|
|
|
|
anchors.rightMargin: Theme.spacingM
|
|
|
|
|
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
|
|
hoverEnabled: true
|
|
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
|
|
width: toggleIcon.implicitWidth
|
|
|
|
|
|
height: toggleIcon.implicitHeight
|
2026-05-17 21:32:46 +00:00
|
|
|
|
onClicked: {
|
|
|
|
|
|
root.toggleTailscale()
|
|
|
|
|
|
}
|
2026-05-17 21:11:14 +00:00
|
|
|
|
|
|
|
|
|
|
DankIcon {
|
|
|
|
|
|
id: toggleIcon
|
|
|
|
|
|
name: root.isConnected ? "power" : "power_off"
|
|
|
|
|
|
size: Theme.iconSize
|
|
|
|
|
|
color: Theme.primary
|
|
|
|
|
|
anchors.centerIn: parent
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-05-15 19:28:37 -07:00
|
|
|
|
|
|
|
|
|
|
StyledText {
|
2026-05-17 21:11:14 +00:00
|
|
|
|
text: root.tailscaleIP || "—"
|
|
|
|
|
|
font.pixelSize: Theme.fontSizeSmall
|
|
|
|
|
|
color: Theme.primary
|
2026-05-15 19:28:37 -07:00
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Item { width: 1; height: 1; Layout.fillWidth: true }
|
|
|
|
|
|
|
|
|
|
|
|
StyledText {
|
2026-05-24 20:57:49 +00:00
|
|
|
|
text: I18n.tr(TailscaleLib.getStrings().exitNodePrefix) + (root.currentExitNode || I18n.tr(TailscaleLib.getStrings().none))
|
2026-05-15 19:28:37 -07:00
|
|
|
|
font.pixelSize: Theme.fontSizeSmall
|
2026-05-17 21:11:14 +00:00
|
|
|
|
color: Theme.surfaceVariantText
|
2026-05-15 19:28:37 -07:00
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
|
|
}
|
2026-05-18 18:27:41 +00:00
|
|
|
|
|
|
|
|
|
|
MouseArea {
|
2026-05-22 06:33:33 +00:00
|
|
|
|
visible: TailscaleLib.shouldShowClearExitNode(root.currentExitNode)
|
2026-05-18 18:27:41 +00:00
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
|
|
hoverEnabled: true
|
|
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
|
|
width: clearExitNodeText.implicitWidth
|
|
|
|
|
|
height: clearExitNodeText.implicitHeight
|
|
|
|
|
|
onClicked: {
|
|
|
|
|
|
root.setExitNode("")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
|
|
id: clearExitNodeText
|
|
|
|
|
|
text: "×"
|
|
|
|
|
|
font.pixelSize: Theme.fontSizeSmall
|
|
|
|
|
|
color: Theme.surfaceVariantText
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-05-15 19:28:37 -07:00
|
|
|
|
}
|
2026-05-17 21:59:59 +00:00
|
|
|
|
|
|
|
|
|
|
ListView {
|
|
|
|
|
|
id: peerList
|
|
|
|
|
|
y: Theme.spacingM + statusRow.implicitHeight + Theme.spacingM
|
|
|
|
|
|
width: parent.width - Theme.spacingM * 2
|
|
|
|
|
|
height: Math.min(root.peers.length * (Theme.fontSizeSmall + Theme.spacingXS), 200)
|
|
|
|
|
|
anchors.left: parent.left
|
|
|
|
|
|
anchors.leftMargin: Theme.spacingM
|
|
|
|
|
|
model: root.peers
|
|
|
|
|
|
interactive: true
|
|
|
|
|
|
boundsBehavior: Flickable.DragAndOvershootBounds
|
|
|
|
|
|
|
|
|
|
|
|
delegate: Item {
|
|
|
|
|
|
width: peerList.width
|
|
|
|
|
|
height: Theme.fontSizeSmall + Theme.spacingXS
|
|
|
|
|
|
|
|
|
|
|
|
Row {
|
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
|
spacing: Theme.spacingS
|
|
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
|
|
|
2026-05-17 23:00:22 +00:00
|
|
|
|
MouseArea {
|
|
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
|
|
hoverEnabled: true
|
|
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
|
|
width: peerHostnameText.implicitWidth
|
|
|
|
|
|
height: peerHostnameText.implicitHeight
|
|
|
|
|
|
onClicked: {
|
|
|
|
|
|
root.copyToClipboard(modelData.hostname)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
|
|
id: peerHostnameText
|
|
|
|
|
|
text: modelData.hostname
|
|
|
|
|
|
font.pixelSize: Theme.fontSizeSmall
|
|
|
|
|
|
color: modelData.online ? Theme.primary : Theme.surfaceVariantText
|
|
|
|
|
|
}
|
2026-05-17 21:59:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-17 23:00:22 +00:00
|
|
|
|
MouseArea {
|
|
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
|
|
hoverEnabled: true
|
|
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
|
|
width: peerIpText.implicitWidth
|
|
|
|
|
|
height: peerIpText.implicitHeight
|
|
|
|
|
|
onClicked: {
|
|
|
|
|
|
root.copyToClipboard(modelData.ip)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
|
|
id: peerIpText
|
|
|
|
|
|
text: modelData.ip
|
|
|
|
|
|
font.pixelSize: Theme.fontSizeSmall
|
|
|
|
|
|
color: Theme.surfaceVariantText
|
2026-05-18 18:27:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
|
|
visible: modelData.exitNode
|
|
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
|
|
hoverEnabled: true
|
|
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
|
|
width: exitNodeButton.implicitWidth
|
|
|
|
|
|
height: exitNodeButton.implicitHeight
|
|
|
|
|
|
onClicked: {
|
|
|
|
|
|
root.setExitNode(modelData.hostname)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
|
|
id: exitNodeButton
|
|
|
|
|
|
text: "↗"
|
|
|
|
|
|
font.pixelSize: Theme.fontSizeSmall
|
2026-05-22 06:33:33 +00:00
|
|
|
|
color: TailscaleLib.isActiveExitNode(root.currentExitNode, modelData.hostname) ? Theme.primary : Theme.surfaceVariantText
|
2026-05-17 23:00:22 +00:00
|
|
|
|
}
|
2026-05-17 21:59:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-05-15 19:28:37 -07:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-17 21:23:01 +00:00
|
|
|
|
MouseArea {
|
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
|
acceptedButtons: Qt.RightButton
|
2026-05-17 21:32:46 +00:00
|
|
|
|
onClicked: {
|
|
|
|
|
|
root.toggleTailscale()
|
|
|
|
|
|
}
|
2026-05-17 21:23:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-15 19:10:50 -07:00
|
|
|
|
horizontalBarPill: Component {
|
2026-05-17 21:18:02 +00:00
|
|
|
|
Row {
|
|
|
|
|
|
spacing: Theme.spacingS
|
|
|
|
|
|
|
2026-05-17 21:23:01 +00:00
|
|
|
|
DankIcon {
|
|
|
|
|
|
name: root.isConnected ? "vpn_key" : "vpn_key_off"
|
|
|
|
|
|
size: Theme.iconSize
|
|
|
|
|
|
color: root.isConnected ? Theme.primary : Theme.surfaceText
|
2026-05-15 19:14:49 -07:00
|
|
|
|
}
|
2026-05-15 19:10:50 -07:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
verticalBarPill: Component {
|
2026-05-17 21:18:02 +00:00
|
|
|
|
Column {
|
|
|
|
|
|
spacing: Theme.spacingXS
|
|
|
|
|
|
|
2026-05-17 21:23:01 +00:00
|
|
|
|
DankIcon {
|
|
|
|
|
|
name: root.isConnected ? "vpn_key" : "vpn_key_off"
|
|
|
|
|
|
size: Theme.iconSize
|
|
|
|
|
|
color: root.isConnected ? Theme.primary : Theme.surfaceText
|
2026-05-15 19:14:49 -07:00
|
|
|
|
}
|
2026-05-15 19:10:50 -07:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-05-22 20:46:37 +00:00
|
|
|
|
}
|