# Desktop app (Tauri)

> The native macOS, Windows and Linux shell, its permissions and how to build and sign it.

Source: https://ctrlaltnotes.com/docs/technical/desktop-app · Last updated: 2026-11-29 · License: AGPL-3.0

`app/` is a thin shell. It serves `ui/` from the app bundle, holds one `Service`, and exposes one command.

```rust
#[tauri::command]
async fn rpc(app, svc, cmd: String, args: Value) -> Result<Value, String>
```

* Native dialogs (`join_vault`, `set_sync`, `export_markdown`) are opened **in Rust**; the chosen path goes straight to the service and is never visible to the page.
* The vault lives under the OS app-data directory, derived from the identifier `app.ctrlaltnotes.desktop` (macOS `~/Library/Application Support/`, Windows `%APPDATA%\\`, Linux `~/.local/share/`).
* The window locks on close and on exit.
* Files in the app-data directory: `vault/` (default vault), `settings.json` (its preferences and sync target), `app.json` (theme and the vault folder chosen on the lock screen), `vaults/<sha256(path)[:16]>.json` (preferences and sync target of each chosen vault). None of these is secret, and none is authenticated: everything read from them is re-validated (a stored vault folder must still be empty or hold `vault.json`, a stored sync target must be outside the vault), otherwise it is ignored.
* `open_vault_folder` is refused while a vault is unlocked, both in the shell (before the dialog opens) and in the service.
* The async command keeps blocking dialogs off the UI thread.

## Configuration highlights (`tauri.conf.json`)

| Key | Value |
|---|---|
| `productName` | `CtrlAltNotes` |
| `identifier` | `app.ctrlaltnotes.desktop` |
| `app.security.csp` | `default-src 'none'; script-src 'self'; style-src 'self'; img-src 'self' data: blob:; connect-src ipc: http://ipc.localhost; base-uri 'none'; form-action 'none'; frame-ancestors 'none'` |
| `bundle.icon` | generated by `brand/make_brand.py` |

## Capabilities

`capabilities/default.json` grants `core:default` and a **scoped** `opener:allow-open-url` (http, https, mailto only). No file-system or shell permissions.

## Building

See [Building](11-building.md). Output:

* macOS: `target/release/bundle/macos/CtrlAltNotes.app` and `dmg/…`
* Windows: `bundle/nsis/…-setup.exe` and `bundle/msi/…`
* Linux: `bundle/deb/…_amd64.deb`, `bundle/rpm/…x86_64.rpm` and `bundle/appimage/…_amd64.AppImage`

## Signing

Unsigned builds trigger Gatekeeper (macOS) and SmartScreen (Windows). Signing and notarisation need an Apple Developer account and a code-signing certificate; follow the Tauri distribution guides.

## Status

The macOS app is built and used on macOS 14+. The Windows and Linux bundles are configured but have not yet been built on those systems; the CI workflow builds the desktop crate on all three.
