Repository navigation
Discoveries Command Bar
Part of Discoveries.
The bar on the new tab page is AssistantPanelUIBase.AssistantPanelRootView. Moved into another view, even with its tab in the background, its suggestions, chats, @ and / keep working, and what it opens loads in its own tab. Its "Add tabs or files" button only opens its menu while the new tab page shows, but typing @ opens the same menu.
Snapshots and CIFilter backgrounds can't see web content, which Chromium's GPU process draws. A private CABackdropLayer with a gaussianBlur CAFilter can.
Focusing the previous tab from the new tab page's -viewDidMoveToWindow keeps the new tab page from ever showing. But Dia, still switching tabs, then takes the page's WebContentsHostView out of the window. The page keeps showing through Chromium's compositor layer but takes no clicks.
The fix is to add the view back before the window draws (a run loop observer on kCFRunLoopBeforeWaiting), pinned to its parent with constraints.
Dia animates the card's layer when the sidebar slides, so a view placed from outside jumps to the end straight away. A subview of the card moves and clips with it.
Dia opens the new tab that replaces it before the old one is gone, so for a moment both are in appleScriptTabs. The Close Tab shortcut in NSApp.currentEvent is the only sign of a close at that moment.
A local NSEvent monitor sees a menu's shortcut before the menu does, and returning nil stops it. The sidebar's New Tab button is TabList.NewTabCellView, which acts on -mouseDown:.
The bar's text is an NSTextView. -insertText:replacementRange: over its whole string changes it as typing would, so the suggestions follow, and -selectAll: then leaves it selected to type over.
Open Command Bar puts an AssistantPanelRootView in a DynamicPopover root view on the window's frame view, set up to edit the current tab. It can be moved out like the new tab page's, and closes with the popover. cancelOperation: sent to its text view closes it as Escape does. A new one is made each time.
- Its text is 13 points where the new tab page's is 16, kept in
BoostCommandBar.TextContainerView'sfontivar. - The first
DoubleofBoostCommandBar.RootView'slayoutConfiguration(the space above the text) is 19 where the new tab page's is 21. Dia writes the 19 back a few times while it opens, after sizing the bar by it. - It builds the bar over about 90 ms, from a 30 point strip to full height, then fades the toolbar in over 0.16 s. The toolbar's
alphaValueturning 1 marks it built.
Its -viewDidMoveToWindow runs with a window as the bar opens and without one as it closes, so the bar can be lifted out and put back there. The popover hides the bar's own ShadowView, drawing its shadow itself, so a lifted bar needs it shown again.
Removing every animation from the bar's layer tree (-removeAllAnimations, recursively) drops the fades Dia already started, and the bar shows as it ends up.
- Page
- Toolbar
- Toolbar Items
- Sidebar & Tab Bar
- Tabs & Downloads
- Command Bar
- Window
- Passwords
- Links
- Commands
- Making tweaks