Skip to content

feat(cardwired): refresh the internal xdg apps list on new app - #164

Merged
luytan merged 1 commit into
mainfrom
xdg-list-update
Aug 8, 2026
Merged

feat(cardwired): refresh the internal xdg apps list on new app#164
luytan merged 1 commit into
mainfrom
xdg-list-update

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)

@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • New Features
    • Application listings now update automatically when desktop application entries change.
    • Newly added or modified applications are detected in monitored application folders without requiring a manual refresh or restart.
    • Application details such as names, icons, launch commands, Flatpak identifiers, and Steam links continue to be recognized.

Walkthrough

The daemon now discovers XDG application folders, parses desktop entries through a shared helper, and monitors those folders with inotify. CardwireAnalyzer starts an asynchronous watcher that updates shared application metadata.

Changes

Desktop application watching

Layer / File(s) Summary
Discovery and parsing contract
Cargo.toml, crates/cardwire-daemon/Cargo.toml, crates/cardwire-daemon/src/analyzer/static_analysis.rs
The workspace adds inotify. get_fdo_apps returns application metadata and scanned folders. parse_fdo_app centralizes desktop-entry parsing and lookup-key creation.
XDG directory watcher
crates/cardwire-daemon/src/analyzer/static_analysis.rs
watch_fdo_folders watches XDG directories, handles filesystem events, parses changed .desktop files, and updates the shared application map.
Analyzer watcher integration
crates/cardwire-daemon/src/analyzer/models.rs
CardwireAnalyzer retains XDG folder paths and starts the asynchronous watcher during run.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CardwireAnalyzer
  participant watch_fdo_folders
  participant inotify
  participant parse_fdo_app
  participant ApplicationMap
  CardwireAnalyzer->>watch_fdo_folders: start with XDG folders and shared map
  watch_fdo_folders->>inotify: register directory watches
  inotify-->>watch_fdo_folders: report desktop-file event
  watch_fdo_folders->>parse_fdo_app: parse changed .desktop file
  parse_fdo_app-->>watch_fdo_folders: return application metadata
  watch_fdo_folders->>ApplicationMap: merge metadata under write lock
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 3 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description contains only the default template and omits the change summary, motivation, issue reference, and completed checklist items. Describe the XDG application monitoring change, explain its motivation, add a related issue if applicable, and complete the checklist.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: refreshing the internal XDG applications list when a new application appears.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crates/cardwire-daemon/src/analyzer/static_analysis.rs`:
- Around line 111-169: In static_analysis.rs:111-169, register inotify watches
before the initial application scan, include DELETE and MOVED_FROM in the watch
mask, and rebuild and replace xdg_list—not extend it—after removals, renames,
metadata changes, or Q_OVERFLOW. Update the related application-list logic in
models.rs:85-89 and models.rs:118-124 to support rebuilding a coherent snapshot
and replacing stale aliases.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: f5ce72ce-ed89-4350-87c9-a03e0854d0f6

📥 Commits

Reviewing files that changed from the base of the PR and between adcaac6 and 693d31d.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (4)
  • Cargo.toml
  • crates/cardwire-daemon/Cargo.toml
  • crates/cardwire-daemon/src/analyzer/models.rs
  • crates/cardwire-daemon/src/analyzer/static_analysis.rs

Comment thread crates/cardwire-daemon/src/analyzer/static_analysis.rs
@luytan
luytan merged commit a1f6063 into main Aug 8, 2026
7 checks passed
@luytan
luytan deleted the xdg-list-update branch August 8, 2026 11:19
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