Repository navigation
Build bar panel content on first open instead of at startup - #15044
Conversation
KeyboardPanel takes an optional `content` component, loaded the first time the panel opens and kept afterwards. Panels that declare children directly keep building them eagerly. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Every bar panel built its whole card on every monitor at startup, open or not. Move each KeyboardPanel's card into its lazy content slot, reach the few items root-level code needs through panel.loadedContent, and guard the code that runs while the panel is closed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
| assert(/property Component content: null/.test(keyboardPanel), 'keyboard panels take their content as a component') | ||
| assert(/active: !!root\.content && \(root\.open \|\| root\.contentRequested\)/.test(keyboardPanel), 'keyboard panel content is built when the panel opens, not at startup') | ||
| assert(/if \(content\) contentRequested = true/.test(keyboardPanel), 'keyboard panel content stays built after its first open') | ||
| assert(/default property alias contentItem: contentHolder\.children/.test(keyboardPanel), 'keyboard panels that declare children directly still build them eagerly') |
There was a problem hiding this comment.
First-open behavior goes untested
These checks match source text, while the runtime fixture calls ensureContent() with the panel closed. Neither exercises loading through open, keeping the same item after close/reopen, or keyboard focus on first open. A regression in those paths could still pass.
Add a runtime open/close/reopen check that compares the loaded item and checks focus.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
The lazy content Loader adds a level between the content and the card. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Resolves the conflict with omacom#15044, which moved both panels' focusTarget to panel.loadedContent on the line beside centerOnBar: keeps quattro's focusTarget and this branch's centerOnBar: false. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Quattro now builds the calendar's content lazily as a KeyboardPanel content Component (omacom#15044), so heroRow is out of scope where the popup width is computed. The content exposes heroWidth, and contentWidth reads it through panel.loadedContent, the way contentHeight already reads loadedContentHeight. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Since omacom#15044 the panel builds its content on first open, so the root-level skyFx.replay() threw a ReferenceError and the sky never faded in. The sky now replays itself on creation and on each reopen. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Since omacom#15044 the panel's card is a lazily loaded content component, so its ids are out of reach of root-level bindings. rowOrderPinned read deviceListHover directly and would have failed to resolve, leaving the pin permanently off; it now reaches the handler through panel.loadedContent, as heroStatus does. The section headings take quattro's translated strings. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The network panel now builds its content on first open (#15044), so `keyCatcher` is no longer an id the panel root can reach and the test's focus probe threw a ReferenceError after quattro was merged in. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Since this branch was cut, quattro builds panel content on first open (omacom#15044), routes every string through I18n with catalogs (omacom#15326), restyled the copy menu for right-to-left layouts, and qualifies palette references for Qt 6.12. The branch's intent is ported onto that structure rather than the old one restored. The machine list, its search field and the shared copy menu now live inside the lazily built content, so root-level code reaches them through `panel.loadedContent` like the panel's other items, and every root caller tolerates them being null before the first open. The account-switch reset still records the last account seen while the panel has never opened, so the first open after a switch is not mistaken for one. The shared copy menu takes quattro's right-to-left placement, opening from whichever end the row's copy button sits at, and `Commons.Color`. The machine count, search placeholder, loading and no-match texts get English catalog entries, with the counts formatted for the language. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Since quattro builds panel content on first open (omacom#15044), ids inside `content` are invisible to root-level code. `scrollCursorIntoView()` names `peerFlick` from the root, so on the merged tree j/k through the machines threw a ReferenceError and the highlighted row never scrolled into view. Mirror it through `panel.loadedContent` like the panel's other scrollers. The lazy-content test now fails any first-party panel whose root-level code names an id that lives only inside its content, since that error surfaces only when the code runs. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Resolve conflicts with the virtualized machine list (omacom#7623) and the panel translations (omacom#15326): publishPeers now writes the cached _peers that the visible peers list derives from, the offline switch sits beside the counted MACHINES header, and the new switch, empty-state and Offline strings are English catalog entries. The runtime fixture builds the lazily created panel content (omacom#15044), feeds statuses as full peer fetches, and qualifies its palette references (omacom#14553). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01CFeF4GVPAdJb4fXF29e79S
What
KeyboardPanelgets an optionalcontentcomponent slot. ALoaderinside the card builds it the first time the panel opens and keeps it from then on, so reopening is instant and in-progress state (scroll position, an edit) survives a close. Panels that still declare children directly keep the old eager behaviour.Every first-party bar panel moves its card into that slot: network, agents, audio, bluetooth, elsewhen, tailscale, monitor, weather, clock, dropbox, power.
Why
Each bar is built once per monitor, and each bar widget's
Panel.qmlbuilt its whole card (network ~2150 lines, agents ~2000, audio ~1300, …) at startup whether or not it was ever opened.How the conversion works
Ids inside the content are no longer visible to the rest of the file, so for each panel:
focusTargetandcontentHeightreadpanel.loadedContent/panel.loadedContentHeight.property aliason the content root. Panels with few references read them throughpanel.loadedContentat the call site; panels with many (agents, elsewhen, tailscale, dropbox) mirror them as nullablereadonly property Itemon the root, so existing null guards keep working.onRestrictedChanged, elsewhen's search/zone bindings, the spin fallback timer) is null-guarded. Elsewhen's opening spin drives the hero, so its open handler builds the content first withpanel.ensureContent().id: contentbecamescrollContentso it no longer shadows the newcontentproperty.No timers, processes or IPC handlers lived inside any panel's content, so nothing that has to run while closed moved.
Numbers
One 2560x1440 monitor, shell started fresh three times per build, measured 10s after the first IPC answer:
shell pingThe memory saving grows with each extra monitor. Time to first ping doesn't change because the shell answers IPC before the bar's plugins finish loading.
Verification
quattro: they match, and the only differences are live data (times, scan results). No QML warnings or errors in the journal.jmoves the audio cursor, and Space flips elsewhen to the globe.test/shell.d/keyboard-panel-lazy-test.shcovers the lazy contract. A runtime fixture drives the realKeyboardPanelthrough open, close and reopen, unmapped, and checks that nothing is built while closed, opening builds it, the focus target resolves, and close and reopen keep the same item. A static check makes every first-partyKeyboardPanelpasscontent:and gives every root-level mirror a matching alias. Breaking the keep-after-close latch makes the test fail../test/shellpasses apart from the known pre-existing failures.🤖 Generated with Claude Code