Skip to content

feat(cardwire-gui): Smart mode page - #167

Merged
luytan merged 1 commit into
mainfrom
feat(cardwire-gui)--Smart-mode-policy-page
Aug 8, 2026
Merged

feat(cardwire-gui): Smart mode page#167
luytan merged 1 commit into
mainfrom
feat(cardwire-gui)--Smart-mode-policy-page

Conversation

@luytan

@luytan luytan commented Aug 8, 2026

Copy link
Copy Markdown
Member

Description

Please include a summary of the changes and if applicable, a related issue.

If this PR introduce a new feature, explain your motivations

Fixes # (issue)

TODO

  • Copy-Paste this line

Checklist:

  • My code follows the style guidelines of this project (cargo fmt)
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the mdBook documentation
  • My changes generate no new warnings (clippy/clang)
  • New and existing unit tests pass locally with my changes (either use nix flake check or wait for the ci)

@luytan
luytan merged commit e715e95 into main Aug 8, 2026
1 of 2 checks passed
@luytan
luytan deleted the feat(cardwire-gui)--Smart-mode-policy-page branch August 8, 2026 12:37
@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: a558e696-c3ab-4055-b942-1713f1bc1972

📥 Commits

Reviewing files that changed from the base of the PR and between fd4df56 and 9eba39b.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (9)
  • crates/cardwire-gui/Cargo.toml
  • crates/cardwire-gui/src/app.rs
  • crates/cardwire-gui/src/helpers/app_resolver.rs
  • crates/cardwire-gui/src/helpers/dbus.rs
  • crates/cardwire-gui/src/helpers/mod.rs
  • crates/cardwire-gui/src/message.rs
  • crates/cardwire-gui/src/models.rs
  • crates/cardwire-gui/src/subscription.rs
  • crates/cardwire-gui/src/ui.rs

📝 Walkthrough

Summary by CodeRabbit

  • New Features
    • Added a fully functional Smart Mode page for viewing and managing application GPU policies.
    • Added application search, policy refresh, loading indicators, and empty-state messaging.
    • Added application names and icons using desktop metadata for clearer identification.
    • Added policy toggles that are available when Smart Mode is active.
    • Added status notices for successful updates and errors.

Walkthrough

Smart Mode now loads application policies over D-Bus, resolves desktop metadata and icons, stores policy state, and renders searchable controls. Policy toggles update the D-Bus service only when Smart Mode is active.

Changes

Smart Mode application policy flow

Layer / File(s) Summary
Policy models and message contracts
crates/cardwire-gui/src/models.rs, crates/cardwire-gui/src/message.rs, crates/cardwire-gui/Cargo.toml
Adds D-Bus metadata, resolved application, and Smart Mode state models. Adds messages for policy loading, updates, searching, and refreshing.
Application metadata resolution
crates/cardwire-gui/src/helpers/app_resolver.rs, crates/cardwire-gui/src/helpers/mod.rs
Discovers XDG data directories, reads localized .desktop files, applies name fallbacks, and resolves PNG, SVG, and XPM icons.
D-Bus policy orchestration
crates/cardwire-gui/src/helpers/dbus.rs, crates/cardwire-gui/src/subscription.rs, crates/cardwire-gui/src/app.rs
Adds D-Bus methods and subscriptions for fetching and setting application policies. App state resolves metadata, tracks loading state, updates policies, and reports results.
Smart Mode page
crates/cardwire-gui/src/ui.rs, crates/cardwire-gui/src/app.rs
Replaces the placeholder with policy counts, search and refresh controls, loading and empty states, application cards, and conditional policy toggles.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Smart Mode UI
  participant AppState
  participant CardwireDbus
  participant Desktop Metadata
  Smart Mode UI->>AppState: RefreshSmartPolicies
  AppState->>CardwireDbus: GetAppPolicies
  CardwireDbus-->>AppState: Application policy metadata
  AppState->>Desktop Metadata: Resolve names and icons
  Desktop Metadata-->>AppState: ResolvedApp values
  AppState-->>Smart Mode UI: Render searchable policies
  Smart Mode UI->>AppState: SetAppPolicy
  AppState->>CardwireDbus: SetAppPolicy
  CardwireDbus-->>AppState: Policy result
Loading

Possibly related PRs

Suggested reviewers: juandelpueblo


Comment @coderabbitai help to get the list of available commands.

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