Skip to content

feat(desktop): a native macOS window: traffic lights, rounded corners, native full screen - #26

Merged
Kkkermit merged 2 commits into
mainfrom
feature/macos-window-chrome
Dec 3, 2026
Merged

Kkkermit merged 2 commits into
mainfrom
feature/macos-window-chrome

Conversation

@Kkkermit

@Kkkermit Kkkermit commented Dec 3, 2026

Copy link
Copy Markdown
Owner

What and why

On macOS, Statsify now uses the system's own window frame, like a native Mac app. Windows and Linux are unchanged.

  • Traffic lights: close, minimise and full screen at the top left, drawn by macOS over the app's title bar.
  • The window itself: the system's rounded corners and window shadow.
  • Native full screen: the green button, ⌃⌘F, or the app's own full-screen button, in its own Space. The title bar disappears in full screen, and the lights slide in when the pointer reaches the top.
  • Title bar: on a Mac it's a drag strip with "Statsify" in the middle and room for the lights. Double-click zooms. It keeps its size in window points at any interface size, so the lights stay centred at 75 % or 150 %.
  • Closing:
    • The red button and ⌘W follow Keep running in the menu bar (the "tray" setting on a Mac): on, the window hides (leaving full screen first, in one go); off, the window closes and the app quits.
    • A click on the Dock icon brings a hidden window back.
  • Existing installs: the window-state plugin no longer restores decorations. Without this, every existing Mac install would restore its saved frameless window and lose the new frame. Nothing changes on Windows or Linux, where decorations never change.
  • Mac conventions:
    • The frame follows the app's light or dark theme.
    • Shortcuts read ⌘K, ⌘+ / ⌘−, ⌘0, ⇧⌘L and ⌃⌘F, since F11 is Show Desktop on a Mac.
    • Esc no longer leaves native full screen, but still closes the full-screen player and dialogs.
    • The standard Mac menu (⌘Q, ⌘W, ⌘M, ⌘H, Edit, Window) already comes from Tauri.
  • Fixes found along the way:
    • Full screen is now followed on the welcome and set-up pages too, not only inside the app.
    • A right-click just after closing a dialog drew its menu inside the closed dialog, where it couldn't be seen. Only dialogs that are still open count now.

How it's done:

  • src-tauri/tauri.macos.conf.json is merged only into macOS builds: decorations, titleBarStyle: Overlay, a hidden title, the traffic-light position and first-click drag. Tauri merges it as a JSON merge patch, which replaces the window list whole, so the file repeats the window entry. scripts/tauri-config.test.ts keeps the two in step.
  • capabilities/macos.json (macOS only) allows destroy for the close path.
  • app/lib/env.ts has desktopOs() and IS_MAC; TAURI_ENV_PLATFORM is darwin on macOS.
  • RunEvent::Reopen handles the Dock click, and lib.rs sets the window-state flags.

Trade-off: acceptFirstMouse is on, so an inactive window can be dragged by its title bar in one go. The side effect is that the first click on an inactive window also acts on the page, as it does on Windows. This is documented in AGENTS.md.

Version: 1.2.2, as asked. By docs/RELEASING.md, a new feature or improvement is a minor version (1.3.0); change it with npm run version:set -- 1.3.0 before merging if you'd rather follow that.

Merging releases it. The Desktop app run on this pull request builds the macOS .dmg (the statsify-macOS artifact). Please try it on a Mac first. Only a real Mac can show:

  • whether the corners stay rounded and the shadow looks right with a see-through window;
  • whether the traffic lights sit centred in the title bar (trafficLightPosition y: 18);
  • the red button, ⌘W, the Dock reopen and the full-screen exit timing;
  • the frame's light or dark look against the app's theme.

Follow-ups (not in this pull request):

  • honour the macOS "double-click a title bar to…" setting;
  • a monochrome template image for the menu-bar icon;
  • a short see-through flash during the green-button animation;
  • existing installs grow once by the title-bar height.

How it was tested

  • npm run check: typecheck, lint, 595 unit tests (new: env, TitleBar, useMacWindowClose, apply zoom, the theme on each system, openDialogs, tauri-config) and the build.
  • In src-tauri/: cargo fmt --check, cargo clippy --all-targets -- -D warnings and cargo test, including a test of the window-state flags.
  • The macOS-only Rust (RunEvent::Reopen) can't compile on Linux. It was read against the tauri 2.13 source by a separate reviewer, and the macOS desktop build on this pull request compiles it.
  • Playwright:
    • New e2e/macos.spec.ts runs against a fake Mac desktop (fakeDesktop(page, { os: "macos" })). It covers the bar, the lights area, the zoom, full screen on every page, closing (including a repeated press), Mac shortcut labels, Esc, Settings text and axe. It passed 35 of 35 runs with --repeat-each 5.
    • shell, window-material, window-states, fullscreen, a11y and devlog pass at every size (Windows layout unchanged).

Checklist

  • The branch is named feature/<name> and the commits follow the commit style.
  • npm run check passes (typecheck, lint, unit tests, build).
  • npm run e2e passes, or the change can't affect the UI. The affected specs pass, and CI runs the full suite.
  • Rust changed: cargo fmt --check, cargo clippy --all-targets -- -D warnings and cargo test pass in src-tauri/.
  • New behaviour has tests (Vitest for logic, Playwright with an axe check for UI, Rust tests for commands).
  • UI changes work at desktop, tablet and phone sizes, by keyboard, with reduced motion and in every theme.
  • Docs are updated (README, docs/, AGENTS.md) where behaviour, commands or architecture changed.
  • No secrets, tokens, personal data or real listening history in code, tests, screenshots or logs.

Generated by Claude Code

Kkkermit and others added 2 commits December 3, 2026 16:55
…, native full screen

On macOS the window now keeps the system's own frame, as Mac apps do:
the traffic lights at the top left, rounded corners and the window
shadow, and native full screen (the green button, ⌃⌘F, its own Space).
Windows and Linux are unchanged.

- src-tauri/tauri.macos.conf.json: decorations with an Overlay title bar,
  the lights placed in the app's 36 pt bar, first-click drag. Tauri merges
  it as a JSON merge patch, which replaces the window list whole, so it
  repeats the window entry (a test keeps the two in step).
- The Mac title bar is a drag strip with the title in the middle and room
  for the lights; it keeps its size in window points at any interface
  size. Double-click zooms.
- The red button and ⌘W follow "Keep running in the menu bar": hide (out
  of full screen first, in one go) or close. A click on the Dock icon
  brings a hidden window back.
- The window-state plugin no longer restores decorations, so installs that
  saved the old frameless window get the frame.
- The frame follows the app's light or dark theme. On a Mac, shortcuts read
  ⌘K, ⌘+ / ⌘−, ⌘0, ⇧⌘L and ⌃⌘F (F11 is Show Desktop there), and Esc no
  longer leaves full screen.
- Full screen is followed on the welcome and set-up pages too.
- A right-click just after closing a dialog drew its menu inside the
  closed dialog, out of sight: only dialogs still open count now.

Tests: desktopOs and IS_MAC, the Mac title bar, closing, the zoom
variable, the theme, the config files, the dialog fix, and
e2e/macos.spec.ts against a fake Mac desktop. What only a real Mac can
show (the corners with a see-through window, where the lights sit, the
shadow) is listed in the pull request.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TCk6t7edJdscNtTSeFmyQN
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TCk6t7edJdscNtTSeFmyQN
@github-actions github-actions Bot added desktop The desktop app (src-tauri) enhancement New feature or improvement labels Dec 3, 2026
@Kkkermit
Kkkermit merged commit 78cc34e into main Dec 3, 2026
19 checks passed
@Kkkermit
Kkkermit deleted the feature/macos-window-chrome branch December 3, 2026 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

desktop The desktop app (src-tauri) enhancement New feature or improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant