cccc icon indicating copy to clipboard operation
cccc copied to clipboard

feat(desktop): add Tauri v2 native desktop wrapper

Open OpenWorkai opened this issue 8 months ago • 1 comments

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

  • [x] 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.

OpenWorkai avatar Mar 29 '26 20:03 OpenWorkai

This is a PWA application that naturally supports the desktop.

waterbang avatar Mar 30 '26 11:03 waterbang