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 <noreply@anthropic.com>
This commit is contained in:
1 parent
cf473b5c5d
commit
18e059d9a4
3 files changed
+13
-5
No files matched your search
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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')
|
||||
|
||||
|
||||
Reference in new issue
Block a user