33 KiB
One Hex Process Per User, Hosting Rune Windows
Status: implemented on rune-ui for every OS, and GPUI is deleted
(see rune-ui.md). Linux has launch forwarding, the
single-instance socket, the systemd unit, and the Rune window in the Hex
process (see ../linux.md) and has run in a
real session; macOS has been compiled, tested, and launched without being
seen; Windows has only been cross-compiled. Never merge this to main ahead
of the real-window checks.
Goal: Hex is one long-lived process per user and data root, on every OS:
- Launching
hexwhen no instance runs starts it in the background: listener, models, HUD. - Launching it again tells the running process to open or focus its window, then exits.
- CLI controls (
hex dictation …,hex voice-action …,hex paste-last,hex status,hex stop) forward to the running process. - Closing the window leaves the process running.
The engine is a library. Rune is the only UI; GPUI is deleted.
hex (no instance) -> become the instance (or the supervisor starts it) -> open window unless --background
hex (instance) -> forward Activate{activation token} -> exit 0
hex dictation start -> forward Shortcut -> exit 0 | non-zero without an instance (never starts one)
close window -> Rune window gone (or hidden); runtime, listener, HUD, models stay
quit -> explicit: tray / menu-bar Quit, "Quit Hex" in the window, `hex stop`
Before the port (with GPUI)
Linux: two processes
hex serviceislinux_app::run_service, under thehex.serviceuser unit.- It owns
LinuxDesktopHost(listener, portal and X11 shortcuts, models, updates, History writes, paste) and the GTK HUD thread (linux_desktop.rs). - Its 20 ms loop serves
linux_service::Serveronservice.sockin the data root. The socket is guarded byinstance::acquire("service"), a peer-UID check, and bounded frames.
- It owns
- The window is a separate client process. That is GPUI's
hex app, or Rune'shex app --ui rune(rune_ui::run,src/linux.rs).- Rune's
UiholdsService::Live(Box<Client>), whichsetupcreates withClient::with_waker. - The
Clientthread pollsSnapshotevery 250 ms and calls Rune's waker on each update. The window sendsDesktop(_),CaptureShortcutFor,SetShortcut,CancelShortcut,ChooseModel,CancelModel, andReloadSettings, the last after it writessettings.json. - Closing the window ends that process.
- Rune's
- Lifecycle and launchers.
hex start|stop|restartdrivesystemctl --userafter writing an owner-onlysession.env. The autostart entry runshex start, and the desktop entry runshex app. Both come fromscripts/install-linux-release.sh, which also writes aType=simple,PartOf=graphical-session.target,Restart=on-failureunit. The Home Manager module (nix/hm-module.nix) writes the same unit. - Linux was one process with a GTK tray until
9a11b5f. A GTK thread beside a GPU UI loop in one process is proven.
macOS: one process
Hex.appis anLSUIElementmenu-bar app (Command::App→meeting_watcher::run).- LaunchServices keeps it single-instance. A relaunch arrives as
applicationShouldHandleReopen, which GPUI callson_reopen, and Hex answers withapp_window::open_or_focus. status_item.rsis plain AppKit (objc2, no GPUI), and the event tap runs on its ownCFRunLoopthread (suppression.rs).local_api(loopback HTTP, owner-only discovery, bearer token) already forwards dictation control (POST /dictations) and the debug-only/dev/control.- The GPUI-specific pieces are the window, the Metal/GPUI HUD
(
dictation_indicator), the meeting capsules, and the GPUIApplicationthat owns the run loop.
Windows: one process
windows_app::openruns GPUI, the tray (tray-icon), a GPUI HUD window, andWindowsDesktopHoston the UI thread.- Single instance is a named auto-reset event
(
Local\com.kitlangton.hex.app). A relaunch callsAllowSetForegroundWindowplusSetEventand exits. A--hiddenlogin launch only exits. - Close hides the window. There is no CLI forwarding.
The shape on every OS
The runtime owns all Hex state and all non-UI work, on threads it owns.
The Rune app owns the main thread, the window or windows, and the native
chrome: the menu-bar item, the tray, and on Linux nothing. An in-process
HostHandle connects the two. It replaces the socket Client and keeps
the same vocabulary:
// In Hex (shared), not Rune.
#[derive(Clone)]
pub struct HostHandle { /* SyncSender<HostRequest>, Arc<ArcSwap<Published>>, Waker list */ }
impl HostHandle {
pub fn send(&self, request: HostRequest) -> Result<()>; // today's Request minus transport-only ones
pub fn state(&self) -> Arc<Published>; // DesktopSnapshot + settings + editing + error
pub fn subscribe(&self, wake: rune::Waker) -> Subscription; // runtime calls wake after publishing
}
- The runtime thread. It runs
LinuxDesktopHost(laterWindowsDesktopHostand the macOS runtime) in its own loop, therun_serviceloop minus the socket. After every change it publishes anArc<Published>and calls the subscribers' wakers. - Why not host it on the UI thread. Rune's
pollruns only on a window's frames, and Hex's work must continue with zero windows. Keeping it off the UI thread also means no blocking host call can stall rendering. - The window.
rune_uikeepsService::{Live, Fixture}, withLiveholding aHostHandlein place of theClient.pollreadsstate(), so the pane code does not change. Snapshots and goldens keep usingFixture. - Shortcut commands from the CLI go from the socket thread straight to
the listener's
SyncSender<ShortcutCommand>, never through the UI or the runtime loop, because keybinding hold-to-dictate is timing-sensitive.
What Rune must gain
Landed on Rune main (a9cde14, a242f5a; public as 7eea3a3, which Hex pins)
Requirements 1–5 below landed as a smaller API than the proposal: one window
per app, built on the existing AppSpec. It is documented in Rune's
crates/rune/README.md ("App lifetime") and exercised by
examples/background.
let app = rune::App::new(spec())
.init(move || Ui::live(host)) // first state from a closure: the HostHandle, no globals
.args(Vec::new()) // Hex owns argv; Rune parses only what it's given
.windowless() // or start open; implies keep_running
.keep_running() // closing keeps the process, state, and loop
.on_close(|ui, tx| ..); // flush drafts; tx.quit() quits instead
let handle = app.handle(); // AppHandle<Ui>: Clone + Send + Sync, usable before run
// socket thread: handle.activate(token) | handle.open() | handle.quit()
// runtime thread: handle.update(|ui, tx| ui.adopt(snapshot)) // wakes the loop, no polling
app.run(); // main thread; returns after quit
- The
Runtime<S>belongs to the app, not the window. Closing hides the window on macOS, Windows, and X11, and destroys it on Wayland. Reopening shows the same state, settled.release_gpu_when_closed()also drops the GPU device while closed. There is noon_closed(S)hand-back, because the state never leaves. - Updates run on the main thread inside the loop, in call order, even with no
window open. A Hex update may also create native main-thread objects such as
the status item or the tray. This replaces the proposed
startandon_message. - Tokens: the first window takes the launcher's
XDG_ACTIVATION_TOKENorDESKTOP_STARTUP_IDand clears both from the environment. A new window gets the token throughwith_activation_token. An open Wayland window is activated throughxdg_activation_v1on winit's display. Handlers can callTx::close_window()andTx::quit()(the "Quit Hex" row). - Observed in a headless sway on apollo: a forwarded token focuses an open window and a recreated one, and without a token the window is only marked urgent. Unverified on KWin, Mutter, niri, macOS, and Windows.
- Still open: several windows (Kit's
rooms-bindingsagent plans multi-window), window kinds (item 8), the macOS activation policy, and per-app minimum size.
Rune on origin/main (8b37ced, fetched 2026-10-22) is one winit 0.30
window per process:
crates/rune/src/window.rs:App { spec, args, live: Option<Live<S>>, proxy }. It creates the single window inresumed, andWindowEvent::CloseRequested => event_loop.exit().- Each window builds its own
Gpu, and itsRuntime<S>owns the state fromAppSpec::init: fn() -> S. crates/rune/src/tooling.rs:rune::run(spec)parses process argv (--snap,--scene…).AppSpec's hooks are plainfnpointers.
Already there:
Waker(runtime.rs:60, anEventLoopProxy<()>redraw) for other threads.set_app_id(6d87e63), which maps to winitwith_nameso Wayland'sapp_idand X11'sWM_CLASSmatchhex.desktop.
Gap 3 in rune-ui.md
is exactly this work. Everything below is shell work. winit 0.30.13 already
supports what is needed underneath (verified in its source):
- A windowless
ApplicationHandlerwithControlFlow::Wait. EventLoopProxy<T>with user events.WindowAttributesExtStartupNotify::with_activation_token. On Wayland it callsxdg_activation_v1.activateon the new surface. On X11 it sets the startup id and removes the startup notification.ActivationToken::from_raw.Window::set_visibleandfocus_window.- macOS
with_activation_policy(Accessory)andwith_default_menu(false). winit also promises never to install anNSApplicationDelegate, which leaves the delegate to Hex.
Proposed API (shell-agnostic; winit first, own shells later)
pub struct AppConfig {
pub app_id: &'static str,
pub fonts: &'static [&'static [u8]], pub families: (&'static str, &'static str),
pub keep_running_without_windows: bool, // never exit when the last window closes
#[cfg(target_os = "macos")] pub activation_policy: ActivationPolicy, // Accessory for Hex
}
/// Runs the event loop on the calling (main) thread without parsing argv. `start` runs once
/// on the main thread when the loop is live: create the status item / tray, open a first
/// window if wanted. Returns when `AppProxy::quit` is called.
pub fn run_app<M: Send + 'static>(
config: AppConfig,
start: impl FnOnce(&mut AppCx<M>) + 'static,
on_message: impl FnMut(&mut AppCx<M>, M) + 'static,
);
#[derive(Clone)] pub struct AppProxy<M> { /* EventLoopProxy<Msg<M>> */ } // Send + Sync
impl<M> AppProxy<M> { pub fn send(&self, m: M); pub fn quit(&self); }
pub struct AppCx<'a, M> { /* &ActiveEventLoop + window table + shared Gpu */ }
impl<M> AppCx<'_, M> {
pub fn proxy(&self) -> AppProxy<M>;
pub fn open<S: 'static>(&mut self, spec: WindowSpec<S>, opts: OpenOptions) -> WindowId;
pub fn window(&mut self, id: WindowId) -> Option<WindowRef<'_>>; // focus(token), show, hide, close
pub fn windows(&self) -> impl Iterator<Item = WindowId>;
pub fn quit(&mut self);
}
pub struct WindowSpec<S> { // AppSpec minus app-wide fields, with closures instead of fn pointers
pub title: &'static str, pub size: (f32, f32), pub min_size: (f32, f32),
pub init: Box<dyn FnOnce() -> S>, // captures the HostHandle
pub view: fn(&S, &mut Cx<S>) -> El,
pub setup: Option<Box<dyn FnOnce(&mut S, Waker)>>, pub poll: Option<fn(&mut S, f64, &mut Tx) -> bool>,
pub on_key: Option<fn(&mut S, &KeyEvent, &mut Tx) -> bool>,
pub on_close: CloseBehavior, // Destroy | Hide | Ask(fn(&mut S) -> CloseBehavior)
pub on_closed: Option<Box<dyn FnOnce(S)>>, // cancel an uncommitted shortcut capture, drop the subscription
}
pub struct OpenOptions { pub activation_token: Option<String>, pub visible: bool, pub kind: WindowKind }
pub enum WindowKind { Normal /* later: Panel, Overlay, LayerShell(Edge) */ }
Requirements behind that shape, in priority order:
- App lifetime separate from windows. With
keep_running_without_windowsset, closing the last window must not exit the loop. Exit happens only throughquit. Today'srun(spec)stays as a one-window convenience wrapper, so the gallery, the examples, and--snapkeep working. - Open, focus, and close on demand from other threads. Other threads
send through
AppProxy::send(anEventLoopProxyuser event). Windows can only be created inside a handler, which is the reason foron_message(&mut AppCx, M). Several windows are tracked byWindowId(App.livebecomes a map). Hex needs one normal window now, plus the HUD and the macOS capsules later. - Hide vs close.
CloseBehavior::Destroydrops the surface and theRuntime<S>: Linux and Wayland, where a toplevel cannot be hidden.Hidecallsset_visible(false)and keeps state, for Windows and macOS fast reopen.on_closedhands the state back so Hex can clean up. - Activation token.
- On creation, pass
OpenOptions::activation_tokentowith_activation_token(exists in winit). - For an existing window, add
WindowRef::focus(Some(token)). winit 0.30's Waylandfocus_window()is empty (platform_impl/linux/wayland/window/mod.rs:629), and winit has no "activate this surface with this token" call. The Rune Linux shell has two options. The first is to bindxdg_activation_v1on winit's connection, through the raw display and surface handles, and callactivate(token, surface). The second, simplest for Hex, is to destroy and recreate the window with the token, since Linux destroys on close anyway. - On X11,
focus_windowplus a_NET_STARTUP_INFO remove:message.
- On creation, pass
- Argv-free entry and closures.
run_appmust not callArgs::parse, because Hex owns its CLI.initandsetupbecome boxed closures so a window receives itsHostHandlewithout globals. - Shared GPU across windows. Create the instance, adapter, device, and queue once per app, and per-window surfaces and renderers. Release the device after the last window closes (configurable), so an idle Hex holds no UI GPU memory beside the speech model.
- Native hooks on the main thread.
startandon_messagerun on the main thread inside the loop. That is where Hex creates theNSStatusItemand its delegate, or thetray-icon.WindowRef::raw_window_handle()gives Windows HWND style tweaks, as the HUD uses today.- macOS gets the activation policy and
default_menu = false. Reopen stays Hex's own delegate method, which winit permits.
- Later window kinds. All three are shell work, needed only when the
HUDs move to Rune:
Overlay: transparent, click-through, no activation, topmost. For Windows this isWS_EX_NOACTIVATE | WS_EX_TRANSPARENT | WS_EX_TOOLWINDOW; for macOS a non-activatingNSPanelon all spaces.Panel: macOS meeting capsules.LayerShell(Edge): Wayland HUD. winit has no layer-shell, so this needs a smithay-client-toolkit surface in Rune's Linux shell. Until then the GTK HUD thread stays as it is.
Item 8 belongs to the HUD port, not to single process.
Linux
Single instance and forwarding: keep the socket (re-checked)
The instance exists to make the data root exclusive. The data root holds
settings.json, History, the listener lock, and the models, plus the
HEX_APPLICATION_SUPPORT_DIR roots that tests, Nix, and development use. A
lock plus a socket in that root keys both exclusivity and forwarding to
exactly it. Chromium's ProcessSingleton (and so Slack, Discord, and other
Electron apps) and Zed's Linux CLI listener do the same per data dir. The
existing socket already has owner-only permissions, peer-UID checks,
bounded frames, deadlines, stale-socket recovery, and
scripts/test-linux-service.py. Its protocol shrinks to four requests, with
VERSION = 2:
enum Request {
Activate { activation_token: Option<String>, startup_id: Option<String>, session: Session, show: bool },
Shortcut(ShortcutCommand), // straight to the listener's sender
Status, // Published snapshot as JSON for `hex status`
Quit, // `hex stop` without systemd, or a custom data root
}
Rune does not change this choice. winit takes the activation token as a
plain string (ActivationToken::from_raw), so the token rides in
Activate with no D-Bus involvement.
Rejected: a D-Bus well-known name (GApplication's
org.freedesktop.Application.Activate(platform-data{activation-token}),
KDBusService, Tauri's Linux single-instance plugin).
- A bus name is per bus, not per data root, so isolated instances collide with the installed app.
DBusActivatable=truerequires renaminghex.desktopto the bus name. That changes the app id that the GlobalShortcuts portal (linux_portal::APP_ID,Register("hex")) and Rune'sset_app_id("hex")use, and portals would re-ask for shortcuts.- Hex speaks D-Bus through
gio, and a gio-exported object needs a glib loop that Rune's winit loop does not provide. org.freedesktop.Applicationcan be added later as a second adapter if Hex ever moves to a reverse-DNS app id.
Also rejected:
- An abstract-namespace socket: it is keyed by user, not by root, and any process in the network namespace can connect.
- A lock with signals: it can't carry a reply, a token, or an error.
Process and threads
main thread rune::run_app: window on demand (Destroy on close), AppProxy messages
runtime thread LinuxDesktopHost loop (today's run_service minus socket), publishes Arc<Published>, wakes windows
socket thread lock + service.sock; Activate -> AppProxy::send(Open{token}); Shortcut -> listener sender; Status/Quit
GTK thread HUD (unchanged; Rune LayerShell later)
listener linux_dictation worker + engine threads (unchanged)
Activate{show}with no window open callscx.open(window_spec(handle), OpenOptions { activation_token, .. }).- With a window open, it calls
window.focus(token). Activatefrom a different desktop session keeps today's rule: restart through systemd, then Activate.- Closing the window drops its
Ui.on_closedsendsCancelShortcutif that window started a capture, and drops the subscription. - The editor lease,
Event::Disconnected, and reconnect logic go away. There is one in-process window, and closing it is the only way to "disconnect".
Launch and systemd
The launch logic for hex, hex app, hex start, and hex --background:
connect(socket) ok -> Activate{token from XDG_ACTIVATION_TOKEN / DESKTOP_STARTUP_ID, session, show} -> exit
no instance, managed unit -> write session.env; systemctl --user start hex.service (Type=notify) -> Activate{token, show}
no instance, otherwise -> become the instance here (custom data root, cargo run, non-systemd)
Decided (Dax, 2026-10-22): systemd stays the supervisor that starts
Hex at login on managed installs, with the Type=notify unit below. This
is implemented; the autostart entry still runs hex start, which equals
hex --background.
Under a managed install the long-lived process is always the systemd one,
which brings journald, Restart=on-failure, and
PartOf=graphical-session.target logout teardown. The launcher-started
hex only forwards. It reads the token from its own environment and must
not consume it itself. Both paths take instance::acquire("service") before
binding the socket, so a unit that loses a race exits 0 and does not trigger
a restart.
Unit and launcher changes (the installer, nix/hm-module.nix, and
nix/checks.nix):
Type=notify,NotifyAccess=main, withREADY=1written to$NOTIFY_SOCKETafter the socket binds. This replaces the 5 s polling inensure_started.- Keep
ExecStart=… service. The updater swaps the binary, never the unit, soservice(background, no window) is permanent.appandstartstay as aliases. - Add the window's environment to
SESSION_KEYS, because the Rune window now renders in the systemd process:XCURSOR_THEME,XCURSOR_SIZE,XMODIFIERS,GTK_IM_MODULE,QT_IM_MODULE,XDG_DATA_DIRS,LANG,LC_*. Keep clearing absent values. - A crash restart opens no window. Only
Activate{show}opens one. hex.desktop:Exec=hex,StartupNotify=true, andActions=quitwithExec=hex stop. The autostart entry:Exec=hex --background.
Code that moves or disappears (on rune-ui)
linux_service.rs→linux_instance.rs.- Keep the lock, socket, peer check, frames,
systemctl, session environment, andSession. - Delete
Client(new,with_waker, polling, reconnect) andEvent::Disconnected. Delete the requestsSnapshot,Desktop,CaptureShortcut*,CancelShortcut,SetShortcut,ChooseModel,CancelModel, andReloadSettings, which move to the in-processHostRequest.
- Keep the lock, socket, peer check, frames,
linux_app.rs.run_servicebecomesruntime::spawn(…) -> HostHandle: the same loop, fed by a channel.- New
linux_app::run(show, token): bind the instance, spawn the runtime, start the socket thread, thenrune::run_appwith the LinuxCloseBehavior::Destroy. - Delete
open_settings(the GPUI Settings process) anddisconnect_editor.
rune_ui.rs.Service::Liveholds theHostHandle.setupsubscribes its waker.ReloadSettingsafter a save stays as aHostRequest, an in-process message instead of a socket round trip. Update its doc comment ("a client ofhex.service").linux.rs. RouteNone,App,Start, and--backgroundto the launch logic.--ui gpuigoes away on Linux.Servicebecomes the instance without a window.StatusbecomesRequest::Status.Stopbecomessystemctl stop, orQuit.linux_updater::schedule_restart. Unchanged for managed installs.- Add "Quit Hex" to the Rune window. Linux has no tray, so the only
other exits are the desktop action and
hex stop.
Tests and docs
test-linux-service.py: cover a second launch forwardingActivateand exiting 0, shortcut commands failing fast without an instance, stale-socket recovery, racing starts producing one instance,Quitdraining, and v1 frames being rejected.- Wayland paste and X11 dictation scripts: open the window through a second
hex, close it, check the same PID keeps listening, then reopen it. - Rune goldens: unchanged (
Fixture). AGENTS.md:- Replace the
linux_serviceandlinux_appmodule entries. - Replace the invariant "Linux Settings owns no microphone… Client
disconnect… Never replay…" with these:
- One process per user and data root.
- The window is optional, recreated on demand, and its close never stops capture, accepted work, or the HUD.
- A relaunch forwards
Activatewith its token and exits; hidden launches never show the window. - The socket stays owner-only, peer-checked, and bounded.
- Closing the window cancels only an uncommitted shortcut capture.
- Under a managed install, systemd owns lifetime and restart.
- Replace the
- Also update
docs/linux.md("Background Service And Settings"),docs/nix.md,docs/features/README.md(maintain.linux-service,linux.commands), andrune-ui.md.
Windows under Rune
Keep the named event. It already gives single instance, the
AllowSetForegroundWindow handoff, and hidden-launch no-op.
- Main thread.
rune::run_app, withCloseBehavior::Hide(Windows can hide, and reopen is instant).startcreates thetray-iconon the main thread. winit's Win32 message loop pumps that thread's messages, whichtray-iconneeds.- Tray and menu events go through
TrayIconEvent::set_event_handlerandMenuEvent::set_event_handler→AppProxy::send. - The
hex-relaunchthread'sWaitForSingleObjectloop sendsOpenthrough the proxy, then callsfocus(None), which works because the relaunching process grantedAllowSetForegroundWindow.
- Runtime. Move
WindowsDesktopHostfromRc<RefCell>on the GPUI thread to the same runtime-thread andHostHandleshape as Linux. The low-level keyboard hook already runs on its own thread. - HUD. Rune
WindowKind::Overlay, or a normal Rune window with the current HWND style tweaks throughraw_window_handle(), until Overlay exists. - CLI forwarding. Not needed now. If wanted, use a per-user named pipe
(
\\.\pipe\com.kitlangton.hex.<SID>, owner-only DACL) with the same four-request protocol.
Written on rune::App (cross-compiled only)
Rune's app lifetime landed (a9cde14/a242f5a, now 7eea3a3) as
rune::App + AppHandle rather than the run_app/AppCx sketch above.
hex app uses it in
windows_rune.rs and
rune_ui/windows_host.rs:
- The runtime thread owns
WindowsDesktopHostandTranscriptionPreparation, takes the shared panes' requests over a channel, and publishes anArc<Published>(listener, preparation, updates, settings), waking the window.rune_uireaches it through the per-OShostmodule (Backend::{connect, send, state, error}), the same seam the Linux client sits behind. When Linux'sHostHandlelands, both should share it. rune::App::new(spec).on_close(..)withkeep_running(), orwindowless()for--hidden. The tray is created on the main thread beforerun(winit's loop pumps its messages); its Show and the relaunch thread callAppHandle::open, Quit callsAppHandle::quit, and so does the runtime thread on Ctrl-C or a restart into an update.openthen joins the runtime, which stops the listener. Without a tray the app keeps Rune's default, close quits.on_closeflushes text drafts and stops a shortcut recording.- Rune exposes no window handle yet, so the window icon is set by finding the window by title on the main thread before a frame.
- Shortcut capture stays in the window (keyboard polling with the hook suppressed), not on the runtime.
- The HUD is a Rune overlay (
windows_rune_hud.rs) on the same loop.
macOS under Rune
LaunchServices keeps single instance, and the status item stays native.
Written on rune::App (branch rune-ui-macos, compiled and launched on hailmary)
macos_rune.rs and
rune_ui/macos_host.rs; hex app runs
it:
- Main thread.
rune_ui::app().accessory(), windowless (or open at launch when setup or onboarding is unfinished, or Show Dock icon) and kept running.App::accessory(Rune50d8d91) builds winit's loop with the Accessory policy, no default menu, and no activation at launch.- winit 0.30 installs its own
NSApplicationDelegateand panics if it is replaced, so Hex answers Dock and Finder reopen with anNSAppleEventManagerhandler forkAEReopenApplicationinstead. - The first
AppHandle::updateclosure runs on the main thread once the loop is live and installs Sparkle, theNSStatusItem, Hex's own Hex/File/Window menu (⌘, ⌘H ⌘Q ⌘W ⌘M; no Edit menu, so ⌘C/⌘V reach Rune's fields), the reopen handler, and the Metal HUD (dictation_indicator's NSPanel, unchanged). A 16 msNSTimerin the common run-loop modes then drains the HUD, status-item, meeting, and developer-control channels with no window open. - Opening the window shows the Dock icon and activates Hex; Rune's
close hides it and
on_closerestores the saved Dock policy.
- winit 0.30 installs its own
- Runtime thread. Owns
TranscriptionPreparation(the menu bar's model list asks for installed models only), commits prepared models tosettings.json, starts the listener once setup is ready, and publishes listener, model, Sparkle, and settings state for the window and the menu bar (RuntimeHandle, the Windows shape). The listener, the meeting controller (meeting_watcher::controller_loop), and the local API keep their own threads. Quit ends Rune's loop, then everything is joined. - Window host. The shared panes reach the runtime through
macos_host::Backend; Sparkle's actions run on the main thread there. Shortcut capture is an AppKit local event monitor (modifier-only chords such as Option or Fn never reach Rune as keys) with the listener's tap suspended.macos_host::MacHostis the panes'NativeHost: permissions and guides, System Audio, the login item worker, Hex Microphone, meeting start/stop/summarize/rename/trash/reveal, the command catalog and workspace, the command model, Apple Intelligence availability, and relaunch. It also lists meetings for the Meetings pane through the read-onlymeeting::query(rescanned once a second, sent only when changed), feeds the tour's practice step from the listener's event log, and chooses the meetings folder withNSOpenPanel. The main loop's timer wakes an open window every 250 ms so these polls run. - Title bar. Rune's macOS window has a transparent, full-size title
bar; the sidebar starts below the traffic lights, and it and the pane
header move the window (Rune
El::window_drag,ea6b513). - Meeting capsules. Offer, recording, call ended, and ready are Rune
interactive overlays (non-activating panels,
rune_ui/meeting_capsules.rs) fed from the controller events on the main loop. Copy new/all, hover expansion, and dragging are not built. - HUD. It stays a native
NSPanelwith its own Metal layer and no GPUI dependency; moving it to Rune would need a borderless, transparent, click-through, all-spaces overlay. - Verification. Built with Command Line Tools only (no Xcode): a local
shim stubs the HUD metallib and Apple Intelligence's
@Generabletypes. Release builds need Xcode 26 as before. Seedev.rune-ui-macosin the feature map for what was observed. - CLI. It already has a channel in
local_api. A macOShex dictation …overPOST /dictationsis optional.
Risks
- Crash isolation is lost. A Rune, wgpu, or driver crash in the window
now takes down dictation and accepted work.
- Mitigations:
Restart=on-failurewith no window on restart; window-creation failures (no usable GPU adapter, surface errors) returnErrand must not panic. Todaycreate_window,create_surface, andget_default_configareexpect, and that has to change. - Add an open/close soak (50 cycles on niri and i3) with the listener running.
- This cost is the reason to keep systemd supervision.
- Mitigations:
- Rune churn. Kit's agents push to Rune's
maindaily. Agree therun_app,AppProxy, andWindowSpecsurface with Kit before Hex builds on it, and pin the commit as today. - Session environment. A window in the systemd process misses anything
not imported (cursor theme, IME, locale, icons). Extend
SESSION_KEYSand check on real desktops. - Upgrade. A v1 Settings client still open after a self-update restart gets a version-mismatch error and must exit rather than loop.
Implementation order
| # | Step | Where |
|---|---|---|
| 1 | Rune core: run_app (argv-free, keep-alive), AppProxy, window table, WindowSpec with closures, CloseBehavior and on_closed, activation token on open and focus (Wayland and X11), shared GPU, fallible window creation, macOS activation policy and no default menu, raw_window_handle(). Keep run(spec) as a wrapper. |
Rune, with Kit |
| 2 | Linux single process: HostHandle and runtime thread, linux_instance v2, launch logic, rune_ui on the handle, Quit Hex, Type=notify, session keys, installer and Home Manager and Nix, tests, docs, AGENTS.md. Remove the GPUI Settings process on Linux. |
rune-ui |
| 3 | Physical validation on niri (portal) and i3: relaunch focus with a token, close and reopen, logout, crash restart, update restart. | person |
| 4 | Windows: runtime and HostHandle, Rune window with Hide, tray on run_app, named event to the proxy, HUD as an overlay or HWND-tweaked Rune window. Plus the Windows pane parity work in rune-ui.md. |
rune-ui |
| 5 | macOS: runtime out of meeting_watcher, reopen, status item beside rune::App, Rune window. Written (see macOS under Rune); the capsules, the Rune HUD, and the Meetings pane's data remain. The HUD and capsules wait for the Rune Overlay and Panel kinds. Plus the macOS pane parity work in rune-ui.md. |
rune-ui + Rune |
| 6 | Delete GPUI: app_window*, desktop_ui, design_tokens, text_input, desktop_transcription_picker, motion, windows_indicator, windows_ui, the GTK HUD, the fork patch, the token lint. Done; the macOS dictation_indicator stays (pure Metal/AppKit). |
rune-ui |
Windows and macOS follow the port order in
rune-ui.md.