Fix minimal mode toggle not updating titlebar state (#2218)
* Fix minimal mode toggle not properly updating titlebar state UpdateTitlebarAccessoryController only re-evaluated titlebar accessories on window focus events (didBecomeKey/didBecomeMain), not when the presentation mode actually changed. This caused: 1. Switching to minimal: accessories weren't immediately removed 2. Switching back to standard: accessories were never re-attached (removeAccessoryIfPresent cleared attachedWindows, but no event triggered re-attachment) 3. Repeated toggling left the window in inconsistent states Add a UserDefaults observer that detects presentation mode changes and re-evaluates all windows. When switching to minimal, accessories are removed; when switching to standard, fresh accessories are created and attached. Also handle the fullscreen edge case where re-attached accessories must be hidden to avoid doubling with SwiftUI overlay controls. * Hide window toolbar in minimal mode to eliminate titlebar gap The NSToolbar (attached by WindowToolbarController) creates a non-zero titlebar area even in minimal mode, leaving an empty gap above the Bonsplit tab bar. In minimal mode there's no need for the toolbar (it shows a "Cmd:" text that's hidden anyway with titleVisibility=.hidden). Hide the toolbar when switching to minimal mode and restore it when switching back to standard. Also set initial visibility on attachment based on the current mode. * Apply ignoresSafeArea to contentAndSidebarLayout in minimal mode The titlebar gap persisted because intermediate SwiftUI views still respected the window's safe area even though MainWindowHostingView zeroes safeAreaInsets. Apply .ignoresSafeArea(.container, edges: .top) directly to the contentAndSidebarLayout when in minimal mode so the entire content (sidebar + terminal) extends into the titlebar area. * Remove toolbar entirely in minimal mode instead of just hiding toolbar.isVisible=false still reserves titlebar space. Remove the toolbar entirely (window.toolbar=nil) when switching to minimal mode and re-attach it when switching back to standard. Skip toolbar attachment entirely when launching in minimal mode. * Add BonsplitTabDragUITests.swift to cmuxUITests target The test file existed on disk but was missing from the Xcode project, causing all BonsplitTabDrag UI tests (including minimal mode tests) to silently report 0 tests on CI. * Use negative titlebar padding in minimal mode to extend content into titlebar The native titlebar area (28.5pt for traffic lights) persists even without a toolbar and despite .ignoresSafeArea() modifiers. Use negative padding (-titlebarPadding) in minimal mode to pull the terminal content up into the titlebar area. The sidebar's internal trafficLightPadding spacer keeps sidebar content properly offset below the traffic lights. * Add window drag handle to Bonsplit top strip in minimal mode In minimal mode, the custom titlebar (which provides the window drag handle) is hidden. Add a WindowDragHandleView to the top strip overlay so users can drag-to-move the window from the Bonsplit tab bar area. The TitlebarDoubleClickMonitorView is kept as a background for double-click-to-zoom. * Use native titlebar drag in minimal mode instead of WindowDragHandleView WindowDragHandleView defers to interactive siblings (Bonsplit tab bar), so it never captures hits. Instead, set window.isMovable=true in minimal mode so the native titlebar area handles drag-to-move and double-click-to-zoom. Remove the non-functional overlay from WorkspaceContentView. * Enable isMovableByWindowBackground in minimal mode for window dragging window.isMovable alone doesn't work because the Bonsplit tab bar captures all hits before the native titlebar drag engages. Use isMovableByWindowBackground=true so any area that doesn't handle mouse events becomes a drag handle. Also capture workspacePresentationMode in the WindowAccessor closure so the window properties update when toggling modes. * Add debug logging for minimal mode window drag diagnosis * Intercept double-click in minimal mode tab bar to zoom instead of new tab Bonsplit's EmptyTabBarDoubleClickMonitorView creates a new tab on double-click in the tab bar empty space. In minimal mode, intercept these double-clicks with a higher-priority local event monitor and perform the standard macOS titlebar action (zoom/minimize based on System Settings) instead. Only intercepts in the top 30pt strip and only when minimal mode is active. * Fix double-click monitor ordering and coordinate calculation NSEvent local monitors are called LIFO (last installed first). Install the minimal-mode double-click interceptor with a 0.5s delay so it's added after Bonsplit's EmptyTabBarDoubleClickMonitorView monitors, ensuring it runs first and can consume the event. Also fix the distance-from-top calculation to use window frame height instead of contentLayoutRect height, since the tab bar is in the titlebar area. * Remove unnecessary delay from double-click monitor installation * Show split buttons on hover only in minimal mode, fix sidebar controls re-attachment Two fixes: 1. Add splitButtonsOnHover to BonsplitConfiguration.Appearance. In minimal mode, the Bonsplit split buttons (terminal, browser, split right/down) fade in only when hovering the tab bar. Revert to always-visible when switching back to standard mode. 2. Delay titlebar accessory re-attachment when switching to standard mode so the toolbar is re-added first. Without this, the accessory attaches before the toolbar exists, causing the sidebar controls to not appear in the titlebar. * Fix splitButtonsOnHover via onChange instead of body eval, add debug logs * Update bonsplit submodule for splitButtonsOnHover * Remove debug logs, verified splitButtonsOnHover and accessory re-attachment on macmini * Read presentationMode directly in TabBarView via @AppStorage The @Observable configuration propagation wasn't reliably triggering re-renders in TabBarView. Read the workspacePresentationMode directly via @AppStorage in TabBarView instead, which SwiftUI reactively updates when UserDefaults changes. Remove the syncSplitButtonsOnHover workaround from WorkspaceContentView. * Fix tab drag, double-click zone, and sidebar controls re-attachment - Revert isMovableByWindowBackground to false; it breaks Bonsplit tab reordering. Keep isMovable=true in minimal mode so the sidebar area (which has WindowDragHandleView) is draggable. - Increase double-click intercept zone from 30pt to 40pt to cover the full tab bar height (33pt). - Use asyncAfter(0.1s) for titlebar accessory re-attachment when switching to standard mode, giving the toolbar time to re-attach. * Add debug logging for titlebar accessory re-attachment diagnosis * Fix crash and sidebar controls re-attachment Remove debug logging that crashed when accessing window properties during iteration. Increase deferred re-attachment delay to 0.3s to give the WindowAccessor callback time to set the window identifier and toolbar before attachIfNeeded checks isMainTerminalWindow. * Keep titlebar accessories attached in minimal mode instead of removing The remove/re-add cycle was fragile: re-attachment depended on window identifiers being set, toolbar being re-added, and timing delays. Instead, keep TitlebarControlsAccessoryViewController always attached and let its own UserDefaults observer handle visibility. It already hides itself (view.isHidden=true, preferredContentSize=.zero) in minimal mode and shows itself in standard mode. No timing hacks needed. * Force titlebar accessory layout after toolbar re-addition * Use both self.isHidden and view.alphaValue/isHidden for accessory visibility self.isHidden alone doesn't reliably hide the accessory when the toolbar is nil on macOS 26. Add view.alphaValue=0 and view.isHidden as visual fallbacks. Crucially, don't zero preferredContentSize or frames so fittingSize returns valid values when switching back. * Set window.isMovable=false always to fix sidebar button clicks window.isMovable=true in minimal mode blocks clicks on the sidebar controls because the native titlebar drag intercepts mouse events in the overlapping area. The sidebar's WindowDragHandleView already handles drag-to-move via performDrag with withTemporaryWindowMovableEnabled, so native isMovable isn't needed. * Add drag-to-move from empty bonsplit tab bar space in minimal mode * Use overlay for tab bar drag, smart hitTest passes through tabs/buttons * Add double-click zoom/minimize to tab bar drag view * Add leading padding for traffic lights when sidebar collapsed in minimal mode * Add traffic light inset to tab bar when sidebar collapsed in minimal mode * Fix accessory space and double-click in minimal mode - Zero preferredContentSize in minimal mode (so accessory takes no space) but seed hostingView with cached size before querying fittingSize when switching back (so size can be restored). - Skip EmptyTabBarDoubleClickMonitorView in minimal mode so DraggableTabBarView handles double-click for zoom instead. - Remove redundant ContentView double-click monitor. * Auto-detect traffic light inset in TabBarView via GeometryReader Instead of propagating sidebar state through config, the tab bar detects its own position relative to the window. If in minimal mode and the tab bar's leading edge is near the window edge (< 20pt, no sidebar), add 72pt spacer for traffic light clearance. * Increase traffic light spacer to 80pt * Fix tab click passthrough in minimal mode drag overlay * Check full window for interactive hits in drag overlay * Fix drag overlay capturing all clicks via reentrancy guard in hitTest * Distinguish interactive controls from hosting views in drag hitTest * Walk ancestor chain for button detection in drag overlay hitTest * Replace overlay with background drag view per ensemble recommendation * Only add traffic light inset for top-left pane * Use GeometryReader for traffic light inset, check screen position * Fix operator precedence in traffic light inset check * Use window frame for traffic light inset detection * Set tabBarLeadingInset from ContentView via onChange handlers Replace unreliable coordinate-based detection with direct state from ContentView, which knows both sidebar visibility and minimal mode. Syncs on appear, sidebar toggle, and mode toggle. * Use allPaneIds.first for top-left pane detection, no hierarchy threading needed * Update bonsplit submodule to merged main --------- Co-authored-by: Lawrence Chen <lawrencecchen@users.noreply.github.com>
This commit is contained in:
parent
609a02c3f9
commit
c51f0f15c4
6 changed files with 127 additions and 19 deletions
|
|
@ -94,6 +94,7 @@
|
|||
D0E0F0B2A1B2C3D4E5F60718 /* BrowserOmnibarSuggestionsUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0E0F0B3A1B2C3D4E5F60718 /* BrowserOmnibarSuggestionsUITests.swift */; };
|
||||
FB100000A1B2C3D4E5F60718 /* BrowserImportProfilesUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = FB100001A1B2C3D4E5F60718 /* BrowserImportProfilesUITests.swift */; };
|
||||
E1000000A1B2C3D4E5F60718 /* MenuKeyEquivalentRoutingUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1000001A1B2C3D4E5F60718 /* MenuKeyEquivalentRoutingUITests.swift */; };
|
||||
AA1B2C3D4E5F60718 /* BonsplitTabDragUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA1B2C3D4E5F60719 /* BonsplitTabDragUITests.swift */; };
|
||||
F2000000A1B2C3D4E5F60718 /* UpdatePillReleaseVisibilityTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F2000001A1B2C3D4E5F60718 /* UpdatePillReleaseVisibilityTests.swift */; };
|
||||
F3000000A1B2C3D4E5F60718 /* CJKIMEInputTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3000001A1B2C3D4E5F60718 /* CJKIMEInputTests.swift */; };
|
||||
F4000000A1B2C3D4E5F60718 /* GhosttyConfigTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4000001A1B2C3D4E5F60718 /* GhosttyConfigTests.swift */; };
|
||||
|
|
@ -267,6 +268,7 @@
|
|||
D0E0F0B3A1B2C3D4E5F60718 /* BrowserOmnibarSuggestionsUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BrowserOmnibarSuggestionsUITests.swift; sourceTree = "<group>"; };
|
||||
FB100001A1B2C3D4E5F60718 /* BrowserImportProfilesUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BrowserImportProfilesUITests.swift; sourceTree = "<group>"; };
|
||||
E1000001A1B2C3D4E5F60718 /* MenuKeyEquivalentRoutingUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MenuKeyEquivalentRoutingUITests.swift; sourceTree = "<group>"; };
|
||||
AA1B2C3D4E5F60719 /* BonsplitTabDragUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BonsplitTabDragUITests.swift; sourceTree = "<group>"; };
|
||||
F2000001A1B2C3D4E5F60718 /* UpdatePillReleaseVisibilityTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UpdatePillReleaseVisibilityTests.swift; sourceTree = "<group>"; };
|
||||
F3000001A1B2C3D4E5F60718 /* CJKIMEInputTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CJKIMEInputTests.swift; sourceTree = "<group>"; };
|
||||
F4000001A1B2C3D4E5F60718 /* GhosttyConfigTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GhosttyConfigTests.swift; sourceTree = "<group>"; };
|
||||
|
|
@ -522,6 +524,7 @@
|
|||
FB100001A1B2C3D4E5F60718 /* BrowserImportProfilesUITests.swift */,
|
||||
C0B4D9B1A1B2C3D4E5F60718 /* UpdatePillUITests.swift */,
|
||||
E1000001A1B2C3D4E5F60718 /* MenuKeyEquivalentRoutingUITests.swift */,
|
||||
AA1B2C3D4E5F60719 /* BonsplitTabDragUITests.swift */,
|
||||
);
|
||||
path = cmuxUITests;
|
||||
sourceTree = "<group>";
|
||||
|
|
@ -789,6 +792,7 @@
|
|||
FB100000A1B2C3D4E5F60718 /* BrowserImportProfilesUITests.swift in Sources */,
|
||||
C0B4D9B0A1B2C3D4E5F60718 /* UpdatePillUITests.swift in Sources */,
|
||||
E1000000A1B2C3D4E5F60718 /* MenuKeyEquivalentRoutingUITests.swift in Sources */,
|
||||
AA1B2C3D4E5F60718 /* BonsplitTabDragUITests.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2348,7 +2348,7 @@ struct ContentView: View {
|
|||
}
|
||||
|
||||
private var effectiveTitlebarPadding: CGFloat {
|
||||
isMinimalMode ? 0 : titlebarPadding
|
||||
isMinimalMode ? -titlebarPadding : titlebarPadding
|
||||
}
|
||||
|
||||
private var terminalContent: some View {
|
||||
|
|
@ -2512,6 +2512,15 @@ struct ContentView: View {
|
|||
}
|
||||
}
|
||||
|
||||
private func syncTrafficLightInset() {
|
||||
let inset: CGFloat = (isMinimalMode && !sidebarState.isVisible) ? 80 : 0
|
||||
for tab in tabManager.tabs {
|
||||
if tab.bonsplitController.configuration.appearance.tabBarLeadingInset != inset {
|
||||
tab.bonsplitController.configuration.appearance.tabBarLeadingInset = inset
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func updateTitlebarText() {
|
||||
guard let selectedId = tabManager.selectedTabId,
|
||||
let tab = tabManager.tabs.first(where: { $0.id == selectedId }) else {
|
||||
|
|
@ -2661,6 +2670,7 @@ struct ContentView: View {
|
|||
syncSidebarSelectedWorkspaceIds()
|
||||
applyUITestSidebarSelectionIfNeeded(tabs: tabManager.tabs)
|
||||
updateTitlebarText()
|
||||
syncTrafficLightInset()
|
||||
|
||||
// Startup recovery (#399): if session restore or a race condition leaves the
|
||||
// view in a broken state (empty tabs, no selection, unmounted workspaces),
|
||||
|
|
@ -3079,6 +3089,11 @@ struct ContentView: View {
|
|||
TerminalWindowPortalRegistry.scheduleExternalGeometrySynchronizeForAllWindows()
|
||||
}
|
||||
updateSidebarResizerBandState()
|
||||
syncTrafficLightInset()
|
||||
})
|
||||
|
||||
view = AnyView(view.onChange(of: isMinimalMode) { _, _ in
|
||||
syncTrafficLightInset()
|
||||
})
|
||||
|
||||
view = AnyView(view.onChange(of: sidebarState.persistedWidth) { newValue in
|
||||
|
|
@ -3110,11 +3125,11 @@ struct ContentView: View {
|
|||
view = AnyView(view.background(WindowAccessor { [sidebarBlendMode, bgGlassEnabled, bgGlassTintHex, bgGlassTintOpacity] window in
|
||||
window.identifier = NSUserInterfaceItemIdentifier(windowIdentifier)
|
||||
window.titlebarAppearsTransparent = true
|
||||
// Do not make the entire background draggable; it interferes with drag gestures
|
||||
// like sidebar tab reordering in multi-window mode.
|
||||
// Keep window immovable; the sidebar's WindowDragHandleView handles
|
||||
// drag-to-move via performDrag with temporary movable override.
|
||||
// isMovableByWindowBackground=true breaks tab reordering, and
|
||||
// isMovable=true blocks clicks on sidebar buttons in minimal mode.
|
||||
window.isMovableByWindowBackground = false
|
||||
// Keep the window immovable by default so titlebar controls (like the folder icon)
|
||||
// cannot accidentally initiate native window drags.
|
||||
window.isMovable = false
|
||||
window.styleMask.insert(.fullSizeContentView)
|
||||
|
||||
|
|
|
|||
|
|
@ -821,7 +821,9 @@ final class TitlebarControlsAccessoryViewController: NSTitlebarAccessoryViewCont
|
|||
queue: .main
|
||||
) { [weak self] _ in
|
||||
self?.applyWorkspaceTitlebarVisibility()
|
||||
self?.scheduleSizeUpdate(invalidateFittingSize: true)
|
||||
if self?.showsWorkspaceTitlebar == true {
|
||||
self?.restoreSizeAfterMinimalMode()
|
||||
}
|
||||
}
|
||||
|
||||
applyWorkspaceTitlebarVisibility()
|
||||
|
|
@ -918,14 +920,27 @@ final class TitlebarControlsAccessoryViewController: NSTitlebarAccessoryViewCont
|
|||
|
||||
private func applyWorkspaceTitlebarVisibility() {
|
||||
let shouldShow = showsWorkspaceTitlebar
|
||||
self.isHidden = !shouldShow
|
||||
view.isHidden = !shouldShow
|
||||
view.alphaValue = shouldShow ? 1 : 0
|
||||
if !shouldShow {
|
||||
preferredContentSize = .zero
|
||||
containerView.frame = .zero
|
||||
hostingView.frame = .zero
|
||||
}
|
||||
}
|
||||
|
||||
/// Restore the accessory size after it was zeroed in minimal mode.
|
||||
/// Seeds the hosting view with a non-zero frame so fittingSize returns
|
||||
/// valid values even after the view was collapsed.
|
||||
private func restoreSizeAfterMinimalMode() {
|
||||
guard showsWorkspaceTitlebar else { return }
|
||||
let seed = cachedFittingSize ?? NSSize(width: 200, height: 28)
|
||||
if hostingView.frame.size == .zero || containerView.frame.size == .zero {
|
||||
containerView.frame.size = seed
|
||||
hostingView.frame.size = seed
|
||||
}
|
||||
scheduleSizeUpdate(invalidateFittingSize: true)
|
||||
}
|
||||
|
||||
func toggleNotificationsPopover(animated: Bool = true, externalAnchor: NSView? = nil) {
|
||||
if notificationsPopover.isShown {
|
||||
notificationsPopover.performClose(nil)
|
||||
|
|
@ -1202,6 +1217,7 @@ final class UpdateTitlebarAccessoryController {
|
|||
private var startupScanWorkItems: [DispatchWorkItem] = []
|
||||
private let controlsIdentifier = NSUserInterfaceItemIdentifier("cmux.titlebarControls")
|
||||
private let controlsControllers = NSHashTable<TitlebarControlsAccessoryViewController>.weakObjects()
|
||||
private var lastKnownPresentationMode: WorkspacePresentationModeSettings.Mode = WorkspacePresentationModeSettings.mode()
|
||||
|
||||
init(viewModel: UpdateViewModel) {
|
||||
self.updateViewModel = viewModel
|
||||
|
|
@ -1249,10 +1265,45 @@ final class UpdateTitlebarAccessoryController {
|
|||
}
|
||||
})
|
||||
|
||||
// Re-evaluate all windows when the presentation mode changes so that
|
||||
// accessories are removed in minimal mode and re-attached in standard mode.
|
||||
observers.append(center.addObserver(
|
||||
forName: UserDefaults.didChangeNotification,
|
||||
object: nil,
|
||||
queue: .main
|
||||
) { [weak self] _ in
|
||||
Task { @MainActor [weak self] in
|
||||
self?.reattachIfPresentationModeChanged()
|
||||
}
|
||||
})
|
||||
|
||||
// We intentionally do not rely on "window became visible" notifications here:
|
||||
// AppKit does not provide a stable cross-SDK API for this. Startup scans handle this case.
|
||||
}
|
||||
|
||||
private func reattachIfPresentationModeChanged() {
|
||||
let currentMode = WorkspacePresentationModeSettings.mode()
|
||||
guard currentMode != lastKnownPresentationMode else { return }
|
||||
lastKnownPresentationMode = currentMode
|
||||
// Ensure accessories exist on all windows. TitlebarControlsAccessoryViewController
|
||||
// handles its own visibility (hidden in minimal, visible in standard) via its
|
||||
// UserDefaults observer, so we just need to make sure it's attached.
|
||||
attachToExistingWindows()
|
||||
|
||||
// When switching back to standard mode while a window is in fullscreen,
|
||||
// hide the accessories because fullscreen uses SwiftUI overlay controls.
|
||||
if currentMode == .standard {
|
||||
let controlsId = self.controlsIdentifier
|
||||
for window in NSApp.windows where window.styleMask.contains(.fullScreen) {
|
||||
for accessory in window.titlebarAccessoryViewControllers
|
||||
where accessory.view.identifier == controlsId {
|
||||
accessory.isHidden = true
|
||||
accessory.view.alphaValue = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func attachToExistingWindows() {
|
||||
for window in NSApp.windows {
|
||||
attachIfNeeded(to: window)
|
||||
|
|
@ -1308,10 +1359,9 @@ final class UpdateTitlebarAccessoryController {
|
|||
|
||||
pendingAttachRetries.removeValue(forKey: ObjectIdentifier(window))
|
||||
|
||||
guard !WorkspacePresentationModeSettings.isMinimal() else {
|
||||
removeAccessoryIfPresent(from: window)
|
||||
return
|
||||
}
|
||||
// Don't remove accessories in minimal mode. TitlebarControlsAccessoryViewController
|
||||
// hides itself and zeros its frame via its own UserDefaults observer. Keeping it
|
||||
// attached avoids fragile remove/re-add cycles on mode toggle.
|
||||
|
||||
guard !attachedWindows.contains(window) else { return }
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ final class WindowToolbarController: NSObject, NSToolbarDelegate {
|
|||
private var commandLabels: [ObjectIdentifier: NSTextField] = [:]
|
||||
private var observers: [NSObjectProtocol] = []
|
||||
private let focusedCommandUpdateCoalescer = NotificationBurstCoalescer(delay: 1.0 / 30.0)
|
||||
private var lastKnownPresentationMode: WorkspacePresentationModeSettings.Mode = WorkspacePresentationModeSettings.mode()
|
||||
|
||||
override init() {
|
||||
super.init()
|
||||
|
|
@ -61,6 +62,48 @@ final class WindowToolbarController: NSObject, NSToolbarDelegate {
|
|||
self?.attach(to: window)
|
||||
}
|
||||
})
|
||||
|
||||
observers.append(center.addObserver(
|
||||
forName: UserDefaults.didChangeNotification,
|
||||
object: nil,
|
||||
queue: .main
|
||||
) { [weak self] _ in
|
||||
Task { @MainActor [weak self] in
|
||||
self?.updateToolbarVisibilityIfNeeded()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private func updateToolbarVisibilityIfNeeded() {
|
||||
let currentMode = WorkspacePresentationModeSettings.mode()
|
||||
guard currentMode != lastKnownPresentationMode else { return }
|
||||
lastKnownPresentationMode = currentMode
|
||||
let isMinimal = currentMode == .minimal
|
||||
for window in NSApp.windows {
|
||||
if isMinimal {
|
||||
window.toolbar = nil
|
||||
} else {
|
||||
attach(to: window)
|
||||
}
|
||||
}
|
||||
// After toolbar changes, force titlebar accessories to recalculate.
|
||||
// Toolbar removal/re-addition changes the titlebar geometry, and
|
||||
// accessories hidden via isHidden need a layout pass to reappear.
|
||||
if !isMinimal {
|
||||
DispatchQueue.main.async {
|
||||
for window in NSApp.windows {
|
||||
for accessory in window.titlebarAccessoryViewControllers {
|
||||
if !accessory.isHidden {
|
||||
accessory.view.needsLayout = true
|
||||
accessory.view.superview?.needsLayout = true
|
||||
}
|
||||
}
|
||||
window.contentView?.needsLayout = true
|
||||
window.contentView?.superview?.needsLayout = true
|
||||
window.invalidateShadow()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func attachToExistingWindows() {
|
||||
|
|
@ -71,6 +114,7 @@ final class WindowToolbarController: NSObject, NSToolbarDelegate {
|
|||
|
||||
private func attach(to window: NSWindow) {
|
||||
guard window.toolbar == nil else { return }
|
||||
guard !WorkspacePresentationModeSettings.isMinimal() else { return }
|
||||
let toolbar = NSToolbar(identifier: NSToolbar.Identifier("cmux.toolbar"))
|
||||
toolbar.delegate = self
|
||||
toolbar.displayMode = .iconOnly
|
||||
|
|
|
|||
|
|
@ -263,6 +263,7 @@ struct WorkspaceContentView: View {
|
|||
// AppKit-backed views can still intercept drags. Disable drop acceptance for them.
|
||||
let _ = { workspace.bonsplitController.isInteractive = isWorkspaceInputActive }()
|
||||
|
||||
|
||||
// Wire up file drop handling so bonsplit's PaneDragContainerView can forward
|
||||
// Finder file drops to the correct terminal panel.
|
||||
let _ = {
|
||||
|
|
@ -379,12 +380,6 @@ struct WorkspaceContentView: View {
|
|||
if isMinimalMode {
|
||||
bonsplitView
|
||||
.ignoresSafeArea(.container, edges: .top)
|
||||
.overlay(alignment: .top) {
|
||||
if isWorkspaceInputActive {
|
||||
TitlebarDoubleClickMonitorView()
|
||||
.frame(height: WorkspaceTitlebarInteractionMetrics.minimalModeTopStripHeight)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
bonsplitView
|
||||
}
|
||||
|
|
|
|||
2
vendor/bonsplit
vendored
2
vendor/bonsplit
vendored
|
|
@ -1 +1 @@
|
|||
Subproject commit 1610b457bc44bb1d50dd246792f8724ce21a7c81
|
||||
Subproject commit 447ac42b45256bdf333659d2dbe955afcaa87f6b
|
||||
Loading…
Add table
Add a link
Reference in a new issue