Feature: App Settings, Instrument Autodetection & Cross-Platform Packaging #10

Closed
opened 2026-08-21 10:29:35 +01:00 by gronod · 0 comments
Owner

Description

Add application settings management, USB instrument auto-detection, and configure Tauri's bundler for production builds targeting Windows, macOS, and Linux.

Toolchain Context

  • Backend: Rust (Tauri 2) — settings stored via JSON file in app data directory
  • Bundler: Tauri's built-in bundler configured in tauri.conf.json bundle section
  • Sidecar bundling: ArgyllCMS binaries bundled per-platform from argyll/<platform>/ directories

Implementation Plan

Settings System (Rust + Frontend)

  1. Persistent settings: Use tauri::api::path::app_data_dir() + a settings.json file:
    • argyll_binary_dir: Override path to ArgyllCMS binaries (default: bundled sidecar)
    • default_instrument: Preferred instrument preset
    • default_page_size: Preferred page size
    • default_quality: Preferred profile quality
    • project_directory: Default working directory for output files
  2. Tauri commands: load_settings(), save_settings(settings), reset_settings()
  3. Settings dialog: Accessible from sidebar menu. Form for all configurable values with save/reset buttons.

Instrument Auto-Detection

  1. New Tauri command commands::detect_instruments(app, state):
    • Spawn ArgyllCMS instlist (or chartread -u -c list if available) to query USB devices
    • Parse JSON or text output to extract connected instrument names and ports
    • Return as JSON array: [{ name: "i1Pro2", port: "usb:001:003" }]
  2. Frontend: Instrument dropdowns in Stages 2 and 3 auto-populate from detect_instruments(). Manual override always available.

Cross-Platform Packaging

  1. tauri.conf.json bundle configuration:
    • Windows: .msi installer with argyll/windows-x86_64/ binaries
    • macOS: .dmg bundle with argyll/macos-aarch64/ binaries
    • Linux: .deb and .AppImage with argyll/linux-x86_64/ binaries
  2. Platform-aware binary resolution: Update commands::resolve_binary() to use std::env::consts::OS and std::env::consts::ARCH to select the correct sidecar directory at runtime:
    let platform = match (std::env::consts::OS, std::env::consts::ARCH) {
        ("linux", "x86_64") => "linux-x86_64",
        ("windows", "x86_64") => "windows-x86_64",
        ("macos", "aarch64") => "macos-aarch64",
        _ => return Err("Unsupported platform".into()),
    };
    
  3. CI/CD: Gitea Actions workflow (or manual) to build release binaries for all three platforms.
  4. Code signing: Placeholder configuration for Windows Authenticode and macOS notarization.

New/Modified Files

  • [MODIFY] src-tauri/src/commands.rs — add settings commands, detect_instruments, update resolve_binary
  • [NEW] src-tauri/src/settings.rs — settings persistence logic
  • [MODIFY] src-tauri/src/lib.rs — register new module and commands
  • [MODIFY] src-tauri/tauri.conf.json — bundle targets and signing config
  • [MODIFY] src/index.html — settings dialog panel
  • [NEW] src/js/settings.js — settings UI logic
  • [NEW] .gitea/workflows/release.yml — CI build workflow (future)

Acceptance Criteria

  • Settings persist across application restarts
  • Custom ArgyllCMS binary path override works
  • Instrument auto-detection populates dropdowns
  • resolve_binary() correctly selects platform-specific sidecar at runtime
  • tauri build produces installable packages for Linux (.deb, .AppImage)
  • Windows and macOS build targets configured (may require CI runners)
  • App icon and metadata correctly set in all installers

References

### Description Add application settings management, USB instrument auto-detection, and configure Tauri's bundler for production builds targeting Windows, macOS, and Linux. ### Toolchain Context - **Backend**: Rust (Tauri 2) — settings stored via JSON file in app data directory - **Bundler**: Tauri's built-in bundler configured in `tauri.conf.json` bundle section - **Sidecar bundling**: ArgyllCMS binaries bundled per-platform from `argyll/<platform>/` directories ### Implementation Plan #### Settings System (Rust + Frontend) 1. **Persistent settings**: Use `tauri::api::path::app_data_dir()` + a `settings.json` file: - `argyll_binary_dir`: Override path to ArgyllCMS binaries (default: bundled sidecar) - `default_instrument`: Preferred instrument preset - `default_page_size`: Preferred page size - `default_quality`: Preferred profile quality - `project_directory`: Default working directory for output files 2. **Tauri commands**: `load_settings()`, `save_settings(settings)`, `reset_settings()` 3. **Settings dialog**: Accessible from sidebar menu. Form for all configurable values with save/reset buttons. #### Instrument Auto-Detection 1. **New Tauri command** `commands::detect_instruments(app, state)`: - Spawn ArgyllCMS `instlist` (or `chartread -u -c list` if available) to query USB devices - Parse JSON or text output to extract connected instrument names and ports - Return as JSON array: `[{ name: "i1Pro2", port: "usb:001:003" }]` 2. **Frontend**: Instrument dropdowns in Stages 2 and 3 auto-populate from `detect_instruments()`. Manual override always available. #### Cross-Platform Packaging 1. **`tauri.conf.json` bundle configuration**: - Windows: `.msi` installer with `argyll/windows-x86_64/` binaries - macOS: `.dmg` bundle with `argyll/macos-aarch64/` binaries - Linux: `.deb` and `.AppImage` with `argyll/linux-x86_64/` binaries 2. **Platform-aware binary resolution**: Update `commands::resolve_binary()` to use `std::env::consts::OS` and `std::env::consts::ARCH` to select the correct sidecar directory at runtime: ```rust let platform = match (std::env::consts::OS, std::env::consts::ARCH) { ("linux", "x86_64") => "linux-x86_64", ("windows", "x86_64") => "windows-x86_64", ("macos", "aarch64") => "macos-aarch64", _ => return Err("Unsupported platform".into()), }; ``` 3. **CI/CD**: Gitea Actions workflow (or manual) to build release binaries for all three platforms. 4. **Code signing**: Placeholder configuration for Windows Authenticode and macOS notarization. #### New/Modified Files - `[MODIFY]` `src-tauri/src/commands.rs` — add settings commands, `detect_instruments`, update `resolve_binary` - `[NEW]` `src-tauri/src/settings.rs` — settings persistence logic - `[MODIFY]` `src-tauri/src/lib.rs` — register new module and commands - `[MODIFY]` `src-tauri/tauri.conf.json` — bundle targets and signing config - `[MODIFY]` `src/index.html` — settings dialog panel - `[NEW]` `src/js/settings.js` — settings UI logic - `[NEW]` `.gitea/workflows/release.yml` — CI build workflow (future) ### Acceptance Criteria - [ ] Settings persist across application restarts - [ ] Custom ArgyllCMS binary path override works - [ ] Instrument auto-detection populates dropdowns - [ ] `resolve_binary()` correctly selects platform-specific sidecar at runtime - [ ] `tauri build` produces installable packages for Linux (.deb, .AppImage) - [ ] Windows and macOS build targets configured (may require CI runners) - [ ] App icon and metadata correctly set in all installers ### References - [README.md §9 — Instrument Enumeration](README.md#instrument-enumeration-global) - [Tauri Bundler Documentation](https://tauri.app/distribute/) - Current sidecar config: `tauri.conf.json` → `bundle.resources`
gronod added this to the Milestone 5: Advanced Visualisations & Packaging milestone 2026-08-21 10:29:35 +01:00
Sign in to join this conversation.