Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

feat(canvas): remote access on/off toggle in the toolbar

reviewc6798b49e3fe
diff --git a/src/renderer/canvas/Canvas.tsx b/src/renderer/canvas/Canvas.tsx
index f84574c90..d433f7f8a 100644
--- a/src/renderer/canvas/Canvas.tsx
+++ b/src/renderer/canvas/Canvas.tsx
@@ -68,6 +68,7 @@ import {
wheelGestureReporting
} from './wheel-gesture'
import { isBrowserRuntime } from '@renderer/bridge/runtime'
+import { applyPhoneAccess } from '@renderer/lib/phoneAccess'
import { WheelZoomBurstLimiter, clampWheelZoomSpeed, nextWheelZoom } from './wheel-zoom'
import { canCopyFilesToClipboard, selectedLocalFilePaths } from './canvas-file-copy'
import {
@@ -177,6 +178,7 @@ import {
IconPower,
IconProject,
IconRemote,
+ IconRemoteAccess,
IconSave,
IconSearch,
IconSelectAll,
@@ -19924,6 +19926,24 @@ export function Canvas() {
>
<IconPhone />
</button>
+ {/* Remote access on/off at a glance — green = the standing relay host is on, so a paired
+ phone can reach this machine from anywhere. Same switch as the pair popover and
+ Settings → Phone. Hidden on the Server Edition: there is no relay host to start there
+ (the bridge's setPhoneAccess is a no-op), and a toggle that only changed colour would lie. */}
+ {!isBrowserRuntime() && (
+ <button
+ className="cluster-remote"
+ aria-pressed={settings.phoneAccessEnabled}
+ title={
+ settings.phoneAccessEnabled
+ ? 'Remote access is on — click to turn off'
+ : 'Remote access is off — click to turn on'
+ }
+ onClick={() => applyPhoneAccess(!settings.phoneAccessEnabled)}
+ >
+ <IconRemoteAccess />
+ </button>
+ )}
<button
title={commandTooltip('Settings', 'app.settings')}
onClick={() => {
diff --git a/src/renderer/components/PhonePairPopover.tsx b/src/renderer/components/PhonePairPopover.tsx
index d1707da2e..beabdc0be 100644
--- a/src/renderer/components/PhonePairPopover.tsx
+++ b/src/renderer/components/PhonePairPopover.tsx
@@ -2,6 +2,7 @@ import { useEffect } from 'react'
import { createPortal } from 'react-dom'
import { Switch } from '@renderer/ui/Switch'
import { useSettings } from '@renderer/state/settings'
+import { applyPhoneAccess } from '@renderer/lib/phoneAccess'
import { usePhonePairing } from './settings/usePhonePairing'
import { mobileStoreLinks } from '@renderer/lib/links'
import { hostOsFromNavigator, sshServerCopy } from '@shared/ssh-server'
@@ -50,12 +51,10 @@ export function PhonePairPopover({
const gate = pairingGate({ sshKey, sshOpen, relayPlan })
const phoneAccessEnabled = useSettings((s) => s.settings.phoneAccessEnabled)
- const updateSettings = useSettings((s) => s.update)
const togglePhoneAccess = (next: boolean): void => {
- updateSettings({ phoneAccessEnabled: next })
- // Start/stop the standing relay host immediately.
- window.nodeTerminal.remoteHost.setPhoneAccess(next)
+ // Persist + start/stop the standing relay host immediately.
+ applyPhoneAccess(next)
// The relay block is baked into the QR when the listener STARTS — a code already on
// screen doesn't know about this flip, and scanning it would still produce a LAN-only
// pairing (the field failure: works at home, dies on cellular). Regenerate; start()
diff --git a/src/renderer/components/icons.tsx b/src/renderer/components/icons.tsx
index 7de8d0866..fea76379f 100644
--- a/src/renderer/components/icons.tsx
+++ b/src/renderer/components/icons.tsx
@@ -175,6 +175,15 @@ export const IconRemote = () => (
</svg>
)
+/** Remote access (phone relay) on/off — an antenna with signal arcs. Not `IconRemote` (the globe
+ * already means "web view") and not `IconBroadcast` ("share live link"). */
+export const IconRemoteAccess = () => (
+ <svg {...S}>
+ <circle cx="12" cy="9" r="1.8" />
+ <path d="M12 10.8V21M8.5 21h7M8.2 12.8a5.4 5.4 0 0 1 0-7.6M15.8 12.8a5.4 5.4 0 0 0 0-7.6M5.4 15.6a9.4 9.4 0 0 1 0-13.2M18.6 15.6a9.4 9.4 0 0 0 0-13.2" />
+ </svg>
+)
+
export const IconSwitch = () => (
<svg {...S}>
<path d="M7 7h11l-3-3M17 17H6l3 3" />
diff --git a/src/renderer/components/settings/sections/PhoneSection.tsx b/src/renderer/components/settings/sections/PhoneSection.tsx
index 9584cac99..9edc613ee 100644
--- a/src/renderer/components/settings/sections/PhoneSection.tsx
+++ b/src/renderer/components/settings/sections/PhoneSection.tsx
@@ -6,6 +6,7 @@ import { ConfirmDialog } from '../../ConfirmDialog'
import { Button } from '@renderer/ui/Button'
import { Switch } from '@renderer/ui/Switch'
import { useSettings } from '@renderer/state/settings'
+import { applyPhoneAccess } from '@renderer/lib/phoneAccess'
import { usePhonePairing } from '../usePhonePairing'
import { mobileStoreLinks } from '@renderer/lib/links'
import { hostOsFromNavigator, sshServerCopy } from '@shared/ssh-server'
@@ -68,7 +69,6 @@ export function PhoneSection({ isActive }: { isActive: boolean }): React.JSX.Ele
const showWebhook = !isBrowserRuntime()
const phoneAccessEnabled = useSettings((s) => s.settings.phoneAccessEnabled)
- const updateSettings = useSettings((s) => s.update)
const refreshDevices = useCallback(async (): Promise<void> => {
try {
@@ -107,9 +107,8 @@ export function PhoneSection({ isActive }: { isActive: boolean }): React.JSX.Ele
const gate = pairingGate({ sshKey, sshOpen, relayPlan })
const togglePhoneAccess = (next: boolean): void => {
- updateSettings({ phoneAccessEnabled: next })
- // Start/stop the standing relay host immediately.
- window.nodeTerminal.remoteHost.setPhoneAccess(next)
+ // Persist + start/stop the standing relay host immediately.
+ applyPhoneAccess(next)
// The relay block is baked into the QR when the listener STARTS — a code already on
// screen doesn't know about this flip, and scanning it would still produce a LAN-only
// pairing (the field failure: works at home, dies on cellular). Regenerate; start()
diff --git a/src/renderer/lib/phoneAccess.ts b/src/renderer/lib/phoneAccess.ts
new file mode 100644
index 000000000..0533779f1
--- /dev/null
+++ b/src/renderer/lib/phoneAccess.ts
@@ -0,0 +1,12 @@
+import { useSettings } from '../state/settings'
+
+/**
+ * The ONE write path for "Reach this Mac from anywhere" (`settings.phoneAccessEnabled`): persist
+ * the setting AND start/stop the standing relay host immediately. Three surfaces flip it (the
+ * toolbar toggle, the quick-pair popover, Settings → Phone); a caller that only wrote the setting
+ * would leave the host running until the next launch.
+ */
+export function applyPhoneAccess(next: boolean): void {
+ useSettings.getState().update({ phoneAccessEnabled: next })
+ window.nodeTerminal.remoteHost.setPhoneAccess(next)
+}
diff --git a/src/renderer/styles.css b/src/renderer/styles.css
index 86760a851..7573b2d6f 100644
--- a/src/renderer/styles.css
+++ b/src/renderer/styles.css
@@ -6223,6 +6223,15 @@ body,
height: 18px;
}
+/* Remote-access toggle: green while the standing relay host is on, muted while off. */
+.controls-cluster > button.cluster-remote {
+ color: var(--muted);
+}
+.controls-cluster > button.cluster-remote[aria-pressed='true'] {
+ color: var(--success);
+ border-color: color-mix(in srgb, var(--success) 45%, transparent);
+}
+
/* Search button shows the ⌘K shortcut so its purpose is obvious */
.cluster-search {
width: auto !important;