No description
Complete UI layer refactoring to achieve Clean Architecture + TEA principles. Major Changes: - Eliminated sync.rs (76 LOC of manual synchronization) - Restructured AppModel: pure UI state only - Introduced AppMode enum (View, Crop, Transform, Fullscreen) - Added Viewport struct (scale, pan, canvas, cached_image_handle) - Added PanelState struct (left, right panels) - Removed all cached document data from UI layer - Views now access DocumentManager directly (no caching) - Update functions work on both model and manager directly Architecture: - TEA-compliant: Single source of truth, unidirectional flow - Clean separation: UI state vs Document state - No manual synchronization required Benefits: - Simplified codebase: -1,986 LOC net (-75.6%) - Better maintainability: Clear responsibilities - Type-safe state: Enums instead of flags - Performance: Cached rendering where needed Refactored Files: - src/ui/model.rs: Complete rewrite - src/ui/update.rs: Complete rewrite - src/ui/views/*: Updated to use new architecture - src/ui/views/meta_panel.rs: Extracted from panels.rs Testing: - All 24 unit tests passing - Compiles successfully (cargo check, cargo build) - 32 warnings (non-critical, future features) BREAKING CHANGES: None (internal refactoring only) Co-authored-by: Clean Architecture principles Co-authored-by: TEA (The Elm Architecture) pattern |
||
|---|---|---|
| .zed | ||
| DEVNOTE | ||
| docs | ||
| i18n/en | ||
| resources | ||
| src | ||
| .gitignore | ||
| Cargo.lock | ||
| Cargo.toml | ||
| i18n.toml | ||
| justfile | ||
| LICENSE | ||
| README.md | ||
| rustfmt.toml | ||
Noctua
An image viewer application for the COSMIC™ desktop
Features
- Multi-format support: Raster images (PNG, JPEG, WebP, etc.), SVG vector graphics, and PDF documents
- Navigation: Browse through folders with keyboard shortcuts
- Transformations: Rotate, flip, and crop images
- Zoom & Pan: Flexible viewing with zoom controls and panning
- Multi-page documents: Navigate PDF pages with thumbnail previews
- Metadata display: View EXIF data and file information
- Wallpaper setting: Set images as desktop wallpaper (multi-DE support)
Architecture
Noctua follows Clean Architecture principles with clear separation of concerns:
src/
├── main.rs # Application entry point
├── ui/ # UI Layer (COSMIC interface)
│ ├── app.rs # Application state & lifecycle
│ ├── model.rs # UI state + cached render data
│ ├── update.rs # Message handlers
│ ├── sync.rs # Model synchronization
│ ├── views/ # View components
│ └── components/ # Reusable widgets
├── application/ # Application Layer (use cases)
│ ├── document_manager.rs # Document orchestration
│ ├── commands/ # Write operations (Transform, Crop)
│ └── services/ # Shared services (Cache)
├── domain/ # Domain Layer (business logic)
│ ├── document/ # Document abstractions & operations
│ │ ├── core/ # Traits & types (Renderable, Transformable)
│ │ ├── types/ # Implementations (Raster, Vector, Portable)
│ │ └── operations/ # Transform, render, export operations
│ └── errors.rs # Domain errors
└── infrastructure/ # Infrastructure Layer (external systems)
├── loaders/ # Document loading (image, SVG, PDF)
├── cache/ # Thumbnail caching
├── filesystem/ # File operations
└── system/ # System integration (wallpaper)
Key Patterns:
- MVU (Model-View-Update): Elm architecture via libcosmic
- Command Pattern: All operations go through commands
- Dependency Inversion: Domain has no dependencies on infrastructure
- Type-Erased Documents:
DocumentContentenum for unified handling
Installation
A justfile is included by default for the [casey/just][just] command runner.
justbuilds the application with the defaultjust build-releaserecipejust runbuilds and runs the applicationjust installinstalls the project into the systemjust vendorcreates a vendored tarballjust build-vendoredcompiles with vendored dependencies from that tarballjust checkruns clippy on the project to check for linter warningsjust check-jsoncan be used by IDEs that support LSP
Dependencies
Arch Linux
sudo pacman -S poppler-glib
Debian/Ubuntu
sudo apt install libpoppler-glib-dev
Fedora
sudo dnf install poppler-glib-devel
OpenSUSE
sudo zypper install poppler-glib-devel
Documentation
License
GPL-3.0-or-later
