Skip to content

Epic: Custom desktop title bar (native controls retained) - investigation complete, plan ready for review #457

Closed

Description

@khaira777

Goal

Extend FloCafe's Electron UI into the OS title-bar area (Discord/Claude-Desktop style polish) while retaining native window controls and never degrading the browser/LAN experience. Planning phase complete: two research passes done (codebase evidence audit + Electron API/platform research). Implementation not started - this issue is the reviewed plan.

Verified current state (codebase audit, file:line evidence in scout report)

  • Electron 43.4.0 (package.json:201) - every API we need is supported: titleBarStyle hidden/hiddenInset, titleBarOverlay, trafficLightPosition, runtime setTitleBarOverlay(), renderer Window-Controls-Overlay geometry APIs. No version bump needed for capability.
  • Main window: main/index.ts:259-270 - no title-bar options today; OS draws the frame.
  • Close-to-tray on all platforms (main/index.ts:316-320), renderer crash recovery recreates the window (:326-341), Linux tray recall is the only window-recall path - all must keep working unchanged.
  • Exactly three window classes: main POS window, KDS window (security-hardened, no preload, GHSA-hardened with enforced tests), print popups (renderer window.open). Only the main window gets custom chrome initially; KDS/print/dialog stay stock.
  • Preload (main/preload.ts): rich existing IPC incl. platform; no window-control bridge (unnecessary if overlay is used). frontend/src/types/electron.d.ts already lags the preload by ~7 members and must be synced in the same change.
  • Browser/LAN detection is exclusively window.electronAPI?. presence checks (no UA sniffing anywhere) - title-bar gating must follow the same pattern so LAN/browser clients render exactly today's layout.
  • Reusable bar content already exists: server-status pill (StatusBar.tsx), update badge (UpdateBadge.tsx), printer status (PrinterStatus.tsx), tenant/staff (auth store). No clock or cloud-sync indicator exists yet.
  • Surprises found: dark mode is configured but inert (nothing applies .dark - bar ships light-only unless theming lands); Persian (fa) RTL is fully live so the bar needs logical CSS properties; KDS hardening is test-enforced; min window 1024x768 gives generous layout room; macOS traffic lights never mirror in RTL (anchor content to physical edges, use logical properties for content).

Verified platform facts (Electron API research, current docs + release notes)

Capability Windows macOS Linux
hidden + titleBarOverlay E14+ E14+ (colors N/A; height honored) E30/33+ only
Snap Layouts hover on overlay maximize works (native buttons) N/A N/A
env(titlebar-area-*) + getTitlebarAreaRect() E14+ E14+ E30/33+

Key pitfalls (full list in research report): drag regions swallow pointer events (interactive children need app-region: no-drag); Windows DPI overlay-height bugs (#52208 open) - set explicit integer heights and test 125-175%; dark-mode overlay color bugs (#45958) - set color/symbolColor from theme explicitly, never defaults; Linux below E33 has no working overlay (HTML-control fallback required); E43+ Linux respects DE button layout/RTL (GNOME shows close-only by default); frame: false is rejected - it forfeits Snap Layouts, native accessibility, and DPI correctness (VS Code converged on native WCO for exactly these reasons; Discord/Slack-style hand-drawn controls are the anti-pattern).

Recommended architecture (smallest safe change)

titleBarStyle: darwin ? 'hiddenInset' : 'hidden'
titleBarOverlay: { color/symbolColor from theme, height: 40 }
  • Single <TitleBar> client component mounted in (dashboard)/layout.tsx, gated on window.electronAPI?. presence; browser/LAN clients render today's layout unchanged (Playwright-asserted).
  • Bar content = persistent app context (store, staff, connection pill, printer pill, update badge) reused from existing components; interactive segments no-drag; drag region styled with logical CSS properties; double-click-maximize via IPC honoring AppleActionOnDoubleClick on macOS (DOM dblclick in drag regions is unreliable).
  • Overlay colors driven from the theme via nativeTheme listener + setTitleBarOverlay(); opaque v1 (vibrancy deferred behind prefersReducedTransparency).
  • Linux fallback when overlay unavailable: HTML-drawn controls over a narrow window-action IPC; never hidden-with-no-controls.
  • Security boundary unchanged: contextIsolation stays on; no new broad IPC - only narrow capability/window-action methods if the fallback is used.

Sub-issues

  • Phase 1: window options + platform branches in createWindow() (main/index.ts)
  • Phase 1: <TitleBar> component - safe areas, drag/no-drag, reused status pills, RTL logical properties
  • Phase 1: preload capability bridge + sync the lagging electron.d.ts
  • Phase 2: Linux fallback controls + Electron version gating
  • Phase 2: regression tests - static-analysis window-options test, Playwright browser-mode assertion, manual platform matrix (Win 11 at 100-175% scaling, macOS fullscreen + kiosk, Linux GNOME/KDE X11+Wayland packaged AppImage, LTR+RTL, browser-over-LAN)

Full scout reports (codebase audit with file:line citations; Electron API/platform research with sources) are archived in the firstmate home: data/nm-titlebar-codebase-scout/report.md, data/nm-titlebar-electron-scout/report.md.

Activity

  1. added
    epic
    on Aug 22, 2026
  2. khaira777 commented on Aug 23, 2026

    @khaira777
    ContributorAuthor

    Phase 1 implementation is in #486. The PR is open with 4 checks passed and Greptile review pending; GitHub currently reports a merge conflict, which the implementation worker is reconciling before merge. This issue remains open until the PR lands.

  3. khaira777 commented on Aug 23, 2026

    @khaira777
    ContributorAuthor

    Follow-up: #486 has all 13 checks passing, but its Greptile P1 task-local-port finding remains unresolved and the validation branch has a protected pipeline-custody divergence. It is not ready to merge; no local history was discarded.

  4. khaira777 commented on Aug 23, 2026

    @khaira777
    ContributorAuthor

    Phase 2 validation status: the NoMachine host is verified as GNOME 48.7 on X11 at 1920x1080/96 DPI, and a remote Electron 43.4.0 WCO smoke rendered the native close-only caption plus a 968x40 safe area. This is only a conditional GNOME X11 environment smoke: the exact FloCafe Phase 1 AppImage, real pointer drag, edge resize, close-to-tray, RTL, Wayland, KDE, and non-100% DPI rows remain untested. macOS and Windows native acceptance rows are also not run. Full evidence: data/flocafe-457-remote-gnome-smoke/report.md; Phase 2 matrix: data/flocafe-457-phase2-linux-scout/report.md. The epic remains open pending PR #486 review/custody resolution and packaged cross-platform validation.

  5. khaira777 commented on Aug 23, 2026

    @khaira777
    ContributorAuthor

    Phase 1 is now merged via #486. The final head passed all 13 checks, and the Greptile task-local URL/port finding was resolved. Phase 2 remains intentionally deferred per the PR scope; this epic stays open for that follow-up.

  6. khaira777 commented on Aug 23, 2026

    @khaira777
    ContributorAuthor

    Verification correction: PR #486 landed the native window options, capability-gated TitleBar/drag surfaces, focused tests, and documentation, but it did not complete every Phase 1 checklist item. frontend/src/types/electron.d.ts still omits seven APIs exposed by main/preload.ts (getSettings, setSetting, getKdsInfo, openKdsWindow, getPrinters, savePrinter, and getDailySummary). The new title bar currently shows store/staff context plus the update badge; the planned server/printer status pills are not yet included. Phase 2 remains deferred, but this Phase 1 follow-up is still outstanding.

  7. khaira777 commented on Aug 23, 2026

    @khaira777
    ContributorAuthor

    Phase 1 completion follow-up is now underway: the remaining preload/type contract sync and evidence-backed title-bar status-content reconciliation will be implemented and validated through a separate no-mistakes PR. Phase 2 remains deferred.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    epic

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions