From 18e059d9a45668a87ecbb0b02b723ac79a715cd6 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sun, 11 Oct 2026 08:58:19 +0200 Subject: [PATCH] Show the remote session indicator only during a remote session (#14981) Hovering the indicators revealed it dimmed alongside the ones that can be switched on, though there is nothing to do with it there. An indicator can now opt out of that reveal, and remote session does. Co-authored-by: Claude Opus 5.5 --- shell/Ui/BarIndicator.qml | 7 +++++-- shell/plugins/bar/indicators/RemoteSession.qml | 3 +-- test/shell.d/remote-session-test.sh | 8 +++++++- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/shell/Ui/BarIndicator.qml b/shell/Ui/BarIndicator.qml index 67709e1d..73f7480f 100644 --- a/shell/Ui/BarIndicator.qml +++ b/shell/Ui/BarIndicator.qml @@ -13,9 +13,12 @@ BarIconButton { property string indicatorBlock: "single" property var indicatorHost: null property var activeOverride: null + // An indicator with nothing to turn on, such as a remote session, shows only + // while it is active, never among the inactive ones a hover reveals. + property bool revealWhenInactive: true readonly property bool effectiveActive: activeOverride === null || activeOverride === undefined ? active : activeOverride === true - readonly property bool belongsInBlock: indicatorBlock === "active" ? effectiveActive : (indicatorBlock === "inactive" ? !effectiveActive : true) - readonly property bool inactiveRevealed: !effectiveActive && !!indicatorHost && indicatorHost.revealInactiveIndicators + readonly property bool belongsInBlock: indicatorBlock === "active" ? effectiveActive : (indicatorBlock === "inactive" ? !effectiveActive && revealWhenInactive : true) + readonly property bool inactiveRevealed: !effectiveActive && revealWhenInactive && !!indicatorHost && indicatorHost.revealInactiveIndicators function extractData(raw) { return Util.parseModuleJson(raw) diff --git a/shell/plugins/bar/indicators/RemoteSession.qml b/shell/plugins/bar/indicators/RemoteSession.qml index 0f0eef7d..32f793f7 100644 --- a/shell/plugins/bar/indicators/RemoteSession.qml +++ b/shell/plugins/bar/indicators/RemoteSession.qml @@ -10,11 +10,10 @@ BarIndicator { active: remoteSessionService ? remoteSessionService.active : false activeText: "󰢹" - inactiveText: "󰢹" activeTooltipText: peers.length > 0 ? "Remote session from " + peers.join(", ") : "Remote session" - inactiveTooltipText: "Remote Session" useActiveColor: true activeColor: Commons.Color.urgent + revealWhenInactive: false Connections { target: root.indicatorHost diff --git a/test/shell.d/remote-session-test.sh b/test/shell.d/remote-session-test.sh index ea856eb6..3ddc1187 100644 --- a/test/shell.d/remote-session-test.sh +++ b/test/shell.d/remote-session-test.sh @@ -36,7 +36,13 @@ assert(widgetManifest.barWidget.schema.find(field => field.key === 'items').opti assert(indicator.includes('firstPartyServiceFor("omarchy.remote-session")'), 'indicator reads the remote session service') assert(indicator.includes('"Remote session from " + peers.join(", ")'), 'active tooltip names the connected peers') assert(indicator.includes('useActiveColor: true') && indicator.includes('activeColor: Commons.Color.urgent'), 'active remote session uses the theme danger color') -assertEqual(indicator.match(/activeText: "([^"]+)"/)[1], indicator.match(/inactiveText: "([^"]+)"/)[1], 'remote session keeps the same icon in both states') +assert(indicator.includes('revealWhenInactive: false'), 'remote session shows only while a session is active, not among the inactive indicators a hover reveals') +const barIndicator = fs.readFileSync(path.join(root, 'shell/Ui/BarIndicator.qml'), 'utf8') +assert( + /belongsInBlock:[^\n]*indicatorBlock === "inactive" \? !effectiveActive && revealWhenInactive/.test(barIndicator) + && /inactiveRevealed: !effectiveActive && revealWhenInactive &&/.test(barIndicator), + 'an indicator that opts out is neither placed nor revealed among the inactive ones' +) assert(!indicator.includes('visible:'), 'remote session uses the shared indicator visibility and hover behavior') assert(indicator.includes('root.remoteSessionService.refresh()'), 'indicator refresh re-probes the service')