feat(desktop): full screen over the whole display, the strip beside the camera included

On a MacBook with a camera housing (the notch), macOS's full screen ends the
window below the housing and paints the strip beside it black. No setting
changes that, so the Mac app gets a second kind of full screen, off by default:
View > Full Screen Uses the Area Beside the Camera.

The app (packages/desktop/src/whole_screen.rs):
- The window loses its title bar, the Dock and the menu bar auto-hide, and the
  window gets the display's whole frame, which reaches behind the housing.
- An override of toggleFullScreen: on tao's window class decides per request,
  so the green button, the menu item, its shortcut and the launch into full
  screen all follow the option. It only applies on a display with a housing.
- performClose: asks the delegate while the window has no close button.
- Changes into and out of macOS's own full screen are tracked from AppKit's
  notifications: while one is under way the window is not restyled and its
  frame is not saved. The Dock and menu-bar options are reconciled, so what a
  native Space in front kept from being set or taken off is done afterwards.
- Info.plist: NSPrefersDisplaySafeAreaCompatibilityMode = false.

The page (src/web/public/host-cutout.js, styles.css):
- A page is drawn behind the housing only after it said it copes
  (CodemanHost.cutoutReady); the app answers with where the housing is, and
  the toolbar's box starts left of it and pads its content past it, so the
  tabs end before the housing and the toolbar begins after it.
- Until then the web view stays below the housing with a black strip above it,
  which is what full screen looked like before: an older server, the connect
  page and a raw file are unchanged.
- With the tabs grouped by state, by case or as a ledger in the header strip
  the page says no: ending every row at the housing costs more height than the
  strip gives.

Not yet seen on a MacBook with a housing: the AppKit path was type-checked,
unit-tested where it is pure and reviewed, on a Mac mini without one.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
Codeman maintainer committed 2026-11-24 10:36:56 +01:00
1 parent 5548c17c4a
commit d5ddf2e250
19 files changed
+2493 -36

No files matched your search

+2
View File
@@ -40,6 +40,8 @@ Frontend JS modules have `@fileoverview` with `@dependency`/`@loadorder` tags. L
**Tab layouts** (`tabArrangement`, per-device, default `classic`; `state`/`case`/`ledger` are opt-in; Discussion #426): `state` (option C) splits the list into needs you / waiting / working / idle (idle is `quiet`: its heading stays as the row's anchor but draws no label; `tabStateOrder: 'urgent-last'` flips the order, needs you at the bottom): rows in the desktop header strip with left-aligned labels in a measured column (the brand sits over the strip's corner, so the rows after the first start under "Codeman"), sections in the flat rail and the sidebar, inline dividers on the tablet strip, group order with no headings on phones. `case` (option A) wraps each case's tabs in one `.tab-cluster` box and hides the `-<case>` of a generated name (`.tab-name-case`). `ledger` (option B) is a CSS-only grid on the desktop header strip. `classic` is the old strip; once it wraps on desktop it is L-shaped via `_syncTabStripCorner()` (the toolbar sits over its top-right corner and later rows run the full width under it, a strip already past its max-height keeps the plain wrap): ⚠️ `.tabs-corner` comes off before the wrap is measured, and the strip is `display: block` in that state, so flex-only rules do not apply to it there (`test/tab-strip-corner.browser.test.ts`). Pure cores: `CodemanTabTriage` and `CodemanTabClusters` (constants.js). ⚠️ `state` is the flex `order` property plus `aria-hidden` heading/break elements reconciled in place by `_syncTabTriageChrome()` after BOTH render paths, never a DOM reorder (a state change is an incremental pass). ⚠️ `case` boxes ARE a DOM grouping, so the incremental path rebuilds whenever `_tabClusterLayout().key` changes; membership follows `_mobileOverviewCaseFor()` like the home screens. ⚠️ Drag only reorders within a group or box (`_isTabDropAcrossGroups()`). ⚠️ Named groups in the vertical rail win over both groupings. ⚠️ `classic` must leave no trace (no headings, no inline order, no boxes, no name split), and the ledger must not change the markup. ⚠️ Grouping is a render layer: `sessionOrder`, Alt+[ / Alt+], Ctrl+Tab and Alt+1..9 keep the canonical order, and only the phone swipe walks the drawn order (`nextSession({ visual: true })` through `_stripSessionOrder()`, the same `_visibleTabRows()` walk the strip's arrow keys use); an active session the list does not draw steps in at the first or last row, and an empty drawn list goes nowhere rather than falling back to a hidden session (`test/session-swipe-gesture.test.ts`). Tests: `test/tab-triage.test.ts`, `test/tab-clusters.test.ts`. → [architecture-invariants#tab-layouts-by-state-by-case-ledger](../../docs/architecture-invariants.md#tab-layouts-by-state-by-case-ledger)
**Header beside a camera housing** (`host-cutout.js`, the `html.host-cutout` rules in styles.css; Codeman Desktop only, `packages/desktop/src/whole_screen.rs`): the Mac app can take a MacBook's whole display, and the page's top edge is then the display's, with the camera housing (the notch) covering a piece of the header row. The app puts a page there only after the page said it copes: the module calls `CodemanHost.cutoutReady(true)` and is answered with `CodemanHostCutout.apply({ left, width, height })` (CSS pixels from the viewport's top-left corner; `apply(null)` when there is none any more), which sets `--host-cutout-left/-width/-height` and the class. ⚠️ The layout is ONE box: the toolbar (`#headerRight`) starts just left of the housing, runs to the header's right padding and pads its content past the housing, so the tabs (or a solo window's title) end where it begins, and `_syncTabStripCorner()` sizes the L-shaped strip's float from that same box. Never position anything else in the header's first row by the housing, and anything new that paints in that row must sit inside the tab strip or the toolbar. ⚠️ `0.75rem` in the rule is the header's own side padding; change the two together (pinned by the test). ⚠️ The rule replaces a toolbar width the user chose (`html[data-header-right-width]:not(.host-cutout)`) and hides the divider handle while it holds. ⚠️ With the tabs grouped by state, by case or as a ledger IN THE HEADER STRIP every row sits beside the toolbar, so ending them at the housing costs more height than the strip gives (measured 69 px for 32 px): `fits()` says no there, the module answers `cutoutReady(false)` and drops the layout at once, and the app keeps the page below the housing. It re-announces only when `data-tab-arrangement`, `data-session-list` or `data-tab-orientation` change; a solo window always fits. ⚠️ The script is in `<head>` and NOT deferred, after the pre-paint script that writes those attributes: the app hears before first paint, so the page is not painted below the housing first and behind it a moment later; `window.app` may not exist yet, so it is only used through `?.`. In a browser tab there is no `CodemanHost.cutoutReady` and the module does nothing. Tests: `test/host-cutout.test.ts`, `test/host-cutout.browser.test.ts` (browser suite, not in the gate).
**Header stats styles** (`headerStatsStyle`, per-device, desktop only, default `compact`; Discussion #426 option G): `tiles` / `compact` (two pills, a ring beside every value) / `classic` (as before), keyed on `data-header-stats` (pre-paint + `applyHeaderStatsStyle()`), forced to `classic` below 768px and in a solo window. ⚠️ The clustered styles MOVE `#connectionIndicator` into `#headerSystemStats` and `#planUsageChip` right after it; `classic` moves them back to comment anchors. ⚠️ WS joins the pill only while System Stats is shown. ⚠️ The extra parts (stat rings, tile words, plan rings, meters) are always rendered and hidden by default in CSS, which is what keeps `classic` unchanged; tile words are derived beside the connection descriptor, never added to it (`test/connection-indicator.test.ts` pins its shape). ⚠️ A tile is a three-row grid (label, value, bar) with pixel line-heights and the bundled JetBrains Mono; never lay the bar over a fixed-height tile (a taller system mono put the value on top of it). The WS tile's grid lives on the inner `.connection-tile`, because JS writes the indicator's `display` inline. Tests: `test/header-stats-style.test.ts`. → [architecture-invariants#header-stats-styles](../../docs/architecture-invariants.md#header-stats-styles)
**Phone overview home screen** (`mobile-overview.js`, per-device `mobileOverviewEnabled`, default ON): under 600px the "C" logo shows NEEDS YOU / CURRENT / PAST SESSIONS instead of the welcome overlay, branched in `showWelcome()`/`hideWelcome()` via width-driven `shouldUseMobileOverview()`. ⚠️ The container ships `hidden` and only this module removes it: never give `.mobile-overview` a bare `display` rule (desktop does not load `mobile.css`). ⚠️ The split Run button must carry the toolbar's own classes (`btn-toolbar btn-run mode-<backend>` / `btn-run-gear`) and mobile.css must set no `background`/`color` on it; row status must mirror the session-tab alert language. PAST rows resume through the shared `resumeHistorySession()`. Status pills carry `data-i18n-skip`. → [architecture-invariants#phone-overview-home-screen](../../docs/architecture-invariants.md#phone-overview-home-screen)
+132
View File
@@ -0,0 +1,132 @@
/**
* @fileoverview Keeps the header clear of a camera housing (the notch of a MacBook display).
*
* In a browser tab nothing is ever drawn behind the housing: macOS keeps windows, and its own full screen,
* below it. Codeman Desktop can take the whole display (its View menu: "Full Screen Uses the Area Beside the
* Camera"), and the page's top edge is then the display's, with the housing covering a piece of the header
* row. A page has to keep its controls out from under it, so the app only puts a page there after the page
* said it can: this module calls `CodemanHost.cutoutReady(true)`, and the app answers with
* `CodemanHostCutout.apply({ left, width, height })`, the housing in CSS pixels from the viewport's top-left
* corner, or `apply(null)` when there is none any more (full screen left, the window moved to another display).
*
* The layout itself is CSS (styles.css, `html.host-cutout`): the toolbar's box starts just left of the housing
* and its content just right of it, so the tabs end before the housing and the toolbar begins after it. This
* module only sets the three custom properties and the class, then has the tab strip measure the toolbar again.
*
* Not every layout gains from that. With the tabs grouped by state, by case or as a ledger in the header strip,
* every row of tabs sits beside the toolbar, so ending them all at the housing costs more height than the strip
* beside the housing gives (measured: 69 px more header for a 32 px strip). For those the page says
* `cutoutReady(false)` and stays below the housing; it says so again whenever the layout changes.
*
* A page without this module (an older Codeman server) never calls `cutoutReady`, and the app keeps it below
* the housing with a black strip above it, the way macOS's full screen looks.
*
* @loadorder in <head>, before first paint and before every other module, so the app hears early and the page
* is never painted in both places. Self-contained: `window.app` is used only if it already exists.
*/
(function () {
'use strict';
/** No housing is larger than this; a larger value is a mistake and must not empty the header. */
const MAX_HEIGHT = 200;
/** `cutout` as three finite numbers, or null when it is not a usable rectangle. */
function normalize(cutout) {
if (!cutout || typeof cutout !== 'object') return null;
const left = Number(cutout.left);
const width = Number(cutout.width);
const height = Number(cutout.height);
if (![left, width, height].every(Number.isFinite)) return null;
if (left < 0 || width <= 0 || height <= 0 || height > MAX_HEIGHT) return null;
return { left, width, height };
}
/** The tab arrangements that lay out every row of the header strip themselves (app.js, Tab layouts). */
const GROUPED = ['state', 'case', 'ledger'];
/** Whether the header gains from being drawn beside the housing in the layout the page is in. */
function fits() {
const data = document.documentElement.dataset;
// A solo window (/session/:id, under any base path) has no tab strip. Its URL says so before the server's
// own marker is parsed, which sits at the end of <head>.
const solo =
/\/session\/[^/]+\/?$/.test(location.pathname) ||
(typeof window.__CODEMAN_SOLO__ === 'string' && window.__CODEMAN_SOLO__ !== '');
const tabsInHeader = !solo && data.sessionList !== 'sidebar' && data.tabOrientation !== 'vertical';
return !(tabsInHeader && GROUPED.includes(data.tabArrangement));
}
let current = null;
/** What the app was told last, so it only hears of a change. */
let announced = null;
/** Only a native wrapper has `cutoutReady`; a browser tab stays as it is. */
function announce() {
const ready = fits();
if (ready === announced) return;
announced = ready;
// The app answers a yes with the housing; a no takes effect here at once.
if (!ready) apply(null);
try {
if (typeof window.CodemanHost?.cutoutReady === 'function') window.CodemanHost.cutoutReady(ready);
} catch {
/* the wrapper went away: nothing to tell */
}
}
/** The tab strip measures the toolbar (wrap, the L-shaped corner), and the lineage lines follow the tabs. */
function relayout() {
window.app?.updateTabOverflowMode?.();
window.app?.updateConnectionLines?.();
}
/**
* Lay the header out around `cutout`, or (null, or anything that is not a rectangle) as if there were none.
* Returns true, so a caller can tell that the page took it.
*/
function apply(cutout) {
// An answer that crossed a layout change: the page already said no.
const next = fits() ? normalize(cutout) : null;
const same =
(!next && !current) ||
(!!next &&
!!current &&
next.left === current.left &&
next.width === current.width &&
next.height === current.height);
if (same) return true;
current = next;
const root = document.documentElement;
if (next) {
root.style.setProperty('--host-cutout-left', next.left + 'px');
root.style.setProperty('--host-cutout-width', next.width + 'px');
root.style.setProperty('--host-cutout-height', next.height + 'px');
root.classList.add('host-cutout');
} else {
root.classList.remove('host-cutout');
root.style.removeProperty('--host-cutout-left');
root.style.removeProperty('--host-cutout-width');
root.style.removeProperty('--host-cutout-height');
}
relayout();
return true;
}
window.CodemanHostCutout = {
apply,
normalize,
fits,
/** The housing the header is laid out around right now, or null. */
current: () => current,
};
announce();
// The layout is three attributes on <html>, written before first paint (index.html) and again whenever a
// setting changes (app.js, settings-ui.js).
if (typeof MutationObserver === 'function') {
new MutationObserver(announce).observe(document.documentElement, {
attributes: true,
attributeFilter: ['data-tab-arrangement', 'data-session-list', 'data-tab-orientation'],
});
}
})();
+5
View File
@@ -67,6 +67,11 @@
here and boot will contradict this value, animating the drawer open by
itself on every load between 768 and 1023px. -->
<script>try{var m=window.innerWidth<768||(('ontouchstart' in window||navigator.maxTouchPoints>0)&&window.innerWidth<1024);var k=m?'codeman-app-settings-mobile':'codeman-app-settings';var A=JSON.parse(localStorage.getItem(k)||'{}');var L=A.sessionListLayout;var F=Number(A.sessionSidebarFontSize);var solo=/^\/session\//.test(location.pathname);var C=localStorage.getItem('codeman-sidebar-collapsed');var S=(L==='sidebar'||L==='sidebar-rich')&&!solo;document.documentElement.dataset.sessionList=S?'sidebar':'header';document.documentElement.dataset.sidebarDetail=(S&&L==='sidebar-rich')?'rich':'simple';document.documentElement.dataset.sidebar=(C===null?window.innerWidth<1024:C==='1')?'collapsed':'expanded';var V=A.tabOrientation==='vertical'&&!S&&!solo&&window.innerWidth>=768;document.documentElement.dataset.tabOrientation=V?'vertical':'horizontal';document.documentElement.dataset.tabRailDetail=(A.tabRailDetail==='simple')?'simple':'rich';document.documentElement.dataset.tabRailSort=(A.tabRailSort==='manual')?'manual':'activity';var T=A.tabArrangement;document.documentElement.dataset.tabArrangement=(T==='state'||T==='case'||T==='ledger')?T:'classic';document.documentElement.dataset.tabStateOrder=(A.tabStateOrder==='urgent-last')?'urgent-last':'urgent-first';document.documentElement.dataset.tabLogos=(A.showTabCliLogos===false)?'off':'on';var H=A.headerStatsStyle;document.documentElement.dataset.headerStats=(window.innerWidth<768||solo)?'classic':(H==='classic'||H==='tiles')?H:'compact';var W=Number(A.tabRailWidth);if(V){if(Number.isInteger(W)&&W>=208&&W<=360)document.documentElement.style.setProperty('--tab-rail-width',W+'px');else if(document.documentElement.dataset.tabRailDetail!=='simple')document.documentElement.style.setProperty('--tab-rail-width','320px');}if(Number.isInteger(F)&&F>=11&&F<=18)document.documentElement.style.setProperty('--session-sidebar-name-font-size',F+'px');}catch(e){document.documentElement.dataset.sessionList='header';document.documentElement.dataset.sidebarDetail='simple';document.documentElement.dataset.sidebar='expanded';document.documentElement.dataset.tabOrientation='horizontal';document.documentElement.dataset.tabRailDetail='rich';document.documentElement.dataset.tabRailSort='activity';document.documentElement.dataset.tabArrangement='classic';document.documentElement.dataset.tabStateOrder='urgent-first';document.documentElement.dataset.headerStats='classic';document.documentElement.dataset.tabLogos='on';}</script>
<!-- Camera housing (the notch of a MacBook display): only Codeman Desktop ever draws
the page behind it, and only once the page said it keeps its header clear. Not
deferred, so the app hears before first paint and the page is never painted
below the housing first and behind it a moment later. See host-cutout.js. -->
<script src="host-cutout.js"></script>
<!-- Inline critical CSS for instant skeleton paint (before styles.css loads) -->
<style>
.loading-skeleton{display:flex;flex-direction:column;height:100vh;height:100dvh;background:var(--bg-dark,#11151c)}
+40 -2
View File
@@ -2321,9 +2321,13 @@ html[data-tab-orientation='vertical'].tab-rail-compact
/* Everything below applies only where the tabs share the header with the toolbar, i.e. where the handle is
visible to undo it: not in the sidebar layout, the vertical rail or a solo window, and not on a phone. */
/* A width the user chose: the toolbar keeps it and wraps onto a second line when its content is wider. */
/* A width the user chose: the toolbar keeps it and wraps onto a second line when its content is wider.
Not while the toolbar is laid out around a camera housing (html.host-cutout, further down), which decides
where it starts. */
@media (min-width: 769px) {
html[data-header-right-width]:not([data-tab-orientation='vertical']):not([data-session-list='sidebar'])
html[data-header-right-width]:not(.host-cutout):not([data-tab-orientation='vertical']):not(
[data-session-list='sidebar']
)
body:not(.solo-mode)
.header-right {
flex: 0 0 var(--header-right-width);
@@ -2413,6 +2417,40 @@ body.solo-mode .header-divider {
}
}
/* A camera housing over the header row (host-cutout.js). Codeman Desktop can take a MacBook's whole display,
and the page's top edge is then the display's, with the housing (the notch) covering a piece of this row.
The app says where it is: --host-cutout-left, -width and -height, in pixels from the viewport's top-left
corner. The toolbar's box then starts just left of the housing and runs to the header's right edge
(0.75rem is the header's own padding), and its padding puts the first control just right of the housing.
That one box keeps the whole row clear: the tabs, or a solo window's title, end where it begins, and the
L-shaped strip sizes its corner from it (`_syncTabStripCorner()`), so a wrapped strip's first rows stop
short of the housing too. A toolbar wider than the room beside the housing wraps onto a second line, below
it. Every layout has this box (strip, sidebar, rail, solo window), so the rule has no exceptions. */
@media (min-width: 769px) {
html.host-cutout {
--host-cutout-gap: 8px;
}
html.host-cutout .header > .header-right {
box-sizing: border-box;
flex: 0 0 auto;
width: calc(100vw - 0.75rem - var(--host-cutout-left) + var(--host-cutout-gap));
padding-left: calc(var(--host-cutout-width) + 2 * var(--host-cutout-gap));
/* The divider line would sit against the housing. */
border-left-color: transparent;
flex-wrap: wrap;
justify-content: flex-end;
align-content: center;
row-gap: 0.25rem;
min-height: var(--header-height);
}
/* The box's left edge is the housing's, not a width to drag. */
html.host-cutout .header-divider {
display: none;
}
}
/* The opt-in host readings (GPU, VRAM, MHz) start hidden and are shown by panels-ui.js once the host
reports them; a plain `display` on .stat-item would override the attribute, and the Tiles style sets its own
(a grid) at a higher specificity, so the selector carries the style attribute to outrank it. */