Skip to content

docs: add implementation patterns & gotchas guide#15

Merged
jfreed-dev merged 1 commit into
mainfrom
docs/extract-patterns
Jun 23, 2026
Merged

docs: add implementation patterns & gotchas guide#15
jfreed-dev merged 1 commit into
mainfrom
docs/extract-patterns

Conversation

@jfreed-dev

Copy link
Copy Markdown
Owner

Summary

Recovers durable libcosmic/iced development lessons from the project's pre-public history (the old docs/development/LEARNINGS.md) and rewrites them against the current codebase. The original note referenced files that no longer exist (wallpaper_config.rs, the monolithic app.rs, ThumbnailCache, flex_row/button::image), so it's reconstructed rather than restored.

New: docs/development/PATTERNS.md

  • Performance — never work in view(): it runs every frame; cache results and failures; GPU image cost is decode+upload, not display size. Framed as a general principle (the wallpaper grid that taught it is gone).
  • Live widget idioms, each grounded in current src/:
    • widget::dropdown — the 'static closure gotcha (src/app/visuals.rs)
    • file_chooser open/save dialogs with Cancelled handling
    • cosmic::task::future for async work off the UI thread
  • Theming via the typed cosmic_theme API (dark_config()/light_config()), not hand-edited RON files.
  • Config paths centralized in src/paths.rs.
  • .ftl gotcha: RustEmbed embeds translations at compile time (src/localize.rs); cargo clean forces a re-embed.

Changed: docs/architecture/OVERVIEW.md

Cross-reference from "Performance Guidelines" to the new guide.

Notes

  • Deliberately dropped the old PROJECT-NAMING.md (settled decision) and stale/removed widget examples to avoid re-introducing dead references.
  • Docs-only; no code changes. lint-docs only checks cargo doc, so no markdown lint impact.
  • Full original history preserved on the local pre-public-history branch.

🤖 Generated with Claude Code

Capture durable libcosmic/iced lessons recovered from the pre-public
development history, rewritten against the current codebase:

- Performance: why view() must stay cheap (runs every frame), cache
  results and failures, GPU image decode/upload cost
- Live widget idioms grounded in current src/: dropdown 'static closure
  gotcha, file_chooser open/save dialogs, cosmic::task::future async
- Theming via the typed cosmic_theme API (not hand-edited RON files)
- Config paths resolved centrally in src/paths.rs
- RustEmbed .ftl compile-time embedding gotcha (cargo clean to re-embed)

Cross-linked from architecture/OVERVIEW.md Performance Guidelines.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jfreed-dev jfreed-dev merged commit a7e35fd into main Jun 23, 2026
3 checks passed
@jfreed-dev jfreed-dev deleted the docs/extract-patterns branch June 23, 2026 01:29
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