Architecture & Maintenance
Glint Architecture & Maintenance
Glint is a lightweight, cross-platform desktop system monitor built with Python and PyQt6. Its architecture prioritises low overhead, responsive rendering, local configuration and graceful handling of unavailable hardware sensors.
This page covers the Glint 1.x codebase, its internal components, development workflow and release process.
Design principles
Glint is deliberately small and local-first. Its architecture follows several core principles:
- Native rendering: Use Qt's painter system rather than a browser or Electron runtime.
- Responsive interface: Keep hardware polling separate from the GUI thread.
- Cross-platform compatibility: Share one application architecture across Windows, macOS and Linux.
- Graceful sensor fallbacks: Missing or unsupported readings should never prevent Glint from starting.
- Local configuration: Store preferences and layouts in JSON without requiring accounts or cloud services.
- Optional networking: System monitoring works offline; update notifications require explicit opt-in.
- Simple distribution: Publish standalone platform-specific archives through GitHub Releases.
The goal is to provide a useful desktop utility without introducing unnecessary infrastructure or dependencies.
Repository structure
The main components are organised as follows:
main.py Source convenience entry point
pyproject.toml Dependencies, metadata and build configuration
src/app.py QApplication, HUD and tray lifecycle
src/core/sensors.py Hardware sensor collection
src/core/settings_storage.py JSON settings validation and persistence
src/core/theme.py Theme loading and colour handling
src/core/update.py Optional GitHub release checking
src/core/stats.py Legacy stats API compatibility wrapper
src/ui/hud.py Frameless HUD, rendering and dragging
src/ui/settings.py Independent Settings window
src/ui/tray.py Tray actions and autostart integration
src/ui/layout.py Layout validation and persistence
src/ui/editor.py Interactive HUD layout editor
src/ui/widgets/ Individual painter-rendered widgets
src/ui/lin_hud.py Legacy HUD import compatibility alias
src/ui/menu.py Legacy launcher compatibility shim
src/themes.json Bundled theme definitions
scripts/release.py Release validation, builds and checksums
tests/ Automated application tests
.github/workflows/ Cross-platform CI and release workflows
The application uses a shared entry point for normal launches and packaged builds.
src.app:main creates the Qt application, initialises the HUD, and installs the system tray manager.
The glint console command and python -m src use the same application entry point.
Rendering and application lifecycle
The HUD
GlassHUD is a frameless, translucent Qt window rendered directly using QPainter.
The HUD draws its background, borders, title, footer and individual widgets without embedding a browser or web view.
Widget definitions are serialisable, allowing the HUD to recreate its layout from local JSON configuration.
Each widget is responsible for displaying a particular metric, such as CPU utilisation, memory usage or network activity.
Window behaviour
Glint requests desktop-level window behaviour through Qt, including positioning the HUD beneath other windows where supported.
Window managers and compositors ultimately control whether those requests are honoured.
On Wayland, Glint first attempts compositor-assisted window movement. Manual coordinate-based dragging remains available as a fallback where supported.
The HUD's final position is saved locally when movement finishes.
Application lifecycle
At startup, Glint:
- Loads and validates saved preferences.
- Loads the selected theme and any custom colour overrides.
- Loads the saved widget layout, falling back to defaults if necessary.
- Creates the HUD and starts sensor sampling.
- Initialises the system tray and optional startup controls.
- Starts the release checker only if update notifications are enabled.
On a normal exit, Glint saves its current position and widget layout before shutting down.
Sensor collection
Glint separates hardware monitoring from the interface.
A low-priority worker thread collects sensor readings at the configured refresh interval and sends the results back to the GUI thread through a queued Qt connection.
This prevents slow hardware probes from blocking window movement or painting.
The refresh interval is configurable between 250 and 60,000 milliseconds.
Sensor providers
Glint uses several interfaces depending on the platform and available hardware.
| Provider | Purpose |
|---|---|
psutil |
CPU, memory, disks, network counters and exposed temperatures |
| WMI | Optional Windows CPU temperature and GPU usage fallbacks |
nvidia-smi |
NVIDIA GPU utilisation and temperature when available |
| Windows performance counters | Vendor-neutral GPU usage reporting |
Sensor collection returns a consistent data structure regardless of operating system.
Unsupported or failed probes are converted into unavailable values rather than causing application errors.
Windows GPU sampling
Some Windows GPU performance counter providers respond slowly or consume excessive CPU time when queried repeatedly.
Glint filters relevant 3D engine counters and automatically backs off when a provider becomes expensive to query.
Cached readings can be reused until the provider is ready to be queried again.
This behaviour helps maintain responsive dragging and avoids unnecessary CPU usage.
Unavailable sensors
Hardware monitoring varies between devices, drivers, firmware and operating systems.
Glint does not assume every sensor is available.
Widgets display Unavailable when a reading cannot be obtained.
Missing optional sensors do not prevent the rest of the HUD from operating.
Layout system
Glint's HUD is composed of independent painter-rendered widgets.
Each widget has a type, position, dimensions and optional widget-specific configuration.
The layout system supports:
- Serialising widget definitions to JSON.
- Validating saved widget types and geometry.
- Creating widgets from saved definitions.
- Saving HUD dimensions and widget positions.
- Falling back to default layouts when configuration is invalid.
Interactive layout editor
Introduced in v1.0.4, the layout editor allows users to modify the HUD without manually editing JSON.
The editor supports dragging widgets, resizing widgets and the HUD, adding or removing widgets, and optional grid snapping.
Changes are committed when the user selects Save.
Selecting Discard or pressing Esc restores the previous layout.
The editor works with the existing JSON layout system rather than maintaining a separate configuration format.
Layout persistence
Layouts are stored in the operating system's application configuration directory.
The default layout file is default_layout.json.
Glint validates saved data before creating widgets. Invalid or unreadable layout files fall back to the built-in defaults.
HUD dimensions and widget definitions are saved during normal shutdown, while an explicit layout reset is persisted immediately.
Themes and appearance
Glint includes bundled theme definitions in src/themes.json.
The theme system separates bundled defaults from user-specific colour overrides.
src/core/theme.py loads the selected base theme and merges valid overrides from the user's settings.
The Appearance settings support 11 individual colour properties, including transparency.
Overrides are validated using Qt's colour handling and stored in local preferences.
Invalid colour values or unknown theme properties are ignored rather than applied.
This allows users to customise Glint without modifying the bundled theme files.
Settings window
The Settings window is intentionally independent of the HUD.
It is created as a top-level Qt window rather than a child of the frameless HUD.
This avoids desktop environments treating Settings as an attached tool panel and allows the window to behave normally.
Changes to refresh rate, opacity, themes, colours, HUD title and update preferences are applied through the application's settings system.
Configuration and persistence
src/core/settings_storage.py handles application preferences.
Settings are validated before use, including:
- Refresh interval: 250–60,000 milliseconds.
- HUD opacity: 20–100%.
- Theme selection and custom colour values.
- Window position and other application preferences.
Missing, malformed or unreadable settings fall back to defaults.
Configuration saves use a temporary file followed by replacement to reduce the risk of partially written JSON.
Glint stores no historical sensor data.
Optional update checking
Glint introduced opt-in update notifications in v1.0.4.
The update checker is implemented separately from the sensor collection system.
When enabled, it requests GitHub release metadata and compares the available release version with the installed Glint version.
If a newer release is found:
- A yellow indicator appears beside the HUD title.
- The tray menu exposes Get update.
- Selecting that action opens the GitHub release page.
Glint does not automatically download, replace or install application files.
Update checking is disabled by default, and the monitoring functionality does not depend on network access.
Development environment
Glint requires Python 3.10 or later and a graphical desktop environment.
Clone the repository and create a virtual environment:
git clone https://github.com/ZFordDev/Glint.git
cd Glint
python -m venv .venv
Activate the environment:
Windows
.venv\Scripts\activate
macOS and Linux
source .venv/bin/activate
Install the development dependencies:
python -m pip install -e ".[dev]"
Run Glint from the repository:
python main.py
Dependencies and optional development tools are declared in pyproject.toml, which remains the single source of dependency configuration.
Testing and code quality
Before submitting changes, run the project's formatting checks, linter and automated tests:
ruff format --check .
ruff check .
python -m pytest
GitHub Actions runs these checks across Windows, macOS and Linux using Python 3.10.
Qt's offscreen platform is used during automated testing, allowing interface-related tests to execute without a normal desktop session.
Linux CI runners install the system libraries required by Qt.
Automated checks help maintain cross-platform compatibility, but changes involving window stacking, dragging, tray integration or hardware sensors should also be tested on a real desktop environment.
Packaging and releases
Glint uses PyInstaller to create standalone archives on native GitHub-hosted runners.
The release process produces:
| Platform | Release archive |
|---|---|
| Windows x86-64 | glint-windows-x86_64.zip |
| macOS arm64 | glint-macos-arm64.zip |
| macOS x86-64 | glint-macos-x86_64.zip |
| Linux x86-64 | glint-linux-x86_64.tar.gz |
Each release includes SHA256SUMS for archive verification.
Publishing a release
The normal release workflow is:
- Update the project version in
pyproject.toml. - Update the changelog.
- Merge the tested release changes into
main. - Create and push a matching version tag, such as
v1.0.5. - Let GitHub Actions validate the tag and project version.
- Build the platform-specific archives.
- Generate checksums and publish the GitHub Release once the required builds succeed.
The workflow also supports manual rehearsal builds without publishing a release.
Glint does not currently use a built-in installation or automatic update mechanism for its standalone GitHub archives.
Maintenance guidelines
When making changes to Glint, preserve the behaviour that keeps the application small and reliable.
- Keep sensor collection independent of the GUI thread.
- Preserve graceful fallbacks for missing hardware sensors.
- Avoid introducing unnecessary network dependencies.
- Maintain a shared application path across supported operating systems.
- Keep layout and settings validation compatible with existing user configurations.
- Test HUD movement when changing Qt window flags or compositor-related behaviour.
- Keep the Settings window independent of the HUD.
- Maintain opt-in behaviour for update notifications.
- Keep documentation aligned with user-visible changes and release packaging.
Glint's v1.0.5 release primarily refreshed runtime, development and packaging dependencies following the larger v1.0.4 feature update.
Future maintenance should continue prioritising compatibility, responsiveness and practical improvements rather than unnecessary complexity.
Contributing and security
Glint is open source under the MIT License.
Contributions, bug reports and hardware compatibility feedback are welcome through the GitHub repository.
For contribution requirements, see CONTRIBUTING.md.
For vulnerability reporting and security guidance, see SECURITY.md.