How nokyan/resources works
Main Components
• User Interface (UI) Layer:
• Located largely under the src/ui directory (with pages, dialogs, widgets, and the main window definition in src/ui/window.rs).
• Uses GTK 4 and libadwaita (as referenced in the README) for rendering the GUIs.
• Application Logic & Utilities:
• Core application logic and resource handling occur in several layers:
– The primary entry point in src/application.rs and src/lib.rs.
– Submodules in src/utils/ for CPU, memory, network, GPU, NPU, battery, etc.
• Data Processing/Library Component:
• The lib/process_data directory encapsulates logic for processing resource data, and can be treated as a separate module or micro-library.
• Data & Resources:
• Build & Deployment Modules:
• Meson build files (meson.build, meson_options.txt) that define configuration.
• Cargo.toml and Cargo.lock for Rust dependency management.
• Flatpak build configuration under build-aux (including net.nokyan.Resources.Devel.json) and GitHub workflows for CI.
Relationships and Interactions
• The UI Layer communicates with the application logic to display current system metrics (CPU, memory, GPU, etc.) and to interact with user actions.
• The application logic gathers system status data using the utilities module (src/utils) and, when needed, performs operations like listing processes or terminating them.
• Data modules (in lib/process_data) provide underlying processing functions that are consumed by both the UI and utility functions.
• Build configurations (Meson and Flatpak files) encapsulate the dependencies and deployment settings, ensuring the project builds correctly in multiple environments.
Architectural Patterns / Design Principles
• Modular Separation: The application divides responsibilities clearly by splitting UI, utilities, and data processing into their own subdirectories.
• Layered Structure: Presentation (UI), business logic (core application and utilities), and infrastructure (build scripts, assets) are defined in different layers.
• Extensibility: The clear separation of concerns (e.g., distinct modules for different resource types and UI components) facilitates easier maintenance and potential future expansions (e.g., adding new resource monitors).
Technologies and Frameworks
• Rust language for backend logic.
• GTK 4 and libadwaita for the front-end graphical interface.
• Meson and Ninja for native builds, along with Cargo for dependency management.
• Flatpak for distribution, making sure to reference the specific build configurations.