You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit a65951f
Browse filesBrowse the repository at this point in the historyBrowse files
feat(app): let Ovis for Mac's header take the place of the window's title bar (#2642)
Feature request: #2641
## Change
While Ovis for Mac's main window shows Ovis, it folds its title bar away
and the page's header takes its place, as in the Codex and Claude apps.
- **Window** (`TitleBar.swift`): full-size content, a transparent bar
with no title, and an empty `.unifiedCompact` toolbar. AppKit then gives
the bar its height (40 pt on macOS 27) and centres the traffic lights on
it itself, so nothing has to move them again on a resize or a title
change. The setup, which takes the page's place when the server is gone,
gets the window's bar back; a window the page opens (`showWindow`) never
folds. In full screen the toolbar goes, so the bar hides with the menu
bar. The View menu has no toolbar items (Reload takes the toolbar
group's place), so the toolbar can't be hidden from under the header.
Only the page that folded a window's bar gives it back, so the page that
leaves when the server moves can't unfold the bar under the next one.
- **Page** (`Resources/title-bar.js`, run like `carry-drafts.js`): as
each main-window page commits, the app hands it the bar's height and the
lights' right edge (`data-mac-title-bar`, `--mac-title-bar-h`,
`--mac-title-bar-inset`). It also marks the lights' corner as an iPad
window's (`data-window-controls`, `--window-controls-w`), so the header,
the inbox's top bar and its rail keep clear of the lights by the rules
they already have. `styles.css` gives the wide header the bar's height;
the narrow one keeps its own, which its 44px buttons need. It is
evaluated per page rather than a user script, because a window the page
opens shares the main page's user scripts.
- **Moving the window**: WebKit has no `app-region: drag`. A press on a
top bar's bare surface (`.app-header`, the inbox's `.inbox-top` and
`.thread-top`, the bars an installed desktop app drags by), or anywhere
off a control within the bar's height of the window's top (the access
and crash screens), arms a drag. Controls are buttons, links, fields,
menus, groups and anything in the tab order; a container focused only by
script (`tabindex=-1`, as `.app` is) is not one. The page's ask carries
where it saw the press, and `OvisWebView` arms only the press at that
point, so a late ask can't move the window from a later press elsewhere.
It starts `performDrag` only on the first `mouseDragged`, then hands
WebKit the mouse-up the drag took. A plain click or double click there
stays the page's, and a double click does what System Settings › Desktop
& Dock says of a title bar.
- `WebPage` ignores the top safe area so the web view reaches the
window's top.
- **Clicks under the bar** (second commit): AppKit decides which views
under the bar take its clicks as the bar turns transparent, and finds
the page. But each time the window comes on screen (its first showing at
a restored frame, after Hide, out of the Dock) it asks only SwiftUI's
hosting view, which takes none, and the empty toolbar's `NSToolbarView`
then took every click on the header. Whenever the window becomes visible
(`didChangeOcclusionState`), `TitleBar.refresh` turns the bar
transparent again, so AppKit looks again.

The demo built from this branch (`bun scripts/demo-build.ts`), in a
harness app built from `app/mac/Sources` with the real `WebPage`. The
window is not the active one, hence the grey traffic lights.
## Validation
macOS 27.2, Swift 6.4.2, Bun 1.4.2:
- `swift build`, `swift test` in `app/mac`: pass (14 tests).
- `bun test scripts/mac-title-bar.test.ts` (`title-bar.js` against
fakes, as the carry test does): 8 pass; 6 of them fail on the script
before the review fixes. `scripts/mac-carry-drafts.test.ts`,
`src/conventions.test.ts`, `server/conventions.test.ts`, the theme and
settings tests that read `styles.css`, `scripts/changelog-fold.test.ts`,
`server/release-notes.test.ts`: pass. `scripts/conventions.test.ts`
fails only its ratchet-base test, the same way on the merge of `main`
without these changes (its base is the fork's stale `main`). `bun run
typecheck`, `bun run build`: pass; `generate:themes` and
`generate:types` leave no change.
- A harness app built from `app/mac/Sources` (its own bundle id) with
the real `WebPage`, `TitleBar` and `OvisCommands` in a SwiftUI `Window`
scene, on the demo built from this branch, probed from inside (macOS
27.2, bar 38 pt, lights' right edge 66 pt):
- wide header 38 px with its first button at x 74; narrow window (700
px) header 52 px with 44 px buttons inside it, padded to 78 px; inbox
mode: no `.app-header`, the rail's first button at y 50, the inbox top's
first control at x 94;
- a press on the header's bare surface, the inbox top and the thread top
arms the drag; a press on the pane does not; with only a centred-card
screen (`.access-gate-screen`) on the page, a press at y 20 arms it and
one at y 60 does not;
- a header press, its mouse-up and a pane press sent at once: the
header's ask arrives during the pane press and does not arm it (the code
before this change armed any press under way);
- Cmd+R still reaches Reload through the main menu;
- an origin change (`127.0.0.1` to `localhost` and back, a new `WebPage`
each time) leaves the bar folded; the setup in the page's place gets the
bar back (28 pt, no toolbar), and the page back folds it again.
- at 2d4adb3, a page that joins a window already in full screen (the
setup there first, then the page; and a page from the other origin): no
toolbar while in full screen; on leaving it the toolbar is back, bar 38
pt, lights 66 pt, the header 38 px with its first button at x 74.
- By hand, with a real mouse, on the same harness (@todor-a): the window
drags by the header's empty space and by the inbox's top bar; header
buttons click and a text selection does not move the window; the View
menu has no Show/Hide Toolbar or Customize Toolbar and keeps Reload;
full screen hides the bar with the menu bar and the header lines up
again after; below 769 px the header's buttons fit.
- The original window setup and CSS have run as my own WKWebView
wrapper's daily window since 2026-11-03.
Skipped: `bun run check fast` as a whole (on this Mac `main` already
fails unit tests that assume Linux, such as GNU tar's `--transform`).
https://claude.ai/code/session_01Qe4NFe6YNuifjKD8sVKzrh
---------
Co-authored-by: devswha <[email protected]>
Copy file name to clipboardExpand all lines: app/mac/README.md
+8Lines changed: 8 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,6 +14,14 @@ The window is a WKWebView on the server's own address (`http://127.0.0.1:<port>`
14
14
`scripts/plugin.ts status`). The server lets a loopback request in without pairing, and the page's
15
15
cookies and drafts stay in the app's own WebKit store, apart from any browser's.
16
16
17
+
- While it shows Ovis the window draws no title bar: the page's header takes its place, as in the
18
+
Codex and Claude apps, at the height of a compact toolbar's bar, which centres the traffic lights on
19
+
it (`Sources/OvisMac/TitleBar.swift`, `Resources/title-bar.js`), and every screen keeps clear of the
20
+
lights as an iPad window's does. A drag on a top bar's bare surface (the header, the inbox's), or
21
+
anywhere off a control within the bar's height of the window's top, moves the window, and a double
22
+
click there does what System Settings › Desktop & Dock says of a title bar. The View menu has no
23
+
toolbar items. The setup, and a window the page opens, keep a title bar of their own; in full
24
+
screen the bar hides with the menu bar.
17
25
-**Ovis → Phone Setup…** opens the setup and the phone's QR code in a window of their own. After
18
26
an Install from the app it opens by itself. **File → Open in Browser** opens the page as it is in
19
27
the default browser, and **View → Reload** (Cmd+R) loads it again. No menu item takes a Cmd+Shift
0 commit comments