Repository navigation
Discoveries Tabs and Windows
Part of Discoveries.
appleScriptWindows and then appleScriptTabs list tabs in on-screen order, with tabId, URL and close:.
The browser delegate can create tab groups, add and remove tabs, and run moveTabGroupWithId:toNewIndex:. The group index counts from the first unpinned tab. To move a single tab, put it alone in a temporary group, move the group, then ungroup it.
The key window is often Settings or a popover. Walk NSApp.orderedWindows front to back for the first browser window.
RecentTabsWindowController keeps its list in viewModel.stateSubject.currentValue, and doesn't refresh while open. It commits as soon as a ⌘ flag change arrives, before local event monitors run. To catch ⌘W in it, hook -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:].
Dia opens the downloads list itself when a download starts, usually while the click on the page's link is still the current event. To tell that apart from the user asking, check the click is on the button, and count -accessibilityPerformPress too, as VoiceOver and Full Keyboard Access use it.
They're started with posix_spawn. Interposing it lets a tweak start a different helper.
A sidebar tab is a TabUI.TabView. Its contentViews hold a TabContentView per page (more than one for a split), and each one's viewModel.delegate is a TabContentController with the tab's contentID and webContentURL. It doesn't lead to the page itself, an ArcWebContents, and none of the page's own IDs match the tab's contentID. Collect pages from -[ArcWebContents setVisibility:], which every page gets, and match them by URL, only when one page has it.
-[ArcWebContents discard] asks Chromium to drop the page. The answer comes to the page's delegate, ADK.WebContentChromium, as -webContents:finalizeDiscardRequest: with a BOOL. Chromium says no for a page playing audio or one on screen. -visibility is 0 hidden, 1 occluded or 2 visible.
A page made with createWebContents: is closed with -close. With some extensions installed (Quillbot is one), closing a page that still shows a site crashes Dia inside ArcCore, on a null pointer. Dia closes its own tabs with -closeWithForegroundCommitTiming:1, but that crashes too, and so do closing later or closing right after starting a load of about:blank. What works is loading about:blank, waiting until the page's url is about:blank (about 50 ms), and only then closing it.
The tab's view doesn't get -layout when it's selected, so a tweak can't notice there. Its page's setVisibility: with 2 is the cue. Whether a tab is selected is in its viewModel.stateSubject.currentValue, as selectionStyle.
An NSMenuItem's image is hidden unless its preferredImageVisibility is .visible. Dia's own tab menu items set it, so an added item without it shows no icon and sits further left than the rest. The property is new in the macOS 27 SDK, so a build with an older SDK, like the one CI uses, doesn't know it: set it by name, [item setValue:@1 forKey:@"preferredImageVisibility"] inside @available(macOS 27, *), where 1 is .visible.
- Page
- Toolbar
- Sidebar & Tab Bar
- Tabs
- Command Bar
- New Tab Page
- Window
- Passwords
- Links
- Making tweaks