Commit graph

55 commits

Author SHA1 Message Date
Lawrence Chen
c51f0f15c4
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>
2026-03-27 20:25:51 -07:00
Austin Wang
33dcc606bf
Customizable number shortcuts (#1951)
* Allow customizing numbered workspace and surface shortcuts

* Update bonsplit submodule to squashed main commit

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-22 14:54:54 -07:00
Austin Wang
539109195b
Merge main into sidebar PR status branch (#1776)
* test(sidebar): add failing PR checks regressions

* fix(sidebar): show workspace PR status

* refactor(sidebar): restore PR icon style

* refactor(sidebar): simplify PR check labels

* test(sidebar): cover focused workspace PR selection

* fix(sidebar): scope workspace PRs to current branch

* test(sidebar): cover stale PR after branch change

* fix(sidebar): clear stale PRs on branch changes

* test(sidebar): cover workspace PR false positives

* fix(sidebar): stop false-positive workspace PR badges

* test(cmuxTests): remove duplicate sidebar PR regressions

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-18 12:34:55 -07:00
Lawrence Chen
03820ae20f
Update bonsplit for minimal mode titlebar double click 2026-03-17 20:05:24 -07:00
Lawrence Chen
853da3af19
Update bonsplit for empty tab bar drag fix 2026-03-17 19:57:27 -07:00
Lawrence Chen
90e573b68f
Merge origin/main into feat-hidden-titlebar-minimalism-reset 2026-03-17 17:37:28 -07:00
Lawrence Chen
60d005b793
Update bonsplit after merge 2026-03-17 15:05:10 -07:00
Lawrence Chen
9484371d5f
Update bonsplit for empty tab bar double clicks 2026-03-17 05:01:38 -07:00
Lawrence Chen
4c7e300332
Implement minimal mode sidebar control behavior 2026-03-16 23:21:28 -07:00
Lawrence Chen
975a850935
Update bonsplit for split transparency 2026-03-16 20:57:04 -07:00
Lawrence Chen
08854f14db
Update bonsplit for split transparency 2026-03-16 20:42:21 -07:00
Lawrence Chen
70ec1a0915
Split fade buttons from titlebar visibility 2026-03-15 21:31:41 -07:00
Lawrence Chen
b73a74492b
Port Bonsplit hidden-titlebar underlap fixes 2026-03-15 18:40:36 -07:00
Lawrence Chen
e4ef98aca1
Implement hidden-titlebar minimalism mode 2026-03-15 16:43:26 -07:00
austinpower1258
9bfa3b9143 Make Cmd+W close the window when it closes the last terminal
Previously, Cmd+W on the last surface kept the workspace alive with a
replacement shell, unless the user toggled a hidden setting. This was
confusing—users expect Cmd+W to close the window when there's nothing
left.

Now Cmd+W (and the tab-strip X button) always close the workspace when
they close its last surface, and close the window when that was the last
workspace. Internal/programmatic closes (e.g. process exit, panel moves)
still spawn a replacement shell so the workspace stays alive.

Key changes:
- Track explicit user close gestures via markExplicitClose / onTabCloseRequest
- Remove the LastSurfaceCloseShortcutSettings toggle (now always-on)
- Use window.performClose for last-workspace window close
- Update tests to match the new behavior

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 12:43:24 -07:00
austinpower1258
62125c1f82 Fix terminal drag hover overlay flicker 2026-03-07 11:06:38 -08:00
austinpower1258
eaa7647bea Revert PR #1046 to restored bonsplit base 2026-03-07 10:51:11 -08:00
austinpower1258
e019293207 Fix terminal drag hover overlay flicker 2026-03-07 10:31:12 -08:00
austinpower1258
9e8a401e3c Fix tooltip tracking lifetime and shortcut lag 2026-03-07 01:46:02 -08:00
Lawrence Chen
919f77b6dc
Add setting to hide Cmd-hold shortcut hints (#765)
* Add setting to hide Cmd-hold shortcut hints

* Bump bonsplit for Cmd-hold pane hint toggle

* Document tagged app link format in agent notes

* Disable Ctrl pane hints when hold-hints toggle is off
2026-03-02 19:56:27 -08:00
Lawrence Chen
bc1b6fd9eb
Honor Ghostty background-opacity across all cmux chrome (#667)
* Honor Ghostty background-opacity across all cmux chrome

Parse background-opacity from Ghostty config and propagate it through
the entire chrome pipeline: bonsplit tab bar (via RRGGBBAA hex),
browser panel/omnibar, titlebar, empty panel, and window background.

Decouple glass effect from sidebar blend mode — bgGlassEnabled now
defaults to false so opacity works independently. Add
GhosttyBackgroundTheme helper for consistent color+opacity resolution
across all UI surfaces.

Fixes https://github.com/manaflow-ai/cmux/issues/263

* Titlebar and chrome opacity matches terminal background-opacity

Use CALayer-level opacity for the titlebar background instead of SwiftUI
Color alpha, matching the terminal's Metal compositing path. Account for
the double alpha stacking in the terminal area (Bonsplit container bg +
Ghostty renderer) so the titlebar visually matches.

Also fix opacity-only config changes not triggering titlebar refresh on
Cmd+Shift+, reload.
2026-03-01 03:48:46 -08:00
Lawrence Chen
978341b228
Add zoom/maximize focused pane in splits (#634)
Cmd+Shift+Enter toggles zoom on the focused pane, expanding it to fill
the workspace. Splitting or creating new tabs auto-unzooms. Zoom state
shown as icon in sidebar tab. Includes bonsplit zoom toggle support.

Closes https://github.com/manaflow-ai/cmux/issues/136
2026-02-27 01:50:56 -08:00
austinpower1258
f33d65f986 Fix terminal blanking after full-surface tab drops 2026-02-24 16:00:00 -08:00
Lawrence Chen
2c2190b231 Block tab drags across cmux app instances 2026-02-23 19:48:54 -08:00
Lawrence Chen
b57087f796 Implement cross-window tab and workspace move UI 2026-02-23 19:48:54 -08:00
austinpower1258
4bc3da65b6 Fix terminal/web portal overflow during narrow pane resizing 2026-02-23 12:26:05 -08:00
Lawrence Chen
42f1933c80
Update bonsplit submodule to fix Release build (#341)
Picks up manaflow-ai/bonsplit#8 which moves ThemedSplitView outside
#if DEBUG so it compiles in Release configuration (fixes nightly).
2026-02-22 22:21:54 -08:00
Lawrence Chen
881ebb2386 Update bonsplit for selected-tab separator gap 2026-02-22 20:07:22 -08:00
Lawrence Chen
4e172abb66 Update bonsplit for selected-tab separator fix 2026-02-22 20:03:39 -08:00
Lawrence Chen
d31cbb7123 Use gray separator borders and drop active-tab bottom border 2026-02-22 20:01:37 -08:00
Lawrence Chen
283b898307 Match bonsplit border styling to Ghostty split divider color 2026-02-22 19:57:46 -08:00
Lawrence Chen
b7d49228b7 Fix pane shortcut hints to active window 2026-02-22 17:19:38 -08:00
Austin Wang
78fe5a9b04
Fix cmux border resize icon disappearing (#284)
* Keep split dividers visible in tiny panes

* Fix collapsed split border resize hit-testing

* Stabilize sidebar and split divider resize routing

* Fix split divider resize cursor routing regressions
2026-02-21 17:57:00 -08:00
Lawrence Chen
685996ef0d
Remove border below titlebar (#242)
* Remove border below titlebar

Remove the 1px separator line overlay at the bottom of the custom
titlebar and its associated fakeTitlebarSeparatorColor computed property.

* Remove tab hover background in bonsplit

Update bonsplit submodule to remove the background fill on hovered
non-selected tabs.

* Restore titlebar border with system separator color, hover bg on all tabs, browser theme bg

- Add back 1px bottom border on titlebar using NSColor.separatorColor
  (matches bonsplit tab separator color)
- Tab hover background now applies to all tabs including the selected one
- Browser address bar and under-page background now use Ghostty theme
  background color instead of window background
2026-02-21 04:31:55 -08:00
Lawrence Chen
279b8b91e7 Fix workspace-scoped tab action resolution 2026-02-20 20:18:29 -08:00
Lawrence Chen
dc2b3e506b Implement horizontal tab context menu actions 2026-02-20 20:13:36 -08:00
Lawrence Chen
1c8cf082b2 Pin bonsplit submodule to clean commit 43aedcf 2026-02-20 19:52:56 -08:00
Lawrence Chen
d26390156a Fix flaky initial bonsplit split animation 2026-02-20 18:53:08 -08:00
Lawrence Chen
cf767cf9af Fix bonsplit drag routing and pin submodule commit 2026-02-20 18:47:34 -08:00
Lawrence Chen
df9ba6dcd9
Fix #155: remap-aware bonsplit tooltips + browser split shortcuts (#200)
* Issue #155: remap bonsplit tooltips and add browser split shortcuts

* Fix split button mousedown feedback regression

* Match split button sizing with main
2026-02-20 15:17:00 -08:00
Lawrence Chen
7b2675cd1e
Fix theme initialization to respect configured/system appearance (#161)
* Respect configured appearance before Ghostty initialization

* Apply Ghostty theme colors to cmux titlebar and tab chrome

* Fix builtin theme resolution and tab strip icon contrast

* Alias builtin Solarized names to current Ghostty themes

* Sync tab chrome with active Ghostty theme

* Fix system appearance theme switching for surfaces

* Refresh titlebar on background theme updates

* Refresh split overlay config on appearance change

* Update bonsplit for chrome color review fixes
2026-02-20 04:51:01 -08:00
Austin Wang
3b50c6594c
Fix panel resize hitbox and stale portal frame behavior (#114)
* ok

* Drop GhosttyTerminalView changes from resize PR
2026-02-19 18:32:57 -08:00
austinpower1258
5d79d63af8 Fix blue hover not showing when dragging tabs onto terminal panes
The drop placeholder rendered in SwiftUI was hidden behind the
portal-hosted terminal surface. Add an AppKit overlay directly on
GhosttySurfaceScrollView driven by a new paneDropZone environment key
from Bonsplit so it renders above the Metal layer.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 14:50:45 -08:00
Lawrence Chen
0ec5a3af1b Restore lost bonsplit + button commits via merge
Three bonsplit commits (429af82, 2ff740d, b1948ab) adding the tab bar
+ button were lost when ad159da moved the submodule pointer to a
branch that forked before those commits. Merge origin/term-browser-icons
back into bonsplit main to restore them.
2026-02-18 02:17:46 -08:00
Lawrence Chen
ad159daa80 Update bonsplit: onFileDrop API, PaneDragContainerView, dirty indicator fix 2026-02-18 01:21:17 -08:00
Lawrence Chen
e322403f9b Always show close button on active tab
Re-applies lost change from a8834d8 (commit was orphaned by a
force-push on the bonsplit submodule).
2026-02-17 22:04:16 -08:00
Lawrence Chen
c7d4a52c8e Update bonsplit submodule to latest after force-push 2026-02-17 22:04:16 -08:00
Lawrence Chen
a91e92c7cf Always show close button on active tab
Amp-Thread-ID: https://ampcode.com/threads/T-019c6f32-10c2-70ce-b446-5c25c2ae8cbf
Co-authored-by: Amp <amp@ampcode.com>
2026-02-17 21:33:11 -08:00
Austin Wang
addb99ed50
Add "+" menu button to horizontal tab bar for new terminal/browser tabs (#48)
Adds a "+" button to the tab bar (next to split buttons) that shows a
dropdown menu with "New Terminal ⌘T" and "New Browser ⌘⇧L" options.

- Uses native NSButton + NSMenu so the icon matches the split buttons
- Menu appears below the button
- Routes tab creation through new didRequestNewTab delegate method

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 14:59:24 -08:00
Lawrence Chen
c2fdd48290
Release v1.36.0 (#47)
* Fix multi-workspace drag/drop, WebView click focus, and add regression tests

- Wire bonsplit isInteractive to workspace active state so inactive
  workspace NSViews are hidden from AppKit event routing
- Add CmuxWebView.mouseDown notification for browser panel focus
  tracking (AppKit delivers clicks to WKWebView, not SwiftUI overlays)
- Add multi-workspace focus regression test covering isHidden fix,
  rapid workspace switching, and browser panel focus routing

* Bump version to 1.36.0
2026-02-17 04:04:29 -08:00