---
status: accepted
date: 2026-09-14
---

# The standard menus the runner keeps

> **Accepted (2026-09-14), built the same day** — what the building
> changed is at the end, under [*What the building
> changed*](#what-the-building-changed). Raised by using a kui app on
> macOS 26 and pressing fn+ctrl+F: nothing. The system's window
> shortcuts — Fill, Center, the tiling arrows, Return to Previous Size,
> Enter Full Screen on fn+F — are not system shortcuts. They are **menu
> items**, rows AppKit adds to the application's Window menu, and their
> key equivalents fire through that menu and nowhere else. winit installs
> only the application menu (About, Hide, Quit), and
> [ADR 0018](0018-a-menu-bar-the-app-declares.md) replaces the bar with
> exactly what the app declared, so a kui process has no Window menu
> unless the app happens to declare one — and a declared one is not
> registered, so it gets nothing either. This document gives every kui
> process on macOS the menus a Mac app is expected to have when the app
> has said nothing about menus, and says what a declared bar gets.

## Context

- **What AppKit needs, measured** (`macOS 26.6`, a Swift probe posting
  the chords through the HID tap and reading the frame back):

  | bar | fn+ctrl+F (Fill) | fn+F (Full Screen) |
  |---|---|---|
  | no Window menu | nothing | nothing |
  | a menu merely *titled* "Window" | nothing | nothing |
  | a Window menu registered via `NSApp.windowsMenu` | fills | full screen |

  Registering is the whole of it. Once registered, AppKit populates the
  menu itself the first time it is asked for — Fill, Center, Move &
  Resize ▸, Full Screen Tile ▸, Remove Window from Set, Move to iPad,
  Minimize All, the window list, the tab rows — and the chords work.
  **Enter Full Screen is the exception:** AppKit adds that one row once,
  at `finishLaunching`, and only to a Window (or View) menu registered by
  then. A menu registered from the run loop gets tiling and no full
  screen. A row kui adds itself — `toggleFullScreen:` on the responder
  chain, key equivalent `f` with the Function modifier — fires on fn+F
  *and* fn+shift+F, and AppKit's own validation retitles it *Exit Full
  Screen* while the window is in one, so it is indistinguishable from
  the row AppKit would have added.

- **ADR 0018 declined standard application-menu roles** — `about`,
  `quit`, `services` — because they change what an item *is*: one the
  platform performs rather than one the app hears, needing their own
  answer for the drawn bar. That reasoning stands and this document does
  not reopen it. A Window menu is not a role: no binding spells it, no
  drawn bar draws it, and Windows and Linux window managers own tiling
  already (Win+arrows, the compositor's edges). It is a fact about the
  macOS runner, and lives there.

- **The runner already performs the Edit chords.** ⌘C/X/V/A, ⌘Z/⇧⌘Z and
  ⌘Y are handled in `Shell::on_key` after the press has gone to the
  key-focused sink (ADR 0011: chords bubble, and a sink that binds ⌘C
  itself hears it). An Edit menu of `MenuRole::Copy` rows bound to ⌘C
  would change that: AppKit consumes a key equivalent before the window
  sees it, so the sink would stop hearing the chord and the role would
  run instead. The menu has to spell the chord without taking it.

- **The empty declaration took ⌘Q away.** `apply(&MenuBar::default())`
  was `setMainMenu(None)`: a process that declared a bar and then
  declared none, or told the core to draw the bar itself
  (`set_native_menu_bar(false)` — the devtools' `menus` toggle, every
  example that defaults to drawn menus), had no bar at all, winit's Quit
  included.

## Decisions

1. **A process that declares no bar has the standard bar.** winit's
   application menu — kept, not rebuilt, so its Services entry stays the
   one the app registered — with **Edit** (Undo, Redo, Cut, Copy, Paste,
   Select All) and **Window** (Minimize ⌘M, Zoom, Enter Full Screen,
   Bring All to Front) beside it, the Window menu registered as
   `NSApp.windowsMenu`. AppKit adds the rest to Window: Fill, Center and
   the tiling submenus. Of what it adds to Edit, Emoji & Symbols and
   Dictation stay and type into the window — through view answers the
   runner installs on winit's view, since winit's own drop them — and
   Writing Tools and AutoFill are removed again, since neither can act
   in a kui window (*what checking W15 showed*, below). It goes up at the first pump, comes back when an app that
   declared a bar declares an empty one, and is what the platform shows
   while a core draws its own bar — the platform's standard menus above,
   the app's drawn ones in the window, never two copies of the app's.

2. **A declared bar is exactly what the app said, and a menu it titles
   `Window` is the platform's Window menu.** Nothing is appended to a
   declaration — an app that wants tiling names a menu `Window`, and the
   runner registers that one, which is how AppKit itself reads a nib. It
   gains the one row AppKit cannot add after launch, Enter Full Screen;
   its other rows are the app's, and AppKit's rows land above them. That
   menu alone among a declared bar's is validated (`autoenablesItems`),
   because the platform's rows in it need it — validation is what
   retitles Enter Full Screen to *Exit Full Screen* and greys Remove
   Window from Set — and the app's rows keep the state they declared:
   `validateMenuItem:` answers a declared row with its own enabled flag.
   Declaring `View` or `Help` was already this (ADR 0018, *what running
   it showed*): macOS adds rows to menus it knows by title, and a
   declared bar was never only its declaration. A declared `Edit` is,
   since 2026-09-14, its declaration plus the two appended rows that
   work — Emoji & Symbols and Dictation — with the two that cannot
   trimmed from it exactly as from the standard one.

3. **The standard Edit menu's rows are chords, not roles.** Choosing
   Copy — by mouse or by the ⌘C AppKit consumed — *replays* ⌘C: the
   press to the key-focused sink, the runner's own half of the chord
   (`Shell::edit_chord`, the block `on_key` always ran, now callable
   from both), the release. A sink that binds ⌘C itself hears the same
   thing from the menu; an editor copies through the code the key takes;
   `request_copy`'s tier-3 ask still goes out. Nothing arrives twice,
   because the key never reached winit. The rows carry no `MenuRole` and
   post no `menu` event — they are the keyboard, spelled where a Mac user
   looks for it.

4. **A popup is not in the Window menu.** `WindowKind::Popup` windows
   are marked `excludedFromWindowsMenu`: the list is for windows the user
   would switch to, and a menu surface with no title is not one.

## What was declined, and why

- **Appending the Window menu to a declared bar too.** It would give
  every kui app tiling for free, but a declared bar would no longer be
  what the app declared, and an app that wanted the menu elsewhere or
  under another name would have no way to say so. Naming a menu `Window`
  costs one word.

- **`MenuRole::Minimize` / `Zoom` / `FullScreen` / `Quit`.** (*`Quit`
  built 2026-10-09 with the application menu's other rows, backlog F152;
  see ADR 0018.*) ADR 0018's
  decline, unchanged: each needs a drawn-bar answer, an ABI bump and four
  bindings, for rows the platform performs on its own responder chain.
  The condition that would build them is an app that wants to compose a
  Window menu with its own rows *between* the platform's, which the
  register-by-name rule cannot give.

- ~~**Validating the Edit rows** (Copy greyed with nothing to copy). The
  keyboard has no such greying either; the rows are the keyboard. Filed
  as W14 for the day a design wants it.~~ **Reversed the same day**
  (W14 built): the "not free" was about reading the core from inside
  AppKit's `validateMenuItem:`, and that is not what it costs. The runner
  reads six facts after every event batch (`edit_state` in `menus.rs`:
  editor history and selection, the window's scope or grid, whether a
  sink would hear the chord) and stamps one byte on the bar's target;
  the callback reads the byte. The menu opens with Copy greyed and no
  selection, Undo greyed with no history, and everything lit while a
  key sink has the chord — measured against `clipboard` through the AX
  API. The standard Edit menu is the one menu of kui's that autoenables.

- **Registering the standard Window menu before launch** so AppKit adds
  Enter Full Screen itself. It works (a menu registered before
  `finishLaunching` and attached to the bar after still gets the row),
  but a declared `Window` menu is always registered after launch and
  would then be the one path without full screen. One row kui adds, in
  both paths, is one rule.

## Consequences

- fn+ctrl+F fills, fn+ctrl+arrows tile, fn+ctrl+R returns, fn+F and
  fn+shift+F enter and leave full screen, ⌘M minimizes — in every kui
  window on macOS, with no line in the app. Driven through the AX API
  against `examples/rust/widgets/edit.rs` (standard bar) and
  `examples/rust/widgets/menu_bar.rs` (declared bar with a `Window`
  menu): the frame goes to the screen's size and back, the row reads
  *Exit Full Screen* while it is in one, and Edit ▸ Select All / Copy /
  Cut / Paste / Undo / Redo chosen from the bar do to the field what the
  chords do, read back through the clipboard.

- `MacMenuBar` gains the standard bar, built once and kept; `apply` of
  an empty bar installs it instead of nothing; `take_chosen` answers
  `BarPick::Item` or `BarPick::Chord`. The runner's `applied_menu_bar`
  is an enum (`Standard` / `Declared(window, revision)`) rather than a
  tuple with a sentinel revision. `Shell::edit_chord` is the chord block
  of `on_key`, factored so the menu can call it with the letter and
  Shift it means rather than with a winit event it does not have.

- The `menu_bar` example declares a fourth menu, `Window`, with one
  checked row, and its headless drive counts four. Nothing changes in
  any binding, the ABI, the corpus or the drawn bar: this is macOS's
  runner doing what a macOS runner owes.

## What the building changed

- The first version re-parented winit's application menu into a fresh
  root and aborted with a foreign exception: an `NSMenu` has one
  supermenu. The second appended Edit and Window to winit's own root and
  re-set it — and got no Emoji & Symbols, because AppKit scans a bar for
  the menus it knows by title only in `setMainMenu:` of a bar it has not
  seen. The third moves winit's *item* (`removeItemAtIndex(0)`) into a
  fresh root, which is what ships: one bar object, scanned once, with
  the app menu, its Services registration and AppKit's Edit rows all
  where a declared bar has them.

- Enter Full Screen was expected to come from AppKit and did not; the
  probe found the launch-time rule above, and the row became kui's.

- Reviewing the branch: the declared `Window` menu's Enter Full Screen
  never read *Exit Full Screen*, because ADR 0018's declared menus turn
  autoenabling off and only validation retitles; that menu now
  autoenables, with the bar's target answering a declared row's own
  state. And a Select All's placeholder end — on the scope's key, placed
  by row — was placed at the *start* of the built runs once its row was
  built, since no run carried the scope's key: scrolled to the bottom,
  the highlight vanished. An end whose row is built now lands in that
  row's runs.

- The probe itself: a CGEvent posted from a process that exits
  immediately never arrives — the poster has to outlive the post by a
  run-loop turn. Half an hour of "the chord does nothing" was that.

## What checking W15 showed (2026-09-14)

The ADR left AppKit's four Edit rows as a guess — "Emoji & Symbols and
Dictation most likely type into a focused editor; Writing Tools and
AutoFill most likely do nothing" — because the AX audit could press the
rows but not the palettes they open. Driven by hand on macOS 26.6 against
`examples/rust/widgets/edit.rs`, with TextEdit beside it as the control
for the same presses, and read back through the field's `AXValue`:

- **Emoji & Symbols** opened the palette, anchored at the field's caret
  (kui's `firstRectForCharacterRange` answer, the C17 rect, is right).
  Clicking an emoji closed the palette and nothing arrived — no
  `changed`, the field unchanged. winit's view commits an `insertText:`
  only when it has marked text (0.30.13 `view.rs`, `insert_text`; master
  gates on a `pending_commit` from a composition session instead, the
  same effect), and the palette's insert is not a composition. AppKit
  delivered it; winit dropped it. The same was true of the palette
  opened from the keyboard (⌃⌘Space), which no menu controls.
- **Start Dictation** did nothing. In TextEdit the same `AXPress`
  retitled the row to Stop Dictation and put the microphone popover up;
  in kui the row kept its title and no microphone appeared. A bare
  `NSTextInputClient` view shaped like winit's, logging every message
  AppKit sent it, found the gate: dictation probes the responder for
  `isEditable` and reads `selectedRange`, and starts only when the first
  answers YES **and** the second is a real range — with either missing
  it stays silent, with both the row flips and the microphone comes up.
  winit's view answers neither (its `selectedRange` is `{NSNotFound,
  0}` by design). The row's `startDictation:` never reaches the view
  even when the view implements it: AppKit handles it and asks.
- **Writing Tools** opened its panel beside the selection, and every
  tool in it did nothing — the view answers `selectedRange` with
  `{NSNotFound, 0}` and `attributedSubstringForProposedRange:` with nil,
  so the panel had no text to work on; it also probes for
  `writingToolsBehavior` and `willBeginWritingToolsSession:`. Summary,
  clicked, closed the panel with no result.
- **AutoFill** greyed its three rows itself (enabled in TextEdit): they
  validate against a text-input responder the view is not.

So none of the four worked, and the two that "most likely" would were
the worse two: an enabled row that opens a picker and drops the pick
reads as a bug in the app. The entry's lever was renaming the menu; a
probe app found a finer one — AppKit appends the rows in `setMainMenu:`'s
scan of a root it has not seen, recognised by the *head item's* title (a
menu merely titled `Edit` under an untitled head gets nothing), and
neither re-appends on open nor scans a root twice — so the rows can be
removed after the set and stay removed. The user defaults
`NSDisabledCharacterPaletteMenuItem` and `NSDisabledDictationMenuItem`
would hide those two rows and nothing hides the two submenus.

**And what building it showed, the same day.** The two rows that could
work were made to: the probe view had shown what each needed, and the
selectors are Apple's protocol selectors, so the runner overrides them
on winit's view class at runtime (`mod macos_text_input`,
`method_setImplementation` / `class_addMethod`) — the first thing in the
runner that reaches into winit rather than around it. `keyDown:` is
wrapped to count depth, because ordinary typing also passes through
`insertText:` (winit's `keyDown:` calls `interpretKeyEvents:` and makes
`KeyboardInput` of it); `insertText:replacementRange:` runs winit's and
then, with no marked text and no key press on the stack, queues the
string for the runner, which dispatches it as `InputEvent::Commit` to
the window's key target — never twice, since winit commits exactly when
it had marked text; `selectedRange` is replaced and `isEditable` added,
both answering from facts the runner stamps per frame (editable while
`Core::ime_rect` is `Some`, the caret and selection as UTF-16 offsets
into the focused stock editor's text, recounted only when the editor's
key, version, caret or selection moved). Two traps: the view's class is
not winit's — AccessKit subclasses it at runtime
(`AccessKitSubclassOfWinitView`) and defines none of these selectors, so
the override walks the chain to the class that defines each and patches
*that* one, never an inherited `NSView` method; and the first synthetic
keystroke after a launch is dropped by the probe, not the window. With
it, an emoji picked from the menu lands in the field and in the
document at the caret, ⌃⌘Space's does too, and Start Dictation flips to
Stop Dictation with the microphone over the caret. `macos_menu::trim_edit`
now keeps those two rows and removes Writing Tools and AutoFill, for the
standard Edit and a declared one alike. A dictation revision of words
already committed arrives with a replacement range winit ignores (its
own TODO), so it appends rather than replaces. Writing Tools would need
the surrounding-text half of the protocol answered from the editor —
the selected text back, `writingToolsBehavior`, and a real range on the
insert that applies its result — a feature, filed under W15's outcome
with its condition; AutoFill wants an `NSTextField` and is out of reach.
