Skip to content

feat(desktop): add Tauri v2 native desktop wrapper#65

Open
Myking1983 wants to merge 2 commits intoChesterRa:mainfrom
Myking1983:feat/tauri-desktop-wrapper
Open

feat(desktop): add Tauri v2 native desktop wrapper#65
Myking1983 wants to merge 2 commits intoChesterRa:mainfrom
Myking1983:feat/tauri-desktop-wrapper

Conversation

@Myking1983
Copy link
Copy Markdown

Summary

  • Adds a desktop/ directory containing a minimal Tauri v2 shell that wraps the existing CCCC Web UI (http://localhost:8848/ui/) into a native desktop application
  • No frontend bundle included — the wrapper is ~120 lines of Rust + config only; the webview simply renders what the CCCC daemon serves
  • Docs in both English and Chinese (desktop/README.md / desktop/README.zh-CN.md), plus a short mention in the root README under Web UI → Desktop app

What it adds

Feature Detail
Native .app / .exe No browser required — launch CCCC like any desktop app
Transparent title bar (macOS) titleBarStyle: Overlay — seamless, chrome-free look
Native window drag NSWindow.setMovableByWindowBackground — works with remote-origin webviews where data-tauri-drag-region and JS startDragging() are blocked by the renderer sandbox
CSS body shim Injected on every page load via on_page_load; pushes content 28 px below traffic-light buttons
Packaged DMG tauri build produces a signed-ready .app and .dmg

Why setMovableByWindowBackground instead of data-tauri-drag-region

Tauri's attribute-based drag only works for locally-bundled content. Because the webview points at http://localhost:8848, both the attribute and the JS startDragging() IPC call are blocked by the renderer's CSP / sandbox. The native macOS API bypasses this entirely — any unobstructed background pixel becomes a drag handle regardless of content origin.

Test plan

  • macOS 15 (Sequoia), Tauri 2.10.3, Rust 1.77 — transparent title bar, native drag, traffic-light buttons all working
  • Windows — not yet verified (should work; objc dep is cfg(target_os = "macos") gated)
  • Linux — not yet verified

Quick start

# Make sure the CCCC daemon is running first
cccc

# Build the desktop app
cd desktop
npm install
npm run build
# → src-tauri/target/release/bundle/macos/cccc.app

First contribution — happy to adjust anything based on project conventions.

Myking1983 and others added 2 commits March 29, 2026 13:02
Adds a minimal `desktop/` directory that wraps the existing CCCC Web UI
(`http://localhost:8848/ui/`) in a Tauri v2 shell, producing native
`.app` / `.exe` bundles without shipping any frontend code of its own.

Key features
- Transparent, chrome-free title bar on macOS (`titleBarStyle: Overlay`)
- Native window drag via `NSWindow.setMovableByWindowBackground` — works
  even though the webview loads a remote origin, where `data-tauri-drag-region`
  and JS `startDragging()` are blocked by the renderer sandbox
- CSS shim injected on every page load to push body content below the
  traffic-light buttons (28 px padding-top)
- Zero frontend bundle: the wrapper is ~120 lines of Rust + config only
- macOS-only Rust dependency (`objc = "0.2"`) behind a cfg gate so Windows
  and Linux builds are unaffected

Docs
- `desktop/README.md` (English)
- `desktop/README.zh-CN.md` (Chinese)
- Mention in main README.md and README.zh-CN.md under "Web UI > Desktop app"

Tested on: macOS 15 (Sequoia), Tauri 2.10.3, Rust 1.77+

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace setMovableByWindowBackground (whole-window native drag) with a
targeted approach: inject a fixed 28px overlay div and call startDragging()
via Tauri IPC on mousedown. Add remote-localhost capability to authorize
the IPC call from localhost:8848. Also add core:window:allow-start-dragging
to default capability set.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@waterbang
Copy link
Copy Markdown
Collaborator

This is a PWA application that naturally supports the desktop.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants