Skip to content

Refactor/cargo workspace - #20

Merged
cyb0rg56 merged 3 commits into
mainfrom
refactor/cargo-workspace
Sep 29, 2026
Merged

cyb0rg56 merged 3 commits into
mainfrom
refactor/cargo-workspace

Conversation

@cyb0rg56

Copy link
Copy Markdown
Owner

The app is now a four-part Cargo workspace like fan-control's. It builds, and cargo fmt --check and cargo clippy --workspace --all-targets are clean. All 121 tests pass (69 in data, 52 in hardware). I haven't run the app itself, so the GUI smoke test from the plan is still to do.

Crate Contents
hardware/ ccd and ddc. The DDC test helpers are now in ddc::test_util, available through a test-util feature so data's tests can use them.
data/ Config, persistence, profiles, startup, hotkey manager, tray, and the hardware job queue. The new presentation.rs holds the monitor view models, and the new state.rs holds AppState.
ui/ A thin AppModel wrapper, the views, effects.rs, subscriptions.rs and keys.rs.
root main.rs calls ui::run(...). build.rs and packaging are unchanged.

How the split works:

  • State: AppState::update(Input) returns a list of Effect's. It never creates a cosmic Task.
  • Effects: there are five kinds:
    • Spawn(Job): hardware work, config ops or profile listing.
    • Delay: the slider debounce.
    • MonitorsDetected: the UI rebuilds the navigation bar.
    • ProfilesUpdated: the UI refreshes the tray menu.
    • ShowHotkeys: the UI switches to the Hotkeys page.
  • UI: the UI turns these into tasks. Message is now Data(Input) plus the UI-only messages (window, tray, settings drawer, clipboard, URLs). Views read state only through getters.
  • Hotkeys and tray: data::hotkeys and data::tray no longer use cosmic. The UI wraps them as subscriptions.
  • Dependencies: data doesn't depend on libcosmic, and hardware doesn't depend on cosmic, tray-icon or global-hotkey (checked with cargo tree).

@cyb0rg56
cyb0rg56 merged commit f7cdc65 into main Sep 29, 2026
2 checks passed
@cyb0rg56
cyb0rg56 deleted the refactor/cargo-workspace branch September 29, 2026 20:42
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.

1 participant