plasmoides KDE Store/GitHub (gnome-pager, kMenu, kvitals, windowtitle, claude, launchpad)

This commit is contained in:
Josevi
2026-07-08 20:47:59 +02:00
parent ca606377ee
commit dd3b0f6ae8
136 changed files with 20239 additions and 0 deletions
@@ -0,0 +1,250 @@
# Changelog
All notable changes to KVitals will be documented in this file.
## [2.10.1] - 2026-06-29
### Fixed
- **Plasmashell Boot Crashes**: Resolved a critical race condition that caused `plasmashell` to enter a crash loop during system boot. Sensor module loading is now deferred until after window attachment is fully complete, preventing the `KirigamiPlasmaStyle` SIGSEGV (#49).
## [2.10.0] - 2026-06-27
### Added
- **Fan Speed Monitoring** (`Metrics` settings): A new standalone "Fan" metric that dynamically discovers and reports fan speeds (including GPU and CPU fans) directly from the system (#47).
- Automatically identifies fans through `SensorTreeModel`.
- Supports RPM and Percentage display units (configurable in `General` settings).
- Fully integrates with compact panel, full popup, and tooltip views.
- Safely handles fans that do not report a maximum RPM by omitting them from percentage-based aggregations to prevent misleading data.
- **Display Mode 'None'** (`General` settings): A new display mode that completely hides the metric labels and icons, showing only the raw values to save space (#47).
- **Config UI Redesign** (`Metrics` settings): The metrics configuration page has been overhauled for better UX, with inline contextual settings (e.g. CPU, GPU, Network options expand directly under their respective metrics) and debounced sensor discovery to eliminate UI freezes on load (#48).
## [2.9.0] - 2026-06-19
### Added
- **Per-GPU Sub-metric Visibility** (`Metrics` settings — GPU Selection): Each GPU entry now has independent **Usage**, **VRAM**, and **Temperature** toggles, letting you show only the metrics you care about without disabling the GPU entirely (#44).
- Toggling a sub-metric off immediately stops polling those sensors — no unnecessary kernel data fetched.
- A **minimum-one** guard prevents all three sub-metrics from being deselected at once (the last checked box is disabled), keeping at least one value visible per GPU.
- Sub-metric checkboxes are automatically disabled when the parent GPU is deselected, matching visual state to functional reality.
- Storage format uses a compact pipe-separated string (`gpu0:usage,vram|gpu1:usage,temp`). GPUs using all defaults are omitted, keeping the config short. Empty string (default) = all three enabled for every GPU — fully backwards-compatible with existing configs.
## [2.8.1] - 2026-05-23
### Fixed
- **Installation via KDE Store leaving stale widget state** (`install-remote.sh`): Users who first installed via the KDE Store (or an older `install-remote.sh`) and then upgraded manually could end up with a mismatched `kpackage/generic/` registration. This caused settings like **Show in compact panel** to silently not apply, because KDE resolves widget configuration from the kpackage path, not the plasmoids path. The remote install script now mirrors the local `install.sh` behaviour exactly: it removes any previous entry under `~/.local/share/kpackage/generic/<id>` (including stale symlinks), creates the install directory under `~/.local/share/plasma/plasmoids/`, and creates a fresh symlink at the kpackage path pointing to it.
## [2.8.0] - 2026-05-22
### Added
- **Disk I/O & Temperature** (`Metrics` settings — Disk I/O & Temp): New metric showing real-time disk read/write rates and the highest drive temperature across all NVMe and SATA drives. Displayed as `DSK: ↓2.1MB ↑76KB · 42°C` in the compact panel (#36).
- Drive temperatures are discovered dynamically via `SensorTreeModel` + `lmsensors` (supports `nvme-pci-*` and `drivetemp-scsi-*` chips) — zero polling overhead when the metric is disabled.
- Dedicated **Disk Temp** threshold sliders added to the Colors settings page (default: warning 45°C, critical 60°C).
- **Unit Preferences** (`General` settings — Unit Preferences section): Choose display units globally across all metrics (#37).
- **Temperature**: Celsius (°C, default) or Fahrenheit (°F). Applies to CPU temp, GPU temp, and Disk temp everywhere — panel, popup, and tooltip.
- **Network / Disk I/O**: Bytes (KB/MB, default) or Bits (Kb/Mb). Applies to Network and Disk I/O rates. Suffix convention follows industry standard: uppercase `B` = bytes, lowercase `b` = bits.
- Threshold slider labels in the Colors settings page update live to reflect the chosen temperature unit (stored values remain in °C for correct sensor comparison).
## [2.7.0] - 2026-05-15
### Added
- **Multi-GPU Support** (`Metrics` settings — GPU Selection): On systems with more than one GPU, each GPU is now listed individually as a separate metric in both the compact panel and the full popup view (#22). Works automatically — no configuration needed on single-GPU machines.
- Each GPU is detected dynamically via `SensorTreeModel` metadata; no persistent subscriptions run during discovery.
- The GPU Selection section in settings shows all discovered GPUs with independent enable/disable checkboxes.
- **GPU Custom Labels** (`Metrics` settings — GPU Selection): On multi-GPU systems, each GPU entry in the panel shows a customizable label. Type a name in the **Label** field (e.g. `iGPU`, `dGPU`) to override the default `GPU 1` / `GPU 2` identifiers. Leave it empty to keep the default numbering.
- **Hybrid GPU power hint**: When two or more GPUs are detected, a contextual note appears in the GPU Selection section explaining that unchecking the discrete GPU prevents KVitals from polling it, allowing it to suspend when idle.
### Fixed
- **Unintended dGPU Wakeup** on hybrid GPU laptops (Intel/AMD + NVIDIA setups using `supergfxctl` / `asusctl`): The previous implementation used permanent `Sensors.Sensor` subscriptions for up to 6 hardcoded GPU slots. These subscriptions polled every GPU continuously, preventing the dGPU from entering its suspended/power-save state even when it was idle (#26).
- **New architecture**: Discovery uses `SensorTreeModel` + `KDescendantsProxyModel` (pure metadata query, no value subscriptions). Data polling uses a single `SensorDataModel` constrained strictly to the GPUs the user has selected.
- **Result**: Deselecting a GPU in settings stops all polling for that GPU immediately. On hybrid setups, unchecking the dGPU allows it to fully suspend.
- **Note**: If the dGPU remains active even after unchecking it in KVitals, the cause is likely unrelated — some Xwayland applications keep the GPU awake independently of any sensor polling. This is a system/compositor-level behavior outside the scope of KVitals.
## [2.6.0] - 2026-05-10
### Added
- **Compact Panel Visibility** (`Metrics` settings): Each metric now has an independent "Show in compact panel" toggle, allowing metrics to appear in the full popup view but stay hidden from the panel bar (#29, thanks @keiishu). Disabling a metric preserves its compact visibility state for when it is re-enabled.
- **CPU Frequency** (`Metrics` settings): Display the average CPU frequency in the widget. Auto-formats as GHz (≥ 1000 MHz) or MHz (#33).
- **Merge into CPU** (compact view): Appends frequency as a second segment next to CPU usage (`CPU: 34% · 3.20 GHz`). Compatible with Merge CPU & Temp — all three values appear as segments.
- **Full view sub-item**: When enabled, CPU Frequency appears as a dedicated row directly under CPU Usage in the popup.
- **Bold Font** (`General` settings): Toggle bold styling for all metric value labels across compact and full views (#30). Defaults to off.
### Fixed
- Inconsistent font weight across metrics in vertical layout: RAM and Network values (rendered via `SegmentsRow`) were always bold while CPU/GPU were not. All value labels now follow the new Bold Font setting uniformly.
## [2.5.0] - 2026-04-30
### Added
- **Layout Type** (`General` settings): Choose between **Horizontal** (default, unchanged) and **Vertical** layout for the compact panel view. In vertical mode, the metric value is displayed on top with the label/icon dimmed below — ideal for tall panels or icon-only display (#11).
- **Metric Grouping** (`Metrics` settings — Grouping section):
- **Merge CPU & Temp**: Combines CPU temperature as a second value next to CPU usage (`CPU: 45% · 62°C`), using the same segment display as GPU. The CPU Temperature entry is hidden from the metric order list while merged.
- **Merge Battery & Power**: Combines power consumption as a second value next to battery level (`BAT: 87% · 12.4W`). Power Consumption entry is hidden from the metric order list while merged.
- **Split GPU Metrics**: Optionally break GPU usage, VRAM and temperature into separate panel entries instead of the default grouped display (default: grouped).
### Changed
- Metric order list now hides absorbed metrics when grouping is active (e.g. "CPU Temperature" disappears when "Merge CPU & Temp" is enabled), keeping the list clean and non-redundant.
- `CompactView` refactored to use a `Loader`-based delegate system, enabling runtime layout switching without widget reload.
### Fixed
- `Unable to assign [undefined] to QColor` runtime error when CPU+Temp or Battery+Power merge was enabled — missing top-level `color` field on segmented metric objects.
- Defensive `|| baseTextColor` fallback added to all value label color bindings in `CompactView`.
## [2.4.0] - 2026-04-01
### Added
- **Custom Font Color**: Override the widget font color to match your panel theme (#20). Configurable via the new **Colors** settings tab.
- **Threshold-Based Coloring**: Metric values dynamically change color when they exceed configurable warning/critical thresholds (#12). Supported metrics:
- CPU usage (default: warning 70%, critical 90%)
- CPU temperature (default: warning 60°C, critical 85°C)
- RAM usage (default: warning 70%, critical 90%)
- GPU usage (default: warning 70%, critical 90%)
- GPU temperature (default: warning 60°C, critical 85°C)
- Battery level (inverted: warning below 30%, critical below 15%)
- **Colors Config Tab**: New settings page with color pickers for font/warning/critical colors and per-metric threshold sliders.
- Sensor modules now expose raw numeric values (`cpuNumericValue`, `tempNumericValue`, `ramPercentage`, `batNumericValue`) for threshold comparison.
- `Utils.resolveColor()` function for flexible threshold-triggered color resolution.
### Fixed
- Fixed the Colors tab color picker turning white after selecting a color; it now uses a stable native platform color dialog and preserves the selected swatch correctly.
### Notes
- Network and Power metrics are excluded from threshold coloring (no meaningful universal threshold).
- Both features are **opt-in** — disabled by default. Existing users are unaffected.
## [2.3.0] - 2026-03-13
### Changed
- **Sensor Module Architecture**: Extracted all sensor logic from `main.qml` into dedicated QML components under `contents/ui/sensors/`:
- `CpuSensors.qml` — CPU usage monitoring
- `MemorySensors.qml` — RAM usage monitoring
- `TempSensors.qml` — CPU temperature monitoring
- `GpuSensors.qml` — GPU usage, VRAM, and temperature monitoring
- `BatterySensors.qml` — Battery and power monitoring with auto-detection
- `NetworkSensors.qml` — Network download/upload speed monitoring
- `Utils.qml` — Shared formatting helpers (byte formatting, rate formatting)
- **View Separation**: Extracted compact and full representations into `CompactView.qml` and `FullView.qml`.
- **Reduced `main.qml`**: From ~700 lines to ~140 lines — now acts purely as an orchestrator.
### Notes
- No user-facing or configuration changes. The widget behaves identically to v2.2.1.
- This refactor improves maintainability and makes it easier to add new sensor types in the future.
## [2.2.1] - 2026-03-07
### Fixed
- **Battery Detection Hotfix**: Replaced `SensorTreeModel` with a crash-free **Two-Stage Hybrid Detection** system (#14):
- **Stage 1 (Silent Probe)**: Silently probes common battery paths (`BAT0`, `BAT1`, `BATT`, etc.) for instant detection without running any subprocesses.
- **Stage 2 (Fallback)**: If no standard battery is found, falls back to a single `qdbus` query to list all sensors, completely avoiding `PlasmaCore.DataSource` file descriptor leaks. Includes a manual config fallback if `qdbus` is unavailable.
## [2.2.0] - 2026-03-05
### Added
- **Custom Metric Order**: Added a new configuration option to arrange metrics (CPU, RAM, GPU, etc.) individually in whatever order you prefer (#7).
- **Dynamic Battery Detection**: Replaced hardcoded `BAT0`/`BAT1` sensors with dynamic `SensorTreeModel` discovery. The widget will now automatically find any battery your system has (BAT0, BATT, CMB0, macsmc-battery, etc.) (#14).
## [2.1.1] - 2026-03-03
### Fixed
- Fixed a "Detected anchors on an item that is managed by a layout" QML warning spanning the journal log caused by a `MouseArea` anchoring inside a `RowLayout` (#13).
## [2.1.0] - 2026-03-01
### Added
- **GPU Metrics Support**: Added VRAM usage and GPU temperature monitoring to the widget.
- GPU data is retrieved natively using KDE KSysGuard sensors (`org.kde.ksysguard.sensors`).
## [2.0.0] - 2026-02-27
### Changed
- **Major Architecture Overhaul**: Replaced the previous `sys-stats.sh` backend with native KDE KSysGuard sensors (`org.kde.ksysguard.sensors`).
- Completely eliminates "file descriptor leak" crashes (Issue #8) and improves overall performance by relying directly on the `ksystemstats` D-Bus daemon instead of constantly spawning bash processes.
- Automatic fallback for battery monitoring (BAT0 and BAT1) logic implemented directly in QML.
## [1.4.1] - 2026-02-24
### Fixed
- RAM usage showing empty on non-English locales — `free` translates its `Mem:` header based on locale, causing the parser to match nothing
- Switched RAM data source from `free -b` to `/proc/meminfo` (locale-independent, faster, more accurate)
## [1.4.0] - 2026-02-22
### Added
- **Display mode setting** — choose between Text, Icons, or Icons + Text for the panel
- **Custom icon picker** — select icons from your installed theme for each metric (via KDE's native icon picker)
- **Icon size slider** — adjust icon size (8–24px) when using icon mode
- **Font customization** — choose any system font and font size for the panel text
- **Settings tabs** — split configuration into General, Metrics, and Icons tabs
- **Reset to defaults** button on the Icons tab
- **CHANGELOG.md** — version history
- **Documentation** — MkDocs site with installation, configuration, architecture, contributing, and troubleshooting guides
## [1.3.0] - 2026-02-16
### Added
- Power consumption tracking (via `/sys/class/power_supply/`) — contributed by [@Pijuli](https://github.com/Pijuli)
### Fixed
- ShellCheck warnings from power consumption PR (SC2034, SC2155)
## [1.2.1] - 2026-02-16
### Fixed
- AMD CPU temperature detection — added `k10temp`, `zenpower`, `zenergy`, `amdgpu` to thermal_zone and hwmon detection
- lm-sensors fallback now matches AMD `Tccd1` label
- Reordered temperature fallback tiers to prioritize CPU-specific sources over generic thermal zones
## [1.2.0] - 2026-02-13
### Added
- Auto-detect network interface via `ip route` with manual override in settings
- Network interface selector in widget configuration
### Fixed
- ShellCheck warnings (SC2010, SC2155)
## [1.1.0] - 2026-02-12
### Changed
- Modularized `sys-stats.sh` into functions
- Enhanced CPU temperature detection with 4-tier fallback (thermal_zone → hwmon → lm-sensors → generic)
## [1.0.0] - 2026-02-12
### Added
- Initial release
- CPU usage (delta-based from `/proc/stat`)
- RAM usage (from `/proc/meminfo`)
- CPU temperature (multi-source detection)
- Battery status with emoji indicators
- Network speed (delta-based from `/proc/net/dev`)
- Configurable update interval
- Toggle visibility per metric
@@ -0,0 +1,128 @@
# Contributor Covenant Code of Conduct
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.
## Our Standards
Examples of behavior that contributes to a positive environment for our
community include:
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
overall community
Examples of unacceptable behavior include:
* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Enforcement Responsibilities
Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.
Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.
## Scope
This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
yassine.amjad001@gmail.com.
All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the
reporter of any incident.
## Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:
### 1. Correction
**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.
**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.
### 2. Warning
**Community Impact**: A violation through a single incident or series
of actions.
**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.
### 3. Temporary Ban
**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.
**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.
### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within
the community.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.
@@ -0,0 +1,75 @@
# Contributing to KVitals
Thanks for your interest in contributing! Here's how to get started.
## Development Setup
1. **Clone the repo**
```bash
git clone https://github.com/yassine20011/kvitals.git
cd kvitals
```
2. **Install the widget locally**
```bash
bash install.sh
```
3. **Test changes** — After editing QML files, reinstall:
```bash
bash install.sh
```
Then restart the widget (remove & re-add to panel) or log out / log in.
## Project Structure
```
kvitals/
├── metadata.json # Plugin metadata (version, name, etc.)
├── contents/
│ ├── ui/
│ │ ├── main.qml # Main widget UI
│ │ └── configGeneral.qml # Settings page
│ ├── config/
│ │ └── config.qml # Config entry point
├── install.sh # Local install script
├── install-remote.sh # Remote install (curl/wget)
└── package.sh # Build .plasmoid package
```
## Commit Messages
Use conventional commit prefixes:
- `feat:` — New feature (e.g. `feat: add GPU temperature monitoring`)
- `fix:` — Bug fix (e.g. `fix: handle missing thermal zones`)
- `docs:` — Documentation only (e.g. `docs: update install instructions`)
- `refactor:` — Code restructuring without behavior change
- `chore:` — Build scripts, CI, tooling
## Submitting a Pull Request
1. Fork the repo and create a branch: `git checkout -b feat/my-feature`
2. Make your changes and test locally on Plasma 6
3. Commit with a clear message following the conventions above
4. Push and open a PR against `master`
5. In the PR description, mention:
- What the change does
- Your Plasma version and distro
- Screenshots if it's a visual change
## Reporting Bugs
Please use the [bug report template](https://github.com/yassine20011/kvitals/issues/new?template=bug_report.md) and include:
- Your **Plasma version** (`plasmashell --version`)
- Your **distro** and version
- Steps to reproduce
- Expected vs actual behavior
## Feature Requests
Use the [feature request template](https://github.com/yassine20011/kvitals/issues/new?template=feature_request.md).
## License
By contributing, you agree that your contributions will be licensed under the [GPL-3.0 License](LICENSE).
@@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.
@@ -0,0 +1,105 @@
# KVitals
A lightweight KDE Plasma 6 panel widget that displays live system vitals directly in your top bar.
```
CPU: 26% | RAM: 8.8/39.0G | TEMP: 96°C | 🔋BAT: 78% | PWR: +20W | NET: ↓82.2K ↑58.9K
```
## Screenshots
<div align="center">
<img src="screenshots/demo.gif" alt="Demo">
</div>
## Features
- **Live monitoring** — CPU usage, RAM, CPU temperature, GPU metrics (when available), battery status, power draw, network speed, disk I/O, fan speeds
- **Display modes** — Text, Icons, Icons + Text, or None (values only) for the panel view
- **Custom icons** — Pick any icon from your installed theme for each metric
- **Font customization** — Choose any system font and size
- **Configurable** — Toggle each metric, adjust refresh rate, tune colors, organized in 4 settings tabs
- **Minimal footprint** — Native KDE KSysGuard sensors + QML, no heavy dependencies or excessive subprocesses
- **Click to expand** — Detailed popup view with all stats
## Requirements
- KDE Plasma 6.0+
## Installation
### KDE Store (Recommended)
Install directly from the KDE Store:
👉 **[Get KVitals on the KDE Store](https://www.pling.com/p/2347917/)**
Or from within KDE Plasma:
1. Right-click on the panel → **Add Widgets...**
2. Click **Get New Widgets...** → **Download New Plasma Widgets...**
3. Search for **"KVitals"**
4. Click **Install**
---
### Quick Install (curl)
```bash
curl -fsSL https://github.com/yassine20011/kvitals/releases/latest/download/install-remote.sh | bash
```
### Quick Install (wget)
```bash
wget -qO- https://github.com/yassine20011/kvitals/releases/latest/download/install-remote.sh | bash
```
### Manual Install
```bash
git clone https://github.com/yassine20011/kvitals.git
cd kvitals
bash install.sh
```
Then restart Plasma and add the widget:
```bash
plasmashell --replace &
```
1. Right-click on the panel → **Add Widgets...**
2. Search for **KVitals**
3. Drag it onto your panel
## Configuration
Right-click the widget → **Configure KVitals...** to access settings in four tabs:
- **General** — Display mode, layout, icon size, font, update interval
- **Metrics** — Toggle CPU, RAM, Temperature, GPU, Battery, Power, Network, Disk, Fan
- **Icons** — Customize icons for each metric from your theme
- **Colors** — Set custom font colors and optional threshold-based metric colors
See the [full configuration reference](docs/configuration.md) for details.
## Uninstall
```bash
rm -rf ~/.local/share/plasma/plasmoids/org.kde.plasma.kvitals
```
Then restart Plasma: `plasmashell --replace &`
## Documentation
- [Installation](docs/installation.md)
- [Configuration](docs/configuration.md)
- [Architecture](docs/architecture.md)
- [Contributing](docs/contributing.md)
- [Troubleshooting](docs/troubleshooting.md)
## License
By contributing, you agree that your contributions will be licensed under the [GPL-3.0 License](LICENSE).
@@ -0,0 +1,78 @@
# KVitals Roadmap
This roadmap outlines planned features and improvements. It is not a strict commitment—priorities may shift based on community feedback and contributions.
Have a suggestion? Open an issue or start a discussion on GitHub.
---
## Currently Supported Metrics
- CPU Usage
- CPU Temperature
- CPU Frequency
- RAM Usage
- GPU (Usage, VRAM, Temperature) — with multi-GPU and custom labels
- Battery & Power Consumption
- Network Speed (Download/Upload)
- Disk I/O (Read/Write rates)
- Disk Temperature (highest across all NVMe/SATA drives)
---
## Currently Supported UX Features
- Custom metric order (drag to reorder)
- Per-metric compact panel visibility toggle
- Metric grouping (merge CPU+Temp, Battery+Power, split GPU)
- Threshold-based coloring (warning/critical per metric)
- Custom font color
- Display modes: Text, Icons, Icons+Text
- Horizontal / Vertical layout
- **Unit Preferences** (°C/°F, Bytes/Bits)
---
## Planned
### New Metrics
#### KSystemStats Sensors
These sensors are exposed by `ksystemstats` and are planned for future releases:
- **Disk Usage** — Used/free space per partition via `disk/all/usedPercent` or per-disk breakdown
- **CPU Load Averages** — 1, 5, and 15-minute averages via `cpu/loadaverages/*`
- **Swap Usage** — Used/total swap memory via `memory/swap/*`
- **GPU Frequency & Power** — Core frequency and power draw via `gpu/<device>/coreFrequency` and `gpu/<device>/power`
- **Battery Health** — Degradation percentage via `power/<device>/health`
- **System Uptime** — Via `os/system/uptime`
#### External Sensors (lmsensors)
These require `lmsensors` to be installed and configured:
- **Fan Speed** — CPU fan RPM (where available)
### UX & Configuration
- **Per-metric custom label** — Let users rename metric labels (e.g. "CPU" → "Processor")
- **Tooltip customization** — Choose which metrics appear in the hover tooltip
- **Click action** — Configure what happens when clicking the widget (e.g. open System Monitor)
---
## Under Consideration
These are ideas being evaluated — no commitment yet:
- **Per-core view** — Individual core usage/temperature in the popup
- **Pressure metrics (PSI)** — CPU/IO/Memory pressure via Linux PSI interface
- **Wayland multi-screen** — Better handling across multiple monitors
- **Tray icon mode** — Minimal system tray alternative to panel widget
---
## Not Planned
- Graphs or charts in the compact panel (out of scope for a panel widget)
@@ -0,0 +1,81 @@
# Security Policy
## Official Distribution Channels
KVitals is distributed through the following **official channels**:
### 1. **KDE Store** (Recommended)
- **URL**: https://www.pling.com/p/2347917/
- **Installation**: Via KDE Plasma widget installer (Right-click panel → Add Widgets → Download New Plasma Widgets)
- **Verification**: Installed directly from the official KDE Plasma store
### 2. **GitHub Releases**
- **URL**: https://github.com/yassine20011/kvitals/releases
- **Installation**: `curl` or `wget` scripts from official releases
- **Verification**: Source code available for review at https://github.com/yassine20011/kvitals
### 3. **Git Clone** (Source)
- **Repository**: https://github.com/yassine20011/kvitals.git
- **Installation**: `bash install.sh` from cloned repository
- **Verification**: Full source code transparency; review commits and tags
## Community-Maintained Packages
### **AUR**
- **Package**: `plasma6-applets-kvitals-git`
- **Status**: Community-maintained package, not officially maintained by the KVitals project.
- **Verification**: Check the AUR package maintainer; review PKGBUILD for any modifications
## What to Avoid
⚠️ **Avoid installing KVitals from**:
- Unofficial forks or repackaged versions not listed above
- Third-party websites or app stores not listed above
- Modified or patched versions from unknown sources
If you encounter a suspicious KVitals package or fork, please report it to me via GitHub.
## Reporting Security Vulnerabilities
If you discover a security vulnerability in KVitals, **do not** open a public GitHub issue. Instead:
### Recommended: GitHub Security Advisory
1. Go to https://github.com/yassine20011/kvitals/security/advisories
2. Click **Report a vulnerability**
3. Provide details about the vulnerability
This allows for responsible disclosure and coordinated patching before public disclosure.
### Alternative: Direct Contact
For sensitive issues, use the email fallback below rather than a public GitHub comment or issue.
### What to Include
- Clear description of the vulnerability
- Steps to reproduce (if applicable)
- Potential impact or severity
- Suggested fix (if you have one)
**Please allow reasonable time for investigation and coordinated disclosure before public disclosure.**
## Code Verification
KVitals is written in **QML** (Qt Markup Language) and distributed as open source without bundled compiled binaries. To verify authenticity:
1. Clone the official repository:
```bash
git clone https://github.com/yassine20011/kvitals.git
```
2. Review the source code:
- All widget logic is in `contents/ui/` (human-readable QML)
- Configuration is in `contents/config/`
- No obfuscated or minified code
3. Install from your reviewed source:
```bash
bash install.sh
```
## Questions or Concerns?
For security-related questions or concerns, please use the GitHub Security Advisory flow first. If you need a direct fallback, contact me by email at [Yassine.amjad001@gmail.com](mailto:Yassine.amjad001@gmail.com).
@@ -0,0 +1,26 @@
import QtQuick 2.0
import org.kde.plasma.configuration 2.0
ConfigModel {
ConfigCategory {
name: i18n("General")
icon: "configure"
source: "configGeneral.qml"
}
ConfigCategory {
name: i18n("Metrics")
icon: "view-statistics"
source: "configMetrics.qml"
}
ConfigCategory {
name: i18n("Icons")
icon: "preferences-desktop-icons"
source: "configIcons.qml"
}
ConfigCategory {
name: i18n("Colors")
icon: "color-management"
source: "configColors.qml"
}
}
@@ -0,0 +1,209 @@
<?xml version="1.0" encoding="UTF-8"?>
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0 http://www.kde.org/standards/kcfg/1.0/kcfg.xsd">
<kcfgfile name=""/>
<group name="General">
<entry name="showCpu" type="Bool">
<default>true</default>
</entry>
<entry name="showCpuFreq" type="Bool">
<default>false</default>
</entry>
<entry name="showRam" type="Bool">
<default>true</default>
</entry>
<entry name="showTemp" type="Bool">
<default>true</default>
</entry>
<entry name="showGpu" type="Bool">
<default>true</default>
</entry>
<entry name="showBattery" type="Bool">
<default>true</default>
</entry>
<entry name="showPower" type="Bool">
<default>true</default>
</entry>
<entry name="showNetwork" type="Bool">
<default>true</default>
</entry>
<entry name="showDisk" type="Bool">
<default>false</default>
</entry>
<entry name="showFan" type="Bool">
<default>false</default>
</entry>
<entry name="compactShowCpu" type="Bool">
<default>true</default>
</entry>
<entry name="compactShowRam" type="Bool">
<default>true</default>
</entry>
<entry name="compactShowTemp" type="Bool">
<default>true</default>
</entry>
<entry name="compactShowGpu" type="Bool">
<default>true</default>
</entry>
<entry name="compactShowBattery" type="Bool">
<default>true</default>
</entry>
<entry name="compactShowPower" type="Bool">
<default>true</default>
</entry>
<entry name="compactShowNetwork" type="Bool">
<default>true</default>
</entry>
<entry name="compactShowDisk" type="Bool">
<default>false</default>
</entry>
<entry name="compactShowFan" type="Bool">
<default>false</default>
</entry>
<entry name="networkInterface" type="String">
<default>auto</default>
</entry>
<entry name="batteryDevice" type="String">
<default>auto</default>
</entry>
<entry name="gpuSelection" type="String">
<default></default>
</entry>
<entry name="gpuLabels" type="String">
<default></default>
</entry>
<entry name="displayMode" type="String">
<default>text</default>
</entry>
<entry name="layoutType" type="String">
<default>horizontal</default>
</entry>
<entry name="mergeCpuTemp" type="Bool">
<default>false</default>
</entry>
<entry name="mergeCpuFreq" type="Bool">
<default>false</default>
</entry>
<entry name="mergeBatPwr" type="Bool">
<default>false</default>
</entry>
<entry name="splitGpu" type="Bool">
<default>false</default>
</entry>
<entry name="gpuMetrics" type="String">
<default></default>
</entry>
<entry name="iconSize" type="Int">
<default>12</default>
</entry>
<entry name="cpuIcon" type="String">
<default>cpu</default>
</entry>
<entry name="ramIcon" type="String">
<default>memory</default>
</entry>
<entry name="tempIcon" type="String">
<default>temperature-normal</default>
</entry>
<entry name="gpuIcon" type="String">
<default>video-card</default>
</entry>
<entry name="batteryIcon" type="String">
<default>battery-good</default>
</entry>
<entry name="powerIcon" type="String">
<default>battery-charging-60</default>
</entry>
<entry name="networkIcon" type="String">
<default>network-wireless</default>
</entry>
<entry name="diskIcon" type="String">
<default>drive-harddisk</default>
</entry>
<entry name="fanIcon" type="String">
<default>fan</default>
</entry>
<entry name="fontFamily" type="String">
<default>monospace</default>
</entry>
<entry name="fontSize" type="Int">
<default>0</default>
</entry>
<entry name="fontBold" type="Bool">
<default>false</default>
</entry>
<entry name="metricOrder" type="String">
<default>cpu,ram,temp,gpu,bat,pwr,net,disk,fan</default>
</entry>
<entry name="updateInterval" type="Int">
<default>2000</default>
</entry>
<entry name="useCustomColors" type="Bool">
<default>false</default>
</entry>
<entry name="fontColor" type="String">
<default></default>
</entry>
<entry name="enableThresholdColors" type="Bool">
<default>false</default>
</entry>
<entry name="warningColor" type="String">
<default>#e5a50a</default>
</entry>
<entry name="criticalColor" type="String">
<default>#da4453</default>
</entry>
<entry name="cpuWarningThreshold" type="Int">
<default>70</default>
</entry>
<entry name="cpuCriticalThreshold" type="Int">
<default>90</default>
</entry>
<entry name="tempWarningThreshold" type="Int">
<default>60</default>
</entry>
<entry name="tempCriticalThreshold" type="Int">
<default>85</default>
</entry>
<entry name="ramWarningThreshold" type="Int">
<default>70</default>
</entry>
<entry name="ramCriticalThreshold" type="Int">
<default>90</default>
</entry>
<entry name="gpuWarningThreshold" type="Int">
<default>70</default>
</entry>
<entry name="gpuCriticalThreshold" type="Int">
<default>90</default>
</entry>
<entry name="gpuTempWarningThreshold" type="Int">
<default>60</default>
</entry>
<entry name="gpuTempCriticalThreshold" type="Int">
<default>85</default>
</entry>
<entry name="batteryWarningThreshold" type="Int">
<default>30</default>
</entry>
<entry name="batteryCriticalThreshold" type="Int">
<default>15</default>
</entry>
<entry name="diskTempWarningThreshold" type="Int">
<default>45</default>
</entry>
<entry name="diskTempCriticalThreshold" type="Int">
<default>60</default>
</entry>
<entry name="tempUnit" type="String">
<default>C</default>
</entry>
<entry name="networkUnit" type="String">
<default>bytes</default>
</entry>
<entry name="fanUnit" type="String">
<default>rpm</default>
</entry>
</group>
</kcfg>
@@ -0,0 +1,211 @@
import QtQuick
import QtQuick.Layouts
import org.kde.plasma.components as PlasmaComponents
import org.kde.kirigami as Kirigami
RowLayout {
id: compactRow
spacing: Kirigami.Units.smallSpacing
required property var metricsModel
required property bool useIcons
required property bool useText
required property int effectiveFontSize
required property string fontFamily
required property bool fontBold
required property int iconSize
required property color baseTextColor
required property string layoutType
readonly property bool isVertical: layoutType === "vertical"
signal toggleExpanded()
TapHandler {
onTapped: compactRow.toggleExpanded()
}
// Shared segments renderer
component SegmentsRow: Row {
required property var segments
spacing: 2
Repeater {
model: segments
delegate: Row {
required property var modelData
required property int index
spacing: 2
PlasmaComponents.Label {
visible: index > 0
text: "·"
font.pixelSize: compactRow.effectiveFontSize
font.family: compactRow.fontFamily
font.bold: compactRow.fontBold
color: compactRow.baseTextColor
opacity: 0.5
}
PlasmaComponents.Label {
text: modelData.value
font.pixelSize: compactRow.effectiveFontSize
font.family: compactRow.fontFamily
font.bold: compactRow.fontBold
color: modelData.color
}
}
}
}
Repeater {
model: compactRow.metricsModel
delegate: Item {
required property var modelData
required property int index
implicitWidth: loader.implicitWidth
implicitHeight: loader.implicitHeight
Loader {
id: loader
anchors.fill: parent
sourceComponent: compactRow.isVertical ? verticalDelegate : horizontalDelegate
property var itemData: modelData
property int itemIndex: index
}
}
}
// ── Horizontal delegate (unchanged behaviour) ──────────────────────────
Component {
id: horizontalDelegate
RowLayout {
spacing: 2
Layout.fillHeight: true
PlasmaComponents.Label {
visible: itemIndex > 0 && !itemData.hideSeparator
text: "|"
font.pixelSize: compactRow.effectiveFontSize
font.family: compactRow.fontFamily
color: compactRow.baseTextColor
opacity: 0.4
Layout.alignment: Qt.AlignVCenter
}
Kirigami.Icon {
visible: compactRow.useIcons
source: itemData.icon
isMask: true
Layout.preferredWidth: compactRow.iconSize
Layout.preferredHeight: compactRow.iconSize
Layout.alignment: Qt.AlignVCenter
}
PlasmaComponents.Label {
visible: compactRow.useText
text: itemData.label
font.pixelSize: compactRow.effectiveFontSize
font.family: compactRow.fontFamily
color: compactRow.baseTextColor
Layout.alignment: Qt.AlignVCenter
}
PlasmaComponents.Label {
visible: !itemData.segments
text: itemData.value || ""
font.pixelSize: compactRow.effectiveFontSize
font.family: compactRow.fontFamily
font.bold: compactRow.fontBold
color: itemData.color || compactRow.baseTextColor
Layout.alignment: Qt.AlignVCenter
}
SegmentsRow {
visible: !!itemData.segments
segments: itemData.segments || []
Layout.alignment: Qt.AlignVCenter
}
}
}
// ── Vertical delegate (value on top, icon+label below) ─────────────────
Component {
id: verticalDelegate
RowLayout {
spacing: Kirigami.Units.smallSpacing
Layout.fillHeight: true
// Thin line separator between metrics
Rectangle {
visible: itemIndex > 0 && !itemData.hideSeparator
width: 1
Layout.fillHeight: true
color: compactRow.baseTextColor
opacity: 0.2
}
ColumnLayout {
spacing: 1
Layout.alignment: Qt.AlignVCenter
// Top: value(s)
RowLayout {
spacing: 0
Layout.alignment: Qt.AlignHCenter
PlasmaComponents.Label {
visible: !itemData.segments
text: itemData.value || ""
font.pixelSize: compactRow.effectiveFontSize
font.family: compactRow.fontFamily
font.bold: compactRow.fontBold
color: itemData.color || compactRow.baseTextColor
horizontalAlignment: Text.AlignHCenter
}
SegmentsRow {
visible: !!itemData.segments
segments: itemData.segments || []
Layout.alignment: Qt.AlignHCenter
}
}
// Bottom: icon + label
RowLayout {
visible: compactRow.useIcons || compactRow.useText
spacing: 2
Layout.alignment: Qt.AlignHCenter
Kirigami.Icon {
visible: compactRow.useIcons
source: itemData.icon
isMask: true
Layout.preferredWidth: Math.round(compactRow.iconSize * 0.85)
Layout.preferredHeight: Math.round(compactRow.iconSize * 0.85)
Layout.alignment: Qt.AlignVCenter
}
PlasmaComponents.Label {
visible: compactRow.useText
text: {
var lbl = itemData.label || "";
return lbl.endsWith(":") ? lbl.slice(0, -1) : lbl;
}
font.pixelSize: Math.max(8, compactRow.effectiveFontSize - 2)
font.family: compactRow.fontFamily
color: compactRow.baseTextColor
opacity: 0.65
Layout.alignment: Qt.AlignVCenter
}
}
}
}
}
}
@@ -0,0 +1,48 @@
import QtQuick
import QtQuick.Layouts
import org.kde.plasma.components as PlasmaComponents
import org.kde.kirigami as Kirigami
ColumnLayout {
id: fullView
spacing: Kirigami.Units.smallSpacing
Layout.preferredWidth: Kirigami.Units.gridUnit * 18
Layout.preferredHeight: Kirigami.Units.gridUnit * 12
required property var metricsModel
required property color baseTextColor
required property bool fontBold
PlasmaComponents.Label {
text: "KVitals"
font.bold: true // intentional: title always bold for visual hierarchy
font.pixelSize: Kirigami.Theme.defaultFont.pixelSize * 1.2
Layout.alignment: Qt.AlignHCenter
Layout.bottomMargin: Kirigami.Units.smallSpacing
}
Repeater {
model: fullView.metricsModel
delegate: RowLayout {
required property var modelData
Layout.fillWidth: true
Layout.leftMargin: Kirigami.Units.largeSpacing
Layout.rightMargin: Kirigami.Units.largeSpacing
PlasmaComponents.Label {
text: modelData.label
color: fullView.baseTextColor
opacity: 0.7
Layout.fillWidth: true
}
PlasmaComponents.Label {
text: modelData.value
font.bold: fullView.fontBold
color: modelData.color
horizontalAlignment: Text.AlignRight
}
}
}
}
@@ -0,0 +1,425 @@
import QtQuick 2.0
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.0
import Qt.labs.platform 1.0 as Platform
import org.kde.kirigami 2.5 as Kirigami
import org.kde.kcmutils as KCM
import "./sensors"
KCM.SimpleKCM {
id: colorsPage
property alias cfg_useCustomColors: useCustomColorsCheck.checked
property string cfg_fontColor
property alias cfg_enableThresholdColors: enableThresholdCheck.checked
property string cfg_warningColor: "#e5a50a"
property string cfg_criticalColor: "#da4453"
property alias cfg_cpuWarningThreshold: cpuWarnSlider.value
property alias cfg_cpuCriticalThreshold: cpuCritSlider.value
property alias cfg_tempWarningThreshold: tempWarnSlider.value
property alias cfg_tempCriticalThreshold: tempCritSlider.value
property alias cfg_ramWarningThreshold: ramWarnSlider.value
property alias cfg_ramCriticalThreshold: ramCritSlider.value
property alias cfg_gpuWarningThreshold: gpuWarnSlider.value
property alias cfg_gpuCriticalThreshold: gpuCritSlider.value
property alias cfg_gpuTempWarningThreshold: gpuTempWarnSlider.value
property alias cfg_gpuTempCriticalThreshold: gpuTempCritSlider.value
property alias cfg_batteryWarningThreshold: batWarnSlider.value
property alias cfg_batteryCriticalThreshold: batCritSlider.value
property alias cfg_diskTempWarningThreshold: diskTempWarnSlider.value
property alias cfg_diskTempCriticalThreshold: diskTempCritSlider.value
readonly property string defaultWarningColor: "#e5a50a"
readonly property string defaultCriticalColor: "#da4453"
property string cfg_tempUnit: "C"
function isRgbHex(value) {
return /^#[0-9A-Fa-f]{6}$/.test(value)
}
function colorToRgbHex(colorValue) {
if (!colorValue || colorValue.r === undefined || colorValue.g === undefined || colorValue.b === undefined) {
return ""
}
function channelToHex(channel) {
const value = Math.max(0, Math.min(255, Math.round(channel * 255)))
return value.toString(16).padStart(2, "0")
}
return "#" + channelToHex(colorValue.r) + channelToHex(colorValue.g) + channelToHex(colorValue.b)
}
function openColorDialog(dialog, value, fallbackColor) {
const initialColor = isRgbHex(value) ? value : fallbackColor
dialog.color = initialColor
dialog.currentColor = initialColor
dialog.open()
}
Kirigami.FormLayout {
// === Section: Custom Font Color ===
Kirigami.Separator {
Kirigami.FormData.isSection: true
Kirigami.FormData.label: i18n("Font Color")
}
CheckBox {
id: useCustomColorsCheck
Kirigami.FormData.label: i18n("Use custom font color:")
}
RowLayout {
Kirigami.FormData.label: i18n("Color:")
enabled: cfg_useCustomColors
spacing: Kirigami.Units.smallSpacing
Button {
id: fontColorButton
text: ""
padding: 0
implicitWidth: Kirigami.Units.gridUnit * 2
implicitHeight: Kirigami.Units.gridUnit * 1.5
onClicked: colorsPage.openColorDialog(fontColorDialog, cfg_fontColor, Kirigami.Theme.textColor)
background: Rectangle {
radius: 4
border.width: 1
border.color: fontColorButton.visualFocus ? Kirigami.Theme.highlightColor : Qt.rgba(1, 1, 1, 0.15)
color: "transparent"
Rectangle {
anchors.fill: parent
anchors.margins: 2
radius: 3
color: colorsPage.isRgbHex(cfg_fontColor) ? cfg_fontColor : Kirigami.Theme.textColor
}
}
}
Platform.ColorDialog {
id: fontColorDialog
title: i18n("Choose Font Color")
parentWindow: colorsPage.Window.window
onAccepted: {
const hex = colorsPage.colorToRgbHex(color)
if (!hex) {
return
}
if (hex !== fontColorField.text) {
fontColorField.text = hex
}
cfg_fontColor = hex
}
}
TextField {
id: fontColorField
placeholderText: "#ffffff"
text: cfg_fontColor
maximumLength: 7
Layout.preferredWidth: 100
onTextChanged: {
if (/^#[0-9A-Fa-f]{6}$/.test(text))
cfg_fontColor = text
}
}
Button {
text: i18n("Reset")
icon.name: "edit-undo"
onClicked: { fontColorField.text = ""; cfg_fontColor = "" }
}
}
// === Section: Threshold Colors ===
Kirigami.Separator {
Kirigami.FormData.isSection: true
Kirigami.FormData.label: i18n("Threshold Colors")
}
CheckBox {
id: enableThresholdCheck
Kirigami.FormData.label: i18n("Enable threshold coloring:")
}
RowLayout {
Kirigami.FormData.label: i18n("Warning color:")
enabled: cfg_enableThresholdColors
spacing: Kirigami.Units.smallSpacing
Button {
id: warningColorButton
text: ""
padding: 0
implicitWidth: Kirigami.Units.gridUnit * 2
implicitHeight: Kirigami.Units.gridUnit * 1.5
onClicked: colorsPage.openColorDialog(warningColorDialog, cfg_warningColor, colorsPage.defaultWarningColor)
background: Rectangle {
radius: 4
border.width: 1
border.color: warningColorButton.visualFocus ? Kirigami.Theme.highlightColor : Qt.rgba(1, 1, 1, 0.15)
color: "transparent"
Rectangle {
anchors.fill: parent
anchors.margins: 2
radius: 3
color: colorsPage.isRgbHex(cfg_warningColor) ? cfg_warningColor : colorsPage.defaultWarningColor
}
}
}
Platform.ColorDialog {
id: warningColorDialog
title: i18n("Choose Warning Color")
parentWindow: colorsPage.Window.window
onAccepted: {
const hex = colorsPage.colorToRgbHex(color)
if (!hex) {
return
}
if (hex !== warningColorField.text) {
warningColorField.text = hex
}
cfg_warningColor = hex
}
}
TextField {
id: warningColorField
text: cfg_warningColor
maximumLength: 7
Layout.preferredWidth: 100
onTextChanged: {
if (/^#[0-9A-Fa-f]{6}$/.test(text))
cfg_warningColor = text
}
}
}
RowLayout {
Kirigami.FormData.label: i18n("Critical color:")
enabled: cfg_enableThresholdColors
spacing: Kirigami.Units.smallSpacing
Button {
id: criticalColorButton
text: ""
padding: 0
implicitWidth: Kirigami.Units.gridUnit * 2
implicitHeight: Kirigami.Units.gridUnit * 1.5
onClicked: colorsPage.openColorDialog(criticalColorDialog, cfg_criticalColor, colorsPage.defaultCriticalColor)
background: Rectangle {
radius: 4
border.width: 1
border.color: criticalColorButton.visualFocus ? Kirigami.Theme.highlightColor : Qt.rgba(1, 1, 1, 0.15)
color: "transparent"
Rectangle {
anchors.fill: parent
anchors.margins: 2
radius: 3
color: colorsPage.isRgbHex(cfg_criticalColor) ? cfg_criticalColor : colorsPage.defaultCriticalColor
}
}
}
Platform.ColorDialog {
id: criticalColorDialog
title: i18n("Choose Critical Color")
parentWindow: colorsPage.Window.window
onAccepted: {
const hex = colorsPage.colorToRgbHex(color)
if (!hex) {
return
}
if (hex !== criticalColorField.text) {
criticalColorField.text = hex
}
cfg_criticalColor = hex
}
}
TextField {
id: criticalColorField
text: cfg_criticalColor
maximumLength: 7
Layout.preferredWidth: 100
onTextChanged: {
if (/^#[0-9A-Fa-f]{6}$/.test(text))
cfg_criticalColor = text
}
}
}
// === Section: Thresholds Grid ===
Kirigami.Separator {
Kirigami.FormData.isSection: true
Kirigami.FormData.label: i18n("Thresholds")
visible: cfg_enableThresholdColors
}
GridLayout {
visible: cfg_enableThresholdColors
columns: 4
columnSpacing: Kirigami.Units.largeSpacing
rowSpacing: Kirigami.Units.smallSpacing
Layout.fillWidth: true
// --- Header ---
Label { text: "" }
Label { text: i18n("Warning"); font.bold: true; horizontalAlignment: Text.AlignHCenter; Layout.fillWidth: true }
Label { text: i18n("Critical"); font.bold: true; horizontalAlignment: Text.AlignHCenter; Layout.fillWidth: true }
Label { text: "" }
// --- CPU Usage ---
Label { text: i18n("CPU Usage") }
RowLayout {
Layout.fillWidth: true
Slider { id: cpuWarnSlider; from: 10; to: 100; stepSize: 5; value: 70; Layout.fillWidth: true }
Label { text: Math.round(cpuWarnSlider.value) + "%"; Layout.preferredWidth: 40 }
}
RowLayout {
Layout.fillWidth: true
Slider { id: cpuCritSlider; from: 10; to: 100; stepSize: 5; value: 90; Layout.fillWidth: true }
Label { text: Math.round(cpuCritSlider.value) + "%"; Layout.preferredWidth: 40 }
}
Rectangle { Layout.preferredWidth: 10; Layout.preferredHeight: 10; radius: 5; color: cpuWarnSlider.value >= cpuCritSlider.value ? cfg_criticalColor : "transparent" }
// --- CPU Temperature ---
Label { text: i18n("CPU Temp") }
RowLayout {
Layout.fillWidth: true
Slider { id: tempWarnSlider; from: 30; to: 110; stepSize: 5; value: 60; Layout.fillWidth: true }
Label { text: Utils.formatTemp(tempWarnSlider.value, cfg_tempUnit); Layout.preferredWidth: 40 }
}
RowLayout {
Layout.fillWidth: true
Slider { id: tempCritSlider; from: 30; to: 110; stepSize: 5; value: 85; Layout.fillWidth: true }
Label { text: Utils.formatTemp(tempCritSlider.value, cfg_tempUnit); Layout.preferredWidth: 40 }
}
Rectangle { Layout.preferredWidth: 10; Layout.preferredHeight: 10; radius: 5; color: tempWarnSlider.value >= tempCritSlider.value ? cfg_criticalColor : "transparent" }
// --- RAM Usage ---
Label { text: i18n("RAM Usage") }
RowLayout {
Layout.fillWidth: true
Slider { id: ramWarnSlider; from: 10; to: 100; stepSize: 5; value: 70; Layout.fillWidth: true }
Label { text: Math.round(ramWarnSlider.value) + "%"; Layout.preferredWidth: 40 }
}
RowLayout {
Layout.fillWidth: true
Slider { id: ramCritSlider; from: 10; to: 100; stepSize: 5; value: 90; Layout.fillWidth: true }
Label { text: Math.round(ramCritSlider.value) + "%"; Layout.preferredWidth: 40 }
}
Rectangle { Layout.preferredWidth: 10; Layout.preferredHeight: 10; radius: 5; color: ramWarnSlider.value >= ramCritSlider.value ? cfg_criticalColor : "transparent" }
// --- GPU Usage ---
Label { text: i18n("GPU Usage") }
RowLayout {
Layout.fillWidth: true
Slider { id: gpuWarnSlider; from: 10; to: 100; stepSize: 5; value: 70; Layout.fillWidth: true }
Label { text: Math.round(gpuWarnSlider.value) + "%"; Layout.preferredWidth: 40 }
}
RowLayout {
Layout.fillWidth: true
Slider { id: gpuCritSlider; from: 10; to: 100; stepSize: 5; value: 90; Layout.fillWidth: true }
Label { text: Math.round(gpuCritSlider.value) + "%"; Layout.preferredWidth: 40 }
}
Rectangle { Layout.preferredWidth: 10; Layout.preferredHeight: 10; radius: 5; color: gpuWarnSlider.value >= gpuCritSlider.value ? cfg_criticalColor : "transparent" }
// --- GPU Temperature ---
Label { text: i18n("GPU Temp") }
RowLayout {
Layout.fillWidth: true
Slider { id: gpuTempWarnSlider; from: 30; to: 110; stepSize: 5; value: 60; Layout.fillWidth: true }
Label { text: Utils.formatTemp(gpuTempWarnSlider.value, cfg_tempUnit); Layout.preferredWidth: 40 }
}
RowLayout {
Layout.fillWidth: true
Slider { id: gpuTempCritSlider; from: 30; to: 110; stepSize: 5; value: 85; Layout.fillWidth: true }
Label { text: Utils.formatTemp(gpuTempCritSlider.value, cfg_tempUnit); Layout.preferredWidth: 40 }
}
Rectangle { Layout.preferredWidth: 10; Layout.preferredHeight: 10; radius: 5; color: gpuTempWarnSlider.value >= gpuTempCritSlider.value ? cfg_criticalColor : "transparent" }
// --- Battery (inverted) ---
Label { text: i18n("Battery ↓") }
RowLayout {
Layout.fillWidth: true
Slider { id: batWarnSlider; from: 5; to: 60; stepSize: 5; value: 30; Layout.fillWidth: true }
Label { text: Math.round(batWarnSlider.value) + "%"; Layout.preferredWidth: 40 }
}
RowLayout {
Layout.fillWidth: true
Slider { id: batCritSlider; from: 5; to: 60; stepSize: 5; value: 15; Layout.fillWidth: true }
Label { text: Math.round(batCritSlider.value) + "%"; Layout.preferredWidth: 40 }
}
Rectangle { Layout.preferredWidth: 10; Layout.preferredHeight: 10; radius: 5; color: batWarnSlider.value <= batCritSlider.value ? cfg_criticalColor : "transparent" }
// --- Disk Temperature ---
Label { text: i18n("Disk Temp") }
RowLayout {
Layout.fillWidth: true
Slider { id: diskTempWarnSlider; from: 30; to: 80; stepSize: 5; value: 45; Layout.fillWidth: true }
Label { text: Utils.formatTemp(diskTempWarnSlider.value, cfg_tempUnit); Layout.preferredWidth: 40 }
}
RowLayout {
Layout.fillWidth: true
Slider { id: diskTempCritSlider; from: 30; to: 80; stepSize: 5; value: 60; Layout.fillWidth: true }
Label { text: Utils.formatTemp(diskTempCritSlider.value, cfg_tempUnit); Layout.preferredWidth: 40 }
}
Rectangle { Layout.preferredWidth: 10; Layout.preferredHeight: 10; radius: 5; color: diskTempWarnSlider.value >= diskTempCritSlider.value ? cfg_criticalColor : "transparent" }
}
Label {
visible: cfg_enableThresholdColors
text: i18n("Battery uses inverted thresholds — warning/critical trigger below the set values.\nA red dot means warning ≥ critical (invalid config).")
opacity: 0.6
font.italic: true
wrapMode: Text.WordWrap
Layout.fillWidth: true
}
// --- Reset ---
Kirigami.Separator {
Kirigami.FormData.isSection: true
}
Button {
icon.name: "edit-undo"
text: i18n("Reset all to defaults")
onClicked: {
useCustomColorsCheck.checked = false
fontColorField.text = ""
cfg_fontColor = ""
enableThresholdCheck.checked = false
warningColorField.text = colorsPage.defaultWarningColor
cfg_warningColor = colorsPage.defaultWarningColor
criticalColorField.text = colorsPage.defaultCriticalColor
cfg_criticalColor = colorsPage.defaultCriticalColor
cpuWarnSlider.value = 70; cpuCritSlider.value = 90
tempWarnSlider.value = 60; tempCritSlider.value = 85
ramWarnSlider.value = 70; ramCritSlider.value = 90
gpuWarnSlider.value = 70; gpuCritSlider.value = 90
gpuTempWarnSlider.value = 60; gpuTempCritSlider.value = 85
batWarnSlider.value = 30; batCritSlider.value = 15
diskTempWarnSlider.value = 45; diskTempCritSlider.value = 60
}
}
}
}
@@ -0,0 +1,154 @@
import QtQuick 2.0
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.0
import org.kde.kirigami 2.5 as Kirigami
import org.kde.kcmutils as KCM
KCM.SimpleKCM {
id: configPage
property alias cfg_updateInterval: intervalSlider.value
property alias cfg_iconSize: iconSizeSlider.value
property alias cfg_fontSize: fontSizeSlider.value
property alias cfg_fontBold: fontBoldCheck.checked
property string cfg_displayMode: "text"
property string cfg_fontFamily: "monospace"
property string cfg_layoutType: "horizontal"
property string cfg_tempUnit: "C"
property string cfg_networkUnit: "bytes"
property string cfg_fanUnit: "rpm"
readonly property var displayModes: ["text", "icons", "icons+text", "none"]
readonly property var displayModeLabels: [i18n("Text"), i18n("Icons"), i18n("Icons + Text"), i18n("None")]
readonly property bool iconsEnabled: cfg_displayMode === "icons" || cfg_displayMode === "icons+text"
readonly property var layoutTypes: ["horizontal", "vertical"]
readonly property var layoutTypeLabels: [i18n("Horizontal"), i18n("Vertical")]
Kirigami.FormLayout {
ComboBox {
id: displayModeCombo
Kirigami.FormData.label: i18n("Display mode:")
model: configPage.displayModeLabels
currentIndex: {
var idx = configPage.displayModes.indexOf(cfg_displayMode);
return idx >= 0 ? idx : 0;
}
onActivated: {
cfg_displayMode = configPage.displayModes[currentIndex];
}
}
ComboBox {
id: layoutTypeCombo
Kirigami.FormData.label: i18n("Layout:")
model: configPage.layoutTypeLabels
currentIndex: {
var idx = configPage.layoutTypes.indexOf(cfg_layoutType);
return idx >= 0 ? idx : 0;
}
onActivated: {
cfg_layoutType = configPage.layoutTypes[currentIndex];
}
}
Slider {
id: iconSizeSlider
Kirigami.FormData.label: i18n("Icon size:")
from: 8
to: 24
stepSize: 2
value: 12
visible: configPage.iconsEnabled
}
Label {
text: iconSizeSlider.value + " px"
opacity: 0.7
visible: configPage.iconsEnabled
}
ComboBox {
id: fontFamilyCombo
Kirigami.FormData.label: i18n("Font:")
model: Qt.fontFamilies()
editable: true
currentIndex: {
var families = Qt.fontFamilies();
var idx = families.indexOf(cfg_fontFamily);
return idx >= 0 ? idx : 0;
}
onActivated: {
cfg_fontFamily = currentText;
}
onAccepted: {
cfg_fontFamily = editText;
}
popup.height: 300
}
Slider {
id: fontSizeSlider
Kirigami.FormData.label: i18n("Font size:")
from: 0
to: 24
stepSize: 1
value: 0
}
Label {
text: fontSizeSlider.value === 0 ? i18n("System default") : fontSizeSlider.value + " px"
opacity: 0.7
}
CheckBox {
id: fontBoldCheck
Kirigami.FormData.label: i18n("Bold font:")
text: i18n("Bold")
}
Slider {
id: intervalSlider
Kirigami.FormData.label: i18n("Update interval:")
from: 1000
to: 10000
stepSize: 500
value: 2000
}
Label {
text: (intervalSlider.value / 1000).toFixed(1) + " " + i18n("seconds")
opacity: 0.7
}
Kirigami.Separator {
Kirigami.FormData.isSection: true
Kirigami.FormData.label: i18n("Unit Preferences")
}
ComboBox {
id: tempUnitCombo
Kirigami.FormData.label: i18n("Temperature unit:")
model: [i18n("Celsius (°C)"), i18n("Fahrenheit (°F)")]
currentIndex: cfg_tempUnit === "F" ? 1 : 0
onActivated: cfg_tempUnit = (currentIndex === 1 ? "F" : "C")
}
ComboBox {
id: networkUnitCombo
Kirigami.FormData.label: i18n("Network/Disk I/O unit:")
model: [i18n("Bytes (KB, MB)"), i18n("Bits (Kb, Mb)")]
currentIndex: cfg_networkUnit === "bits" ? 1 : 0
onActivated: cfg_networkUnit = (currentIndex === 1 ? "bits" : "bytes")
}
ComboBox {
id: fanUnitCombo
Kirigami.FormData.label: i18n("Fan Speed unit:")
model: [i18n("RPM"), i18n("Percentage (%)")]
currentIndex: cfg_fanUnit === "percent" ? 1 : 0
onActivated: cfg_fanUnit = (currentIndex === 1 ? "percent" : "rpm")
}
}
}
@@ -0,0 +1,131 @@
import QtQuick 2.0
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.0
import org.kde.kirigami 2.5 as Kirigami
import org.kde.kcmutils as KCM
import org.kde.iconthemes as KIconThemes
KCM.SimpleKCM {
id: iconsPage
property string cfg_cpuIcon: "cpu"
property string cfg_ramIcon: "memory"
property string cfg_tempIcon: "temperature-normal"
property string cfg_gpuIcon: "video-card"
property string cfg_batteryIcon: "battery-good"
property string cfg_powerIcon: "battery-charging-60"
property string cfg_networkIcon: "network-wireless"
property string cfg_diskIcon: "drive-harddisk"
property string cfg_fanIcon: "fan"
KIconThemes.IconDialog {
id: cpuIconDialog
onIconNameChanged: if (iconName) cfg_cpuIcon = iconName
}
KIconThemes.IconDialog {
id: ramIconDialog
onIconNameChanged: if (iconName) cfg_ramIcon = iconName
}
KIconThemes.IconDialog {
id: tempIconDialog
onIconNameChanged: if (iconName) cfg_tempIcon = iconName
}
KIconThemes.IconDialog {
id: gpuIconDialog
onIconNameChanged: if (iconName) cfg_gpuIcon = iconName
}
KIconThemes.IconDialog {
id: batteryIconDialog
onIconNameChanged: if (iconName) cfg_batteryIcon = iconName
}
KIconThemes.IconDialog {
id: powerIconDialog
onIconNameChanged: if (iconName) cfg_powerIcon = iconName
}
KIconThemes.IconDialog {
id: networkIconDialog
onIconNameChanged: if (iconName) cfg_networkIcon = iconName
}
KIconThemes.IconDialog {
id: diskIconDialog
onIconNameChanged: if (iconName) cfg_diskIcon = iconName
}
KIconThemes.IconDialog {
id: fanIconDialog
onIconNameChanged: if (iconName) cfg_fanIcon = iconName
}
Kirigami.FormLayout {
RowLayout {
Kirigami.FormData.label: i18n("CPU:")
Kirigami.Icon { source: cfg_cpuIcon; isMask: true; Layout.preferredWidth: 22; Layout.preferredHeight: 22 }
Button { text: i18n("Change..."); onClicked: cpuIconDialog.open(); icon.name: "document-edit" }
}
RowLayout {
Kirigami.FormData.label: i18n("RAM:")
Kirigami.Icon { source: cfg_ramIcon; isMask: true; Layout.preferredWidth: 22; Layout.preferredHeight: 22 }
Button { text: i18n("Change..."); onClicked: ramIconDialog.open(); icon.name: "document-edit" }
}
RowLayout {
Kirigami.FormData.label: i18n("Temperature:")
Kirigami.Icon { source: cfg_tempIcon; isMask: true; Layout.preferredWidth: 22; Layout.preferredHeight: 22 }
Button { text: i18n("Change..."); onClicked: tempIconDialog.open(); icon.name: "document-edit" }
}
RowLayout {
Kirigami.FormData.label: i18n("GPU:")
Kirigami.Icon { source: cfg_gpuIcon; isMask: true; Layout.preferredWidth: 22; Layout.preferredHeight: 22 }
Button { text: i18n("Change..."); onClicked: gpuIconDialog.open(); icon.name: "document-edit" }
}
RowLayout {
Kirigami.FormData.label: i18n("Battery:")
Kirigami.Icon { source: cfg_batteryIcon; isMask: true; Layout.preferredWidth: 22; Layout.preferredHeight: 22 }
Button { text: i18n("Change..."); onClicked: batteryIconDialog.open(); icon.name: "document-edit" }
}
RowLayout {
Kirigami.FormData.label: i18n("Power:")
Kirigami.Icon { source: cfg_powerIcon; isMask: true; Layout.preferredWidth: 22; Layout.preferredHeight: 22 }
Button { text: i18n("Change..."); onClicked: powerIconDialog.open(); icon.name: "document-edit" }
}
RowLayout {
Kirigami.FormData.label: i18n("Network:")
Kirigami.Icon { source: cfg_networkIcon; isMask: true; Layout.preferredWidth: 22; Layout.preferredHeight: 22 }
Button { text: i18n("Change..."); onClicked: networkIconDialog.open(); icon.name: "document-edit" }
}
RowLayout {
Kirigami.FormData.label: i18n("Disk:")
Kirigami.Icon { source: cfg_diskIcon; isMask: true; Layout.preferredWidth: 22; Layout.preferredHeight: 22 }
Button { text: i18n("Change..."); onClicked: diskIconDialog.open(); icon.name: "document-edit" }
}
RowLayout {
Kirigami.FormData.label: i18n("Fan:")
Kirigami.Icon { source: cfg_fanIcon; isMask: true; Layout.preferredWidth: 22; Layout.preferredHeight: 22 }
Button { text: i18n("Change..."); onClicked: fanIconDialog.open(); icon.name: "document-edit" }
}
Button {
icon.name: "edit-undo"
text: i18n("Reset to defaults")
Kirigami.FormData.label: " "
onClicked: {
cfg_cpuIcon = "cpu";
cfg_ramIcon = "memory";
cfg_tempIcon = "temperature-normal";
cfg_gpuIcon = "video-card";
cfg_batteryIcon = "battery-good";
cfg_powerIcon = "battery-charging-60";
cfg_networkIcon = "network-wireless";
cfg_diskIcon = "drive-harddisk";
cfg_fanIcon = "fan";
}
}
}
}
@@ -0,0 +1,669 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import org.kde.kirigami as Kirigami
import org.kde.kcmutils as KCM
import org.kde.plasma.plasma5support as Plasma5Support
import org.kde.ksysguard.sensors as Sensors
import org.kde.kitemmodels as KItemModels
KCM.SimpleKCM {
id: metricsPage
// --- cfg_ bindings (must match main.xml keys exactly) ---
property bool cfg_showCpu
property bool cfg_showRam
property bool cfg_showTemp
property bool cfg_showGpu
property bool cfg_showBattery
property bool cfg_showPower
property bool cfg_showNetwork
property bool cfg_showDisk
property bool cfg_showFan
property bool cfg_compactShowCpu
property bool cfg_compactShowRam
property bool cfg_compactShowTemp
property bool cfg_compactShowGpu
property bool cfg_compactShowBattery
property bool cfg_compactShowPower
property bool cfg_compactShowNetwork
property bool cfg_compactShowDisk
property bool cfg_compactShowFan
property string cfg_networkInterface: "auto"
property string cfg_batteryDevice
property string cfg_gpuSelection: ""
property string cfg_gpuLabels: ""
property string cfg_metricOrder: "cpu,ram,temp,gpu,bat,pwr,net,disk"
property bool cfg_mergeCpuTemp: false
property bool cfg_mergeCpuFreq: false
property bool cfg_mergeBatPwr: false
property bool cfg_splitGpu: false
property string cfg_gpuMetrics: ""
property bool cfg_showCpuFreq: false
// --- GPU discovery via SensorTreeModel (pure metadata, no polling) ---
Sensors.SensorTreeModel { id: cfgSensorTree }
KItemModels.KDescendantsProxyModel { id: cfgFlatSensors; model: cfgSensorTree }
property var _liveDiscoveredGpus: []
Timer {
id: gpuRefreshDebounce
interval: 100
repeat: false
onTriggered: {
var found = [];
for (var row = 0; row < cfgFlatSensors.rowCount(); row++) {
var idx = cfgFlatSensors.index(row, 0);
var sensorId = cfgFlatSensors.data(idx, Sensors.SensorTreeModel.SensorId);
if (!sensorId || sensorId.length === 0) continue;
var match = sensorId.match(/^gpu\/(gpu\d+)\/usage$/);
if (!match) continue;
found.push({ id: match[1], name: "GPU " + (found.length + 1) });
}
if (JSON.stringify(found) !== JSON.stringify(_liveDiscoveredGpus))
_liveDiscoveredGpus = found;
}
}
function refreshConfigGpus() {
gpuRefreshDebounce.restart();
}
property bool _discoveryDirty: false
Timer {
id: discoveryTimer
interval: 500
repeat: false
running: _discoveryDirty
onTriggered: {
_discoveryDirty = false;
metricsPage.refreshConfigGpus();
}
}
Connections {
target: cfgFlatSensors
function onRowsInserted() { metricsPage._discoveryDirty = true; }
function onRowsRemoved() { metricsPage._discoveryDirty = true; }
function onModelReset() { metricsPage._discoveryDirty = true; }
function onDataChanged() { metricsPage._discoveryDirty = true; }
}
readonly property var discoveredGpus: {
if (_liveDiscoveredGpus.length > 0) return _liveDiscoveredGpus;
if (!cfg_gpuDiscovered) return [];
return cfg_gpuDiscovered.split(",").filter(function(s){ return s.indexOf(":") >= 0; }).map(function(s){
var parts = s.split(":");
return { id: parts[0], name: parts.slice(1).join(":") };
});
}
// --- Network interface discovery ---
property var ifaceList: ["auto"]
Plasma5Support.DataSource {
id: ifaceSource
engine: "executable"
connectedSources: ["ls /sys/class/net/"]
onNewData: function (source, data) {
if (data["exit code"] !== 0) return;
var raw = data["stdout"].trim();
if (raw.length === 0) return;
var ifaces = raw.split("\n").filter(function (name) {
return name !== "lo" && name.length > 0;
});
ifaces.unshift("auto");
metricsPage.ifaceList = ifaces;
}
}
// --- GPU label helpers ---
function parseGpuLabels(str) {
var result = {};
if (!str) return result;
str.split("|").forEach(function(pair) {
var sep = pair.indexOf(":");
if (sep > 0) result[pair.substring(0, sep)] = pair.substring(sep + 1);
});
return result;
}
function saveGpuLabel(gpuId, label) {
var labels = parseGpuLabels(cfg_gpuLabels);
var trimmed = (label || "").trim();
if (trimmed.length > 0) labels[gpuId] = trimmed;
else delete labels[gpuId];
var parts = [];
for (var id in labels) parts.push(id + ":" + labels[id]);
cfg_gpuLabels = parts.join("|");
}
// --- GPU sub-metric helpers ---
function parseGpuMetrics(str) {
var result = {};
if (!str) return result;
str.split("|").forEach(function(pair) {
var sep = pair.indexOf(":");
if (sep <= 0) return;
var id = pair.substring(0, sep);
var metrics = pair.substring(sep + 1).split(",").filter(function(m){
return m === "usage" || m === "vram" || m === "temp";
});
if (metrics.length > 0) result[id] = metrics;
});
return result;
}
function gpuMetricsFor(gpuId) {
var mm = parseGpuMetrics(cfg_gpuMetrics);
return (mm[gpuId] && mm[gpuId].length > 0) ? mm[gpuId] : ["usage", "vram", "temp"];
}
function saveGpuMetric(gpuId, metric, enable) {
var mm = parseGpuMetrics(cfg_gpuMetrics);
var current = mm[gpuId] ? mm[gpuId].slice() : ["usage", "vram", "temp"];
if (enable) {
if (current.indexOf(metric) < 0) current.push(metric);
} else {
if (current.length <= 1) return;
current = current.filter(function(m){ return m !== metric; });
}
var order = ["usage", "vram", "temp"];
current.sort(function(a, b){ return order.indexOf(a) - order.indexOf(b); });
if (current.length === 3) delete mm[gpuId];
else mm[gpuId] = current;
var parts = [];
for (var id in mm) parts.push(id + ":" + mm[id].join(","));
cfg_gpuMetrics = parts.join("|");
}
// --- Metric order helpers ---
readonly property var allKeys: ["cpu", "ram", "temp", "gpu", "bat", "pwr", "net", "disk", "fan"]
readonly property var metricMeta: ({
"cpu": { label: i18n("CPU usage"), icon: "cpu" },
"ram": { label: i18n("RAM usage"), icon: "memory" },
"temp": { label: i18n("CPU temperature"), icon: "temperature-normal" },
"gpu": { label: i18n("GPU metrics"), icon: "video-card" },
"bat": { label: i18n("Battery status"), icon: "battery-good" },
"pwr": { label: i18n("Power consumption"), icon: "battery-charging-60" },
"net": { label: i18n("Network speed"), icon: "network-wireless" },
"disk": { label: i18n("Disk I/O & temp"), icon: "drive-harddisk" },
"fan": { label: i18n("Fan speed"), icon: "fan" }
})
property var currentOrder: {
var keys = cfg_metricOrder.split(",").map(function(k){ return k.trim(); })
.filter(function(k){ return k.length > 0 && metricMeta[k] !== undefined; });
allKeys.forEach(function(k){ if (keys.indexOf(k) < 0) keys.push(k); });
return keys;
}
function isChecked(key) {
switch (key) {
case "cpu": return cfg_showCpu;
case "ram": return cfg_showRam;
case "temp": return cfg_showTemp;
case "gpu": return cfg_showGpu;
case "bat": return cfg_showBattery;
case "pwr": return cfg_showPower;
case "net": return cfg_showNetwork;
case "disk": return cfg_showDisk;
case "fan": return cfg_showFan;
}
return false;
}
function isCompactChecked(key) {
switch (key) {
case "cpu": return cfg_compactShowCpu;
case "ram": return cfg_compactShowRam;
case "temp": return cfg_compactShowTemp;
case "gpu": return cfg_compactShowGpu;
case "bat": return cfg_compactShowBattery;
case "pwr": return cfg_compactShowPower;
case "net": return cfg_compactShowNetwork;
case "disk": return cfg_compactShowDisk;
case "fan": return cfg_compactShowFan;
}
return false;
}
function setChecked(key, val) {
switch (key) {
case "cpu": cfg_showCpu = val; break;
case "ram": cfg_showRam = val; break;
case "temp": cfg_showTemp = val; break;
case "gpu": cfg_showGpu = val; break;
case "bat": cfg_showBattery = val; break;
case "pwr": cfg_showPower = val; break;
case "net": cfg_showNetwork = val; break;
case "disk": cfg_showDisk = val; break;
case "fan": cfg_showFan = val; break;
}
if (!val) {
if ((key === "cpu" || key === "temp") && cfg_mergeCpuTemp) cfg_mergeCpuTemp = false;
if ((key === "bat" || key === "pwr") && cfg_mergeBatPwr) cfg_mergeBatPwr = false;
if (key === "gpu" && cfg_splitGpu) cfg_splitGpu = false;
}
}
function setCompactChecked(key, val) {
switch (key) {
case "cpu": cfg_compactShowCpu = val; break;
case "ram": cfg_compactShowRam = val; break;
case "temp": cfg_compactShowTemp = val; break;
case "gpu": cfg_compactShowGpu = val; break;
case "bat": cfg_compactShowBattery = val; break;
case "pwr": cfg_compactShowPower = val; break;
case "net": cfg_compactShowNetwork = val; break;
case "disk": cfg_compactShowDisk = val; break;
case "fan": cfg_compactShowFan = val; break;
}
}
function moveMetric(fromIndex, toIndex) {
var keys = currentOrder.slice();
var item = keys.splice(fromIndex, 1)[0];
keys.splice(toIndex, 0, item);
cfg_metricOrder = keys.join(",");
}
// =========================================================================
// UI
// =========================================================================
// Prevent "ugly to correct" UI flash during initial layout calculations
property bool _isReady: false
Timer {
id: readyTimer
interval: 100
running: true
repeat: false
onTriggered: metricsPage._isReady = true
}
BusyIndicator {
anchors.centerIn: metricsPage
running: !metricsPage._isReady
visible: running
z: 999
}
Kirigami.FormLayout {
opacity: metricsPage._isReady ? 1 : 0
Behavior on opacity { NumberAnimation { duration: 150 } }
// ----- Section header -----
Kirigami.Separator {
Kirigami.FormData.isSection: true
Kirigami.FormData.label: i18n("Visibility & Order")
}
// Column headers row
RowLayout {
spacing: Kirigami.Units.smallSpacing
Label {
text: i18n("Metric (Full view)")
font.bold: true
opacity: 0.7
Layout.preferredWidth: Kirigami.Units.gridUnit * 14
}
Label {
text: i18n("Compact")
font.bold: true
opacity: 0.7
Layout.preferredWidth: Kirigami.Units.gridUnit * 4
horizontalAlignment: Text.AlignHCenter
}
Item { Layout.fillWidth: true }
}
// Metric rows
ColumnLayout {
spacing: 0
Layout.fillWidth: true
Repeater {
model: metricsPage.currentOrder
delegate: ColumnLayout {
id: metricDelegate
required property var modelData
required property int index
spacing: 0
Layout.fillWidth: true
// Hide metrics absorbed by a merge group
visible: !(modelData === "temp" && cfg_mergeCpuTemp && cfg_showCpu) &&
!(modelData === "pwr" && cfg_mergeBatPwr && cfg_showBattery)
// Resolved shorthands for readability inside this delegate
readonly property bool metricEnabled: metricsPage.isChecked(modelData)
readonly property string metricLabel: (metricsPage.metricMeta[modelData] || {}).label || modelData
readonly property string metricIcon: (metricsPage.metricMeta[modelData] || {}).icon || "help-about"
// ── Main row ──────────────────────────────────────────────
RowLayout {
Layout.fillWidth: true
spacing: Kirigami.Units.smallSpacing
// Metric toggle
CheckBox {
id: enabledCheck
text: metricDelegate.metricLabel
checked: metricDelegate.metricEnabled
onToggled: metricsPage.setChecked(modelData, checked)
Layout.preferredWidth: Kirigami.Units.gridUnit * 14
}
// Compact-view toggle
Item {
Layout.preferredWidth: Kirigami.Units.gridUnit * 4
Layout.minimumHeight: compactCheck.implicitHeight
CheckBox {
id: compactCheck
anchors.centerIn: parent
checked: metricsPage.isCompactChecked(modelData)
enabled: metricDelegate.metricEnabled
onToggled: metricsPage.setCompactChecked(modelData, checked)
// Accessible name for keyboard/screen-reader users
Accessible.name: i18n("Show %1 in compact panel", metricDelegate.metricLabel)
}
}
// Spacer
Item { Layout.fillWidth: true }
// Reorder buttons
Button {
icon.name: "arrow-up"
flat: true
enabled: index > 0
implicitWidth: Kirigami.Units.gridUnit * 2
implicitHeight: Kirigami.Units.gridUnit * 2
onClicked: metricsPage.moveMetric(index, index - 1)
ToolTip.text: i18n("Move up")
ToolTip.visible: hovered
ToolTip.delay: Kirigami.Units.toolTipDelay
}
Button {
icon.name: "arrow-down"
flat: true
enabled: index < metricsPage.currentOrder.length - 1
implicitWidth: Kirigami.Units.gridUnit * 2
implicitHeight: Kirigami.Units.gridUnit * 2
onClicked: metricsPage.moveMetric(index, index + 1)
ToolTip.text: i18n("Move down")
ToolTip.visible: hovered
ToolTip.delay: Kirigami.Units.toolTipDelay
}
}
// ── Inline per-metric settings (visible only when enabled) ──
// Each block is keyed to its metric so context is never lost.
// CPU settings
Loader {
active: modelData === "cpu" && metricDelegate.metricEnabled
visible: active
Layout.fillWidth: true
Layout.leftMargin: Kirigami.Units.gridUnit + Kirigami.Units.smallSpacing
Layout.topMargin: Kirigami.Units.smallSpacing
sourceComponent: ColumnLayout {
spacing: Kirigami.Units.smallSpacing
RowLayout {
spacing: Kirigami.Units.largeSpacing
CheckBox {
text: i18n("Show CPU frequency")
checked: cfg_showCpuFreq
onToggled: {
cfg_showCpuFreq = checked;
if (!checked) cfg_mergeCpuFreq = false;
}
}
CheckBox {
text: i18n("Merge frequency into compact view")
checked: cfg_mergeCpuFreq
enabled: cfg_showCpuFreq
onToggled: cfg_mergeCpuFreq = checked
}
}
CheckBox {
visible: cfg_showTemp
text: i18n("Show temperature next to usage (merge CPU & temp)")
checked: cfg_mergeCpuTemp
enabled: cfg_showTemp
onToggled: cfg_mergeCpuTemp = checked
}
}
}
// Network settings
Loader {
active: modelData === "net" && metricDelegate.metricEnabled
visible: active
Layout.fillWidth: true
Layout.leftMargin: Kirigami.Units.gridUnit + Kirigami.Units.smallSpacing
Layout.topMargin: Kirigami.Units.smallSpacing
sourceComponent: RowLayout {
spacing: Kirigami.Units.smallSpacing
Label { text: i18n("Interface:") }
ComboBox {
id: ifaceCombo
model: metricsPage.ifaceList
currentIndex: {
var idx = metricsPage.ifaceList.indexOf(cfg_networkInterface);
return idx >= 0 ? idx : 0;
}
onActivated: cfg_networkInterface = metricsPage.ifaceList[currentIndex]
implicitWidth: Kirigami.Units.gridUnit * 10
}
}
}
// Battery settings
Loader {
active: modelData === "bat" && metricDelegate.metricEnabled
visible: active
Layout.fillWidth: true
Layout.leftMargin: Kirigami.Units.gridUnit + Kirigami.Units.smallSpacing
Layout.topMargin: Kirigami.Units.smallSpacing
sourceComponent: ColumnLayout {
spacing: Kirigami.Units.smallSpacing
RowLayout {
spacing: Kirigami.Units.smallSpacing
Label { text: i18n("Device:") }
TextField {
id: batteryInput
text: cfg_batteryDevice === "auto" ? "" : cfg_batteryDevice
placeholderText: i18n("Leave empty for auto-detect (e.g. BAT0)")
implicitWidth: Kirigami.Units.gridUnit * 14
onTextEdited: {
var v = text.trim();
cfg_batteryDevice = v.length > 0 ? v : "auto";
}
}
}
CheckBox {
visible: cfg_showPower
text: i18n("Show power consumption next to battery level (merge battery & power)")
checked: cfg_mergeBatPwr
enabled: cfg_showPower
onToggled: cfg_mergeBatPwr = checked
}
}
}
// GPU settings
Loader {
active: modelData === "gpu" && metricDelegate.metricEnabled
visible: active
Layout.fillWidth: true
Layout.leftMargin: Kirigami.Units.gridUnit + Kirigami.Units.smallSpacing
Layout.topMargin: Kirigami.Units.smallSpacing
sourceComponent: ColumnLayout {
spacing: Kirigami.Units.smallSpacing
// Split GPU option
CheckBox {
text: i18n("Show usage, VRAM and temperature as separate entries (split GPU metrics)")
checked: cfg_splitGpu
onToggled: cfg_splitGpu = checked
}
// No GPU found yet (Loading state)
RowLayout {
visible: metricsPage.discoveredGpus.length === 0
spacing: Kirigami.Units.smallSpacing
BusyIndicator {
running: parent.visible
Layout.preferredWidth: Kirigami.Units.gridUnit
Layout.preferredHeight: Kirigami.Units.gridUnit
}
Label {
text: i18n("Discovering GPUs...")
opacity: 0.7
font.italic: true
}
}
// Hybrid GPU tip
Label {
visible: metricsPage.discoveredGpus.length > 1
text: i18n("Tip: on hybrid-GPU laptops, uncheck the discrete GPU to let it suspend and save power.")
opacity: 0.7
font.italic: true
wrapMode: Text.WordWrap
Layout.maximumWidth: Kirigami.Units.gridUnit * 24
}
// Per-GPU rows
Repeater {
id: gpuSelectorRepeater
model: metricsPage.discoveredGpus
delegate: ColumnLayout {
id: gpuDelegate
required property var modelData
spacing: Kirigami.Units.smallSpacing
Layout.fillWidth: true
Layout.leftMargin: Kirigami.Units.smallSpacing
property var _activeMetrics: metricsPage.gpuMetricsFor(modelData.id)
property bool _gpuEnabled: {
if (!cfg_gpuSelection || cfg_gpuSelection === "") return true;
if (cfg_gpuSelection === "none") return false;
return cfg_gpuSelection.split(",").indexOf(modelData.id) >= 0;
}
// GPU enable checkbox
CheckBox {
text: gpuDelegate.modelData.name
checked: gpuDelegate._gpuEnabled
onToggled: {
var ids;
if (!cfg_gpuSelection || cfg_gpuSelection === "") {
ids = gpuSelectorRepeater.model.map(function(g){ return g.id; });
} else if (cfg_gpuSelection === "none") {
ids = [];
} else {
ids = cfg_gpuSelection.split(",").filter(function(s){ return s.length > 0; });
}
if (checked) {
if (ids.indexOf(modelData.id) < 0) ids.push(modelData.id);
} else {
ids = ids.filter(function(id){ return id !== modelData.id; });
}
var allIds = gpuSelectorRepeater.model.map(function(g){ return g.id; });
var allSelected = allIds.every(function(id){ return ids.indexOf(id) >= 0; });
if (allSelected) cfg_gpuSelection = "";
else if (ids.length === 0) cfg_gpuSelection = "none";
else cfg_gpuSelection = ids.join(",");
}
}
// Label + sub-metrics (indented under GPU checkbox)
ColumnLayout {
enabled: gpuDelegate._gpuEnabled
opacity: gpuDelegate._gpuEnabled ? 1.0 : 0.4
spacing: Kirigami.Units.smallSpacing
Layout.leftMargin: Kirigami.Units.gridUnit + Kirigami.Units.smallSpacing
// Custom label
RowLayout {
spacing: Kirigami.Units.smallSpacing
Label { text: i18n("Label:"); opacity: 0.8 }
TextField {
implicitWidth: Kirigami.Units.gridUnit * 12
text: metricsPage.parseGpuLabels(cfg_gpuLabels)[gpuDelegate.modelData.id] || ""
placeholderText: gpuDelegate.modelData.name
onTextEdited: metricsPage.saveGpuLabel(gpuDelegate.modelData.id, text)
}
}
// Sub-metric toggles
RowLayout {
spacing: Kirigami.Units.largeSpacing
Label { text: i18n("Show:"); opacity: 0.8 }
CheckBox {
text: i18n("Usage")
checked: gpuDelegate._activeMetrics.indexOf("usage") >= 0
enabled: !(checked && gpuDelegate._activeMetrics.length <= 1)
onToggled: metricsPage.saveGpuMetric(gpuDelegate.modelData.id, "usage", checked)
}
CheckBox {
text: i18n("VRAM")
checked: gpuDelegate._activeMetrics.indexOf("vram") >= 0
enabled: !(checked && gpuDelegate._activeMetrics.length <= 1)
onToggled: metricsPage.saveGpuMetric(gpuDelegate.modelData.id, "vram", checked)
}
CheckBox {
text: i18n("Temperature")
checked: gpuDelegate._activeMetrics.indexOf("temp") >= 0
enabled: !(checked && gpuDelegate._activeMetrics.length <= 1)
onToggled: metricsPage.saveGpuMetric(gpuDelegate.modelData.id, "temp", checked)
}
}
}
}
}
}
}
// Thin divider between rows (not after the last visible one)
Rectangle {
visible: {
for (var i = index + 1; i < metricsPage.currentOrder.length; i++) {
var nextData = metricsPage.currentOrder[i];
var isHidden = (nextData === "temp" && cfg_mergeCpuTemp && cfg_showCpu) ||
(nextData === "pwr" && cfg_mergeBatPwr && cfg_showBattery);
if (!isHidden) return true;
}
return false;
}
Layout.fillWidth: true
height: 1
color: Kirigami.Theme.textColor
opacity: 0.08
Layout.topMargin: Kirigami.Units.smallSpacing
Layout.bottomMargin: Kirigami.Units.smallSpacing
}
}
}
}
}
}
@@ -0,0 +1,558 @@
import QtQuick
import QtQuick.Layouts
import org.kde.plasma.plasmoid
import org.kde.plasma.components as PlasmaComponents
import org.kde.kirigami as Kirigami
import "./sensors"
PlasmoidItem {
id: root
property bool _dbg: { console.warn("[KVitals] main.qml: constructing..."); return true; }
preferredRepresentation: compactRepresentation
// --- Configuration properties ---
property bool showCpu: Plasmoid.configuration.showCpu
property bool showRam: Plasmoid.configuration.showRam
property bool showTemp: Plasmoid.configuration.showTemp
property bool showGpu: Plasmoid.configuration.showGpu
property bool showBattery: Plasmoid.configuration.showBattery
property bool showPower: Plasmoid.configuration.showPower
property bool showNetwork: Plasmoid.configuration.showNetwork
property bool showDisk: Plasmoid.configuration.showDisk
property bool showFan: Plasmoid.configuration.showFan
property bool compactShowCpu: Plasmoid.configuration.compactShowCpu
property bool compactShowRam: Plasmoid.configuration.compactShowRam
property bool compactShowTemp: Plasmoid.configuration.compactShowTemp
property bool compactShowGpu: Plasmoid.configuration.compactShowGpu
property bool compactShowBattery: Plasmoid.configuration.compactShowBattery
property bool compactShowPower: Plasmoid.configuration.compactShowPower
property bool compactShowNetwork: Plasmoid.configuration.compactShowNetwork
property bool compactShowDisk: Plasmoid.configuration.compactShowDisk
property bool compactShowFan: Plasmoid.configuration.compactShowFan
property string networkInterface: Plasmoid.configuration.networkInterface
property string batteryDevice: Plasmoid.configuration.batteryDevice
property string gpuSelection: Plasmoid.configuration.gpuSelection
property string gpuLabels: Plasmoid.configuration.gpuLabels
property string displayMode: Plasmoid.configuration.displayMode
property string layoutType: Plasmoid.configuration.layoutType
property bool mergeCpuTemp: Plasmoid.configuration.mergeCpuTemp
property bool mergeCpuFreq: Plasmoid.configuration.mergeCpuFreq
property bool showCpuFreq: Plasmoid.configuration.showCpuFreq
property bool mergeBatPwr: Plasmoid.configuration.mergeBatPwr
property bool splitGpu: Plasmoid.configuration.splitGpu
property string gpuMetrics: Plasmoid.configuration.gpuMetrics
property int iconSize: Plasmoid.configuration.iconSize
property string cpuIcon: Plasmoid.configuration.cpuIcon
property string ramIcon: Plasmoid.configuration.ramIcon
property string tempIcon: Plasmoid.configuration.tempIcon
property string gpuIcon: Plasmoid.configuration.gpuIcon
property string batteryIcon: Plasmoid.configuration.batteryIcon
property string powerIcon: Plasmoid.configuration.powerIcon
property string networkIcon: Plasmoid.configuration.networkIcon
property string diskIcon: Plasmoid.configuration.diskIcon
property string fanIcon: Plasmoid.configuration.fanIcon
property string fontFamily: Plasmoid.configuration.fontFamily
property int fontSize: Plasmoid.configuration.fontSize
property bool fontBold: Plasmoid.configuration.fontBold
property int effectiveFontSize: fontSize > 0 ? fontSize : Kirigami.Theme.smallFont.pixelSize
property bool useIcons: displayMode === "icons" || displayMode === "icons+text"
property bool useText: displayMode === "text" || displayMode === "icons+text"
property string metricOrder: Plasmoid.configuration.metricOrder || "cpu,ram,temp,gpu,bat,pwr,net,disk"
property var orderedKeys: metricOrder.split(",").map(function (k) {
return k.trim();
})
property int updateInterval: Plasmoid.configuration.updateInterval || 2000
property string tempUnit: Plasmoid.configuration.tempUnit || "C"
property string networkUnit: Plasmoid.configuration.networkUnit || "bytes"
property string fanUnit: Plasmoid.configuration.fanUnit || "rpm"
// --- Color configuration properties ---
property bool useCustomColors: Plasmoid.configuration.useCustomColors
property string fontColor: Plasmoid.configuration.fontColor
property bool enableThresholdColors: Plasmoid.configuration.enableThresholdColors
property string warningColor: Plasmoid.configuration.warningColor || "#e5a50a"
property string criticalColor: Plasmoid.configuration.criticalColor || "#da4453"
property int cpuWarningThreshold: Plasmoid.configuration.cpuWarningThreshold
property int cpuCriticalThreshold: Plasmoid.configuration.cpuCriticalThreshold
property int tempWarningThreshold: Plasmoid.configuration.tempWarningThreshold
property int tempCriticalThreshold: Plasmoid.configuration.tempCriticalThreshold
property int ramWarningThreshold: Plasmoid.configuration.ramWarningThreshold
property int ramCriticalThreshold: Plasmoid.configuration.ramCriticalThreshold
property int gpuWarningThreshold: Plasmoid.configuration.gpuWarningThreshold
property int gpuCriticalThreshold: Plasmoid.configuration.gpuCriticalThreshold
property int gpuTempWarningThreshold: Plasmoid.configuration.gpuTempWarningThreshold
property int gpuTempCriticalThreshold: Plasmoid.configuration.gpuTempCriticalThreshold
property int batteryWarningThreshold: Plasmoid.configuration.batteryWarningThreshold
property int batteryCriticalThreshold: Plasmoid.configuration.batteryCriticalThreshold
property int diskTempWarningThreshold: Plasmoid.configuration.diskTempWarningThreshold
property int diskTempCriticalThreshold: Plasmoid.configuration.diskTempCriticalThreshold
// --- Computed base text color ---
property color baseTextColor: (useCustomColors && fontColor !== "") ? fontColor : Kirigami.Theme.textColor
// --- Pre-resolved per-metric colors (reactive properties) ---
property color cpuColor: enableThresholdColors
? Utils.resolveColor(cpu.cpuNumericValue, cpuWarningThreshold, cpuCriticalThreshold,
warningColor, criticalColor, baseTextColor, false)
: baseTextColor
property color tempColor: enableThresholdColors
? Utils.resolveColor(temp.tempNumericValue, tempWarningThreshold, tempCriticalThreshold,
warningColor, criticalColor, baseTextColor, false)
: baseTextColor
property color ramColor: enableThresholdColors
? Utils.resolveColor(memory.ramPercentage, ramWarningThreshold, ramCriticalThreshold,
warningColor, criticalColor, baseTextColor, false)
: baseTextColor
property color gpuColor: enableThresholdColors
? Utils.resolveColor(gpu.gpuUsageNumber, gpuWarningThreshold, gpuCriticalThreshold,
warningColor, criticalColor, baseTextColor, false)
: baseTextColor
property color gpuTempColor: enableThresholdColors
? Utils.resolveColor(gpu.gpuTempNumber, gpuTempWarningThreshold, gpuTempCriticalThreshold,
warningColor, criticalColor, baseTextColor, false)
: baseTextColor
property color batteryColor: enableThresholdColors
? Utils.resolveColor(battery.batNumericValue, batteryWarningThreshold, batteryCriticalThreshold,
warningColor, criticalColor, baseTextColor, true)
: baseTextColor
property color diskTempColor: enableThresholdColors
? Utils.resolveColor(disk.diskTempNumber, diskTempWarningThreshold, diskTempCriticalThreshold,
warningColor, criticalColor, baseTextColor, false)
: baseTextColor
// --- Deferred sensor loading ---
// Sensors are loaded AFTER the window attachment is complete to avoid
// triggering a SIGSEGV in KirigamiPlasmaStyle's PlasmaTheme::syncColors()
// during the recursive QQuickItemPrivate::refWindow() walk at boot.
// See: https://github.com/nicehash/KVitals/issues/42
property bool _sensorsReady: sensorLoader.status === Loader.Ready
property var cpu: _sensorsReady ? sensorLoader.item.cpu : _nullCpu
property var memory: _sensorsReady ? sensorLoader.item.memory : _nullMemory
property var temp: _sensorsReady ? sensorLoader.item.temp : _nullTemp
property var gpu: _sensorsReady ? sensorLoader.item.gpu : _nullGpu
property var battery: _sensorsReady ? sensorLoader.item.battery : _nullBattery
property var network: _sensorsReady ? sensorLoader.item.network : _nullNetwork
property var disk: _sensorsReady ? sensorLoader.item.disk : _nullDisk
property var fans: _sensorsReady ? sensorLoader.item.fans : _nullFans
// Safe defaults so bindings don't error before sensors load
QtObject {
id: _nullCpu
property string cpuValue: ""
property string cpuFreqValue: ""
property real cpuNumericValue: NaN
}
QtObject {
id: _nullMemory
property string ramValue: ""
property real ramPercentage: NaN
}
QtObject {
id: _nullTemp
property string tempValue: "--"
property real tempNumericValue: NaN
}
QtObject {
id: _nullGpu
property real gpuUsageNumber: NaN
property real gpuTempNumber: NaN
property string gpuValue: ""
property string gpuRamValue: ""
property string gpuTempValue: ""
property string gpuDisplayValue: ""
property bool hasGpuData: false
property bool hasGpuUsageData: false
property bool hasGpuVramData: false
property bool hasGpuTempData: false
property var gpuDataList: []
property var discoveredGpus: []
}
QtObject {
id: _nullBattery
property string batValue: ""
property string powerValue: ""
property real batNumericValue: NaN
}
QtObject {
id: _nullNetwork
property string netDownValue: "0"
property string netUpValue: "0"
}
QtObject {
id: _nullDisk
property string diskReadValue: "0"
property string diskWriteValue: "0"
property string diskTempValue: ""
property real diskTempNumber: NaN
}
QtObject {
id: _nullFans
property string fanValue: ""
property bool hasFanData: false
}
Loader {
id: sensorLoader
active: false
sourceComponent: Item {
property alias cpu: _cpu
property alias memory: _memory
property alias temp: _temp
property alias gpu: _gpu
property alias battery: _battery
property alias network: _network
property alias disk: _disk
property alias fans: _fans
CpuSensors {
id: _cpu
updateInterval: root.updateInterval
}
MemorySensors {
id: _memory
updateInterval: root.updateInterval
}
TempSensors {
id: _temp
updateInterval: root.updateInterval
tempUnit: root.tempUnit
}
GpuSensors {
id: _gpu
updateInterval: root.updateInterval
gpuSelection: root.gpuSelection
gpuLabels: root.gpuLabels
tempUnit: root.tempUnit
gpuMetrics: root.gpuMetrics
}
BatterySensors {
id: _battery
updateInterval: root.updateInterval
batteryDevice: root.batteryDevice || "auto"
}
NetworkSensors {
id: _network
updateInterval: root.updateInterval
networkInterface: root.networkInterface
networkUnit: root.networkUnit
}
DiskSensors {
id: _disk
updateInterval: root.updateInterval
enabled: root.showDisk
tempUnit: root.tempUnit
networkUnit: root.networkUnit
}
FanSensors {
id: _fans
updateInterval: root.updateInterval
fanUnit: root.fanUnit
}
}
}
// Activate the sensor loader after the initial refWindow() walk is complete.
// The SIGSEGV in PlasmaTheme::syncColors() happens synchronously during
// ShellCorona::load() → refWindow(), so deferring to the next event loop
// iteration (Timer interval: 0) guarantees we're past the dangerous window.
Timer {
id: sensorActivationTimer
interval: 0
repeat: false
onTriggered: {
console.warn("[KVitals] main.qml: deferred load — activating sensors...");
sensorLoader.active = true;
}
}
Component.onCompleted: {
console.warn("[KVitals] main.qml: ready. config: showCpu=" + showCpu + " showGpu=" + showGpu + " showBattery=" + showBattery + " showNetwork=" + showNetwork + " showDisk=" + showDisk);
sensorActivationTimer.start();
}
// --- Representations ---
compactRepresentation: CompactView {
metricsModel: {
var items = [];
for (var i = 0; i < root.orderedKeys.length; i++) {
var key = root.orderedKeys[i];
if (key === "cpu" && root.showCpu && root.compactShowCpu && cpu.cpuValue) {
if (root.mergeCpuTemp && root.showTemp && root.compactShowTemp && temp.tempValue && temp.tempValue !== "--") {
var segs = [{value: cpu.cpuValue, color: root.cpuColor},
{value: temp.tempValue, color: root.tempColor}];
if (root.mergeCpuFreq && root.showCpuFreq)
segs.push({value: cpu.cpuFreqValue, color: root.baseTextColor});
items.push({icon: root.cpuIcon, label: "CPU:", color: root.cpuColor, segments: segs});
} else if (root.mergeCpuFreq && root.showCpuFreq) {
items.push({
icon: root.cpuIcon, label: "CPU:", color: root.cpuColor,
segments: [
{value: cpu.cpuValue, color: root.cpuColor},
{value: cpu.cpuFreqValue, color: root.baseTextColor}
]
});
} else {
items.push({icon: root.cpuIcon, label: "CPU:", value: cpu.cpuValue, color: root.cpuColor});
}
} else if (key === "ram" && root.showRam && root.compactShowRam && memory.ramValue)
items.push({
icon: root.ramIcon, label: "RAM:", value: memory.ramValue,
color: root.ramColor
});
else if (key === "temp" && root.showTemp && root.compactShowTemp && temp.tempValue && temp.tempValue !== "--"
&& !(root.mergeCpuTemp && root.showCpu && root.compactShowCpu))
items.push({
icon: root.tempIcon, label: "TEMP:", value: temp.tempValue,
color: root.tempColor
});
else if (key === "gpu" && root.showGpu && root.compactShowGpu && gpu.hasGpuData) {
var multiGpu = gpu.gpuDataList.length > 1;
if (multiGpu) {
// Show each GPU as a separate entry
for (var g = 0; g < gpu.gpuDataList.length; g++) {
var gd = gpu.gpuDataList[g];
var label = (gd.name.length > 0 ? gd.name : gd.id) + ":";
if (root.splitGpu) {
if (gd.usage) items.push({icon: root.gpuIcon, label: label, value: gd.usage, color: root.gpuColor});
if (gd.vram) items.push({icon: root.gpuIcon, label: "VRAM:", value: gd.vram, color: root.baseTextColor});
if (gd.temp) items.push({icon: root.gpuIcon, label: "GTEMP:", value: gd.temp, color: root.gpuTempColor});
} else {
var segs2 = [];
if (gd.usage) segs2.push({value: gd.usage, color: root.gpuColor});
if (gd.vram) segs2.push({value: gd.vram, color: root.baseTextColor});
if (gd.temp) segs2.push({value: gd.temp, color: root.gpuTempColor});
if (segs2.length > 0)
items.push({icon: root.gpuIcon, label: label, segments: segs2, color: root.gpuColor});
}
}
} else if (root.splitGpu) {
if (gpu.hasGpuUsageData)
items.push({icon: root.gpuIcon, label: "GPU:", value: gpu.gpuValue, color: root.gpuColor});
if (gpu.hasGpuVramData)
items.push({
icon: root.gpuIcon,
label: "VRAM:",
value: gpu.gpuRamValue,
color: root.baseTextColor
});
if (gpu.hasGpuTempData)
items.push({
icon: root.gpuIcon,
label: "GTEMP:",
value: gpu.gpuTempValue,
color: root.gpuTempColor
});
} else {
var gpuSegs = [];
if (gpu.hasGpuUsageData)
gpuSegs.push({value: gpu.gpuValue, color: root.gpuColor});
if (gpu.hasGpuVramData)
gpuSegs.push({value: gpu.gpuRamValue, color: root.baseTextColor});
if (gpu.hasGpuTempData)
gpuSegs.push({value: gpu.gpuTempValue, color: root.gpuTempColor});
items.push({
icon: root.gpuIcon, label: "GPU:", segments: gpuSegs,
color: root.gpuColor
});
}
} else if (key === "bat" && root.showBattery && root.compactShowBattery && battery.batValue) {
if (root.mergeBatPwr && root.showPower && root.compactShowPower && battery.powerValue) {
items.push({
icon: root.batteryIcon, label: "BAT:",
color: root.batteryColor,
segments: [
{value: battery.batValue, color: root.batteryColor},
{value: battery.powerValue, color: root.baseTextColor}
]
});
} else {
items.push({
icon: root.batteryIcon, label: "BAT:", value: battery.batValue,
color: root.batteryColor
});
}
} else if (key === "pwr" && root.showPower && root.compactShowPower && battery.powerValue
&& !(root.mergeBatPwr && root.showBattery && root.compactShowBattery))
items.push({
icon: root.powerIcon, label: "PWR:", value: battery.powerValue,
color: root.baseTextColor
});
else if (key === "net" && root.showNetwork && root.compactShowNetwork)
items.push({
icon: root.networkIcon, label: "NET:",
value: "↓" + network.netDownValue + " ↑" + network.netUpValue,
color: root.baseTextColor
});
else if (key === "disk" && root.showDisk && root.compactShowDisk) {
var diskSegs = [{value: "↓" + disk.diskReadValue, color: root.baseTextColor},
{value: "↑" + disk.diskWriteValue, color: root.baseTextColor}];
if (disk.diskTempValue)
diskSegs.push({value: disk.diskTempValue, color: root.diskTempColor});
items.push({icon: root.diskIcon, label: "DSK:", segments: diskSegs, color: root.baseTextColor});
}
else if (key === "fan" && root.showFan && root.compactShowFan && fans.hasFanData) {
items.push({
icon: root.fanIcon, label: "FAN:", value: fans.fanValue,
color: root.baseTextColor
});
}
}
return items;
}
layoutType: root.layoutType
useIcons: root.useIcons
useText: root.useText
effectiveFontSize: root.effectiveFontSize
fontFamily: root.fontFamily
fontBold: root.fontBold
iconSize: root.iconSize
baseTextColor: root.baseTextColor
onToggleExpanded: root.expanded = !root.expanded
}
fullRepresentation: FullView {
baseTextColor: root.baseTextColor
fontBold: root.fontBold
metricsModel: {
var items = [];
for (var i = 0; i < root.orderedKeys.length; i++) {
var key = root.orderedKeys[i];
if (key === "cpu" && root.showCpu)
items.push({
label: "CPU Usage", value: cpu.cpuValue,
color: root.cpuColor
});
if (key === "cpu" && root.showCpu && root.showCpuFreq)
items.push({
label: "CPU Frequency", value: cpu.cpuFreqValue,
color: root.baseTextColor
});
else if (key === "ram" && root.showRam)
items.push({
label: "Memory", value: memory.ramValue,
color: root.ramColor
});
else if (key === "temp" && root.showTemp && temp.tempValue !== "--")
items.push({
label: "CPU Temp", value: temp.tempValue,
color: root.tempColor
});
else if (key === "gpu" && root.showGpu) {
if (gpu.gpuDataList.length > 1) {
for (var g = 0; g < gpu.gpuDataList.length; g++) {
var gd = gpu.gpuDataList[g];
var label = gd.name || gd.id;
if (gd.usage) items.push({label: label + " Usage", value: gd.usage, color: root.gpuColor});
if (gd.vram) items.push({label: label + " VRAM", value: gd.vram, color: root.baseTextColor});
if (gd.temp) items.push({label: label + " Temp", value: gd.temp, color: root.gpuTempColor});
}
} else {
if (gpu.hasGpuUsageData) items.push({
label: "GPU Usage", value: gpu.gpuValue,
color: root.gpuColor
});
if (gpu.hasGpuVramData) items.push({
label: "GPU VRAM", value: gpu.gpuRamValue,
color: root.baseTextColor
});
if (gpu.hasGpuTempData) items.push({
label: "GPU Temp", value: gpu.gpuTempValue,
color: root.gpuTempColor
});
}
} else if (key === "bat" && root.showBattery && battery.batValue)
items.push({
label: "Battery", value: battery.batValue,
color: root.batteryColor
});
else if (key === "pwr" && root.showPower && battery.powerValue)
items.push({
label: "Power", value: battery.powerValue,
color: root.baseTextColor
});
else if (key === "net" && root.showNetwork) {
items.push({label: "Network ↓", value: network.netDownValue, color: root.baseTextColor});
items.push({label: "Network ↑", value: network.netUpValue, color: root.baseTextColor});
}
else if (key === "disk" && root.showDisk) {
items.push({label: "Disk Read", value: disk.diskReadValue, color: root.baseTextColor});
items.push({label: "Disk Write", value: disk.diskWriteValue, color: root.baseTextColor});
if (disk.diskTempValue)
items.push({label: "Disk Temp", value: disk.diskTempValue, color: root.diskTempColor});
}
else if (key === "fan" && root.showFan && fans.hasFanData) {
items.push({label: "Fans", value: fans.fanValue, color: root.baseTextColor});
}
}
return items;
}
}
// --- Tooltip ---
toolTipMainText: "KVitals"
toolTipSubText: {
var parts = [];
for (var i = 0; i < root.orderedKeys.length; i++) {
var key = root.orderedKeys[i];
if (key === "cpu" && root.showCpu && cpu.cpuValue)
parts.push("CPU: " + cpu.cpuValue);
else if (key === "ram" && root.showRam && memory.ramValue)
parts.push("RAM: " + memory.ramValue);
else if (key === "temp" && root.showTemp && temp.tempValue && temp.tempValue !== "--")
parts.push("TEMP: " + temp.tempValue);
else if (key === "gpu" && root.showGpu && gpu.hasGpuData) {
if (gpu.gpuDataList.length > 1) {
for (var g = 0; g < gpu.gpuDataList.length; g++) {
var gd = gpu.gpuDataList[g];
var label = gd.name || gd.id;
var vals = [gd.usage, gd.vram, gd.temp].filter(function(v) { return v; });
if (vals.length > 0) parts.push(label + ": " + vals.join(" "));
}
} else {
if (gpu.hasGpuUsageData) parts.push("GPU: " + gpu.gpuValue);
if (gpu.hasGpuVramData) parts.push("VRAM: " + gpu.gpuRamValue);
if (gpu.hasGpuTempData) parts.push("GPU TEMP: " + gpu.gpuTempValue);
}
} else if (key === "bat" && root.showBattery && battery.batValue)
parts.push("BAT: " + battery.batValue);
else if (key === "pwr" && root.showPower && battery.powerValue)
parts.push("PWR: " + battery.powerValue);
else if (key === "net" && root.showNetwork)
parts.push("NET: ↓" + network.netDownValue + " ↑" + network.netUpValue);
else if (key === "disk" && root.showDisk) {
var dParts = ["↓" + disk.diskReadValue, "↑" + disk.diskWriteValue];
if (disk.diskTempValue) dParts.push(disk.diskTempValue);
parts.push("DSK: " + dParts.join(" "));
}
else if (key === "fan" && root.showFan && fans.hasFanData) {
parts.push("FAN: " + fans.fanValue);
}
}
return parts.join("\n");
}
}
@@ -0,0 +1,193 @@
import QtQuick
import org.kde.ksysguard.sensors as Sensors
import org.kde.plasma.plasma5support as Plasma5Support
Item {
id: root
property bool _dbg: { console.warn("[KVitals] BatterySensors: constructing..."); return true; }
property int updateInterval: 2000
property string batteryDevice: "auto"
readonly property real batNumericValue: {
if (batChargeSensor.status !== Sensors.Sensor.Ready)
return NaN;
return batChargeSensor.value;
}
readonly property string batValue: {
if (isNaN(batNumericValue)) return "";
return Math.round(batNumericValue) + "%";
}
readonly property string powerValue: {
if (batRateSensor.status !== Sensors.Sensor.Ready) return "";
var watts = Math.abs(batRateSensor.value);
if (watts < 0.01) return "0.0W";
var sign = batRateSensor.value > 0 ? "+" : "-";
return sign + watts.toFixed(1) + "W";
}
// --- Dynamic battery sensor discovery ---
property string discoveredBatId: ""
property string batChargeSensorId: {
var base = (batteryDevice && batteryDevice !== "auto") ? batteryDevice : discoveredBatId;
return base ? ("power/" + base + "/chargePercentage") : "";
}
property string batRateSensorId: {
var base = (batteryDevice && batteryDevice !== "auto") ? batteryDevice : discoveredBatId;
return base ? ("power/" + base + "/chargeRate") : "";
}
property var batteryCandidates: [
"battery_BAT0",
"battery_BAT1",
"battery_BAT2",
"battery_BATT",
"battery_BATT0"
]
property var stage1Probes: []
Component.onCompleted: {
console.warn("[KVitals] BatterySensors: ready. batteryDevice = " + batteryDevice);
if (batteryDevice && batteryDevice !== "auto")
return;
for (var i = 0; i < batteryCandidates.length; i++) {
var pre = "power/" + batteryCandidates[i] + "/chargePercentage";
var code = 'import org.kde.ksysguard.sensors as Sensors; Sensors.Sensor { sensorId: "' + pre + '"; updateRateLimit: 2000 }';
try {
var probe = Qt.createQmlObject(code, root, "probe_" + i);
stage1Probes.push({ candidate: batteryCandidates[i], probe: probe });
} catch(e) {
}
}
}
Timer {
id: stage1Timer
interval: 500
repeat: true
running: (!batteryDevice || batteryDevice === "auto") && !discoveredBatId
property int attempts: 0
onTriggered: {
attempts++;
console.warn("[KVitals] BatterySensors: probe attempt = " + attempts);
for (var i = 0; i < stage1Probes.length; i++) {
if (stage1Probes[i].probe && stage1Probes[i].probe.status === Sensors.Sensor.Ready) {
console.warn("[KVitals] BatterySensors: stage 1 found = " + stage1Probes[i].candidate);
persistDetectedBattery(stage1Probes[i].candidate);
running = false;
cleanupProbes();
return;
}
}
if (attempts >= 6) { // 3 seconds timeout
console.warn("[KVitals] BatterySensors: stage 1 timeout, starting qdbus fallback...");
running = false;
cleanupProbes();
// Stage 2: qdbus fallback
tryNextQdbus();
}
}
}
function cleanupProbes() {
for (var i = 0; i < stage1Probes.length; i++) {
if (stage1Probes[i].probe)
stage1Probes[i].probe.destroy();
}
stage1Probes = [];
}
function persistDetectedBattery(deviceId) {
discoveredBatId = deviceId;
}
function extractBatteryIds(stdout) {
if (!stdout)
return [];
var matches = stdout.match(/power\/[^\/"\s]+\/chargePercentage/g);
if (!matches)
return [];
var ids = [];
for (var i = 0; i < matches.length; i++) {
var parts = matches[i].split("/");
if (parts.length < 3)
continue;
if (ids.indexOf(parts[1]) === -1)
ids.push(parts[1]);
}
return ids;
}
// Stage 2: qdbus fallback
property var qdbusVariants: ["qdbus", "qdbus6", "qdbus-qt6", "qdbus-qt5"]
property int qdbusIndex: 0
Plasma5Support.DataSource {
id: qdbusDetector
engine: "executable"
property bool active: false
onNewData: function(sourceName, data) {
if (!active) return;
active = false;
disconnectSource(sourceName);
console.debug("[KVitals] BatterySensors: qdbus exit code = " + data["exit code"]);
if (data["exit code"] === 0) {
var stdoutStr = data["stdout"] ? data["stdout"].toString() : "";
var ids = extractBatteryIds(stdoutStr);
console.debug("[KVitals] BatterySensors: qdbus ids = " + JSON.stringify(ids));
if (ids.length === 1) {
persistDetectedBattery(ids[0]);
return;
}
if (ids.length > 1) {
console.warn("BatterySensors: multiple batteries found:", JSON.stringify(ids), "— using first:", ids[0]);
persistDetectedBattery(ids[0]);
return;
}
} else {
console.warn("[KVitals] BatterySensors: qdbus command failed.");
}
tryNextQdbus();
}
function run(variant) {
var cmd = variant + " --literal org.kde.ksystemstats1" +
" /org/kde/ksystemstats1" +
" org.kde.ksystemstats1.allSensors";
active = true;
connectSource(cmd);
}
}
function tryNextQdbus() {
if (qdbusIndex >= qdbusVariants.length) {
console.warn("[KVitals] BatterySensors: all detection methods exhausted; set batteryDevice manually.");
return;
}
var variant = qdbusVariants[qdbusIndex];
qdbusIndex++;
console.debug("[KVitals] BatterySensors: trying qdbus variant = " + variant);
qdbusDetector.run(variant);
}
Sensors.Sensor {
id: batChargeSensor
sensorId: root.batChargeSensorId
updateRateLimit: root.updateInterval > 5000 ? root.updateInterval : 5000
}
Sensors.Sensor {
id: batRateSensor
sensorId: root.batRateSensorId
updateRateLimit: root.updateInterval > 5000 ? root.updateInterval : 5000
}
}
@@ -0,0 +1,47 @@
import QtQuick
import org.kde.ksysguard.sensors as Sensors
Item {
id: root
property bool _dbg: { console.warn("[KVitals] CpuSensors: constructing..."); return true; }
property int updateInterval: 2000
readonly property real cpuNumericValue: {
if (cpuSensor.status !== Sensors.Sensor.Ready)
return NaN;
return cpuSensor.value;
}
readonly property string cpuValue: {
if (isNaN(cpuNumericValue))
return "...";
return Math.round(cpuNumericValue) + "%";
}
// Frequency in MHz from KSysGuard (unit type 302 = MHz); displays as GHz above 1000 MHz
readonly property string cpuFreqValue: {
if (freqSensor.status !== Sensors.Sensor.Ready || freqSensor.value == null)
return "...";
var mhz = freqSensor.value;
if (mhz >= 1000)
return (mhz / 1000).toFixed(2) + " GHz";
return Math.round(mhz) + " MHz";
}
Sensors.Sensor {
id: cpuSensor
sensorId: "cpu/all/usage"
updateRateLimit: root.updateInterval
}
Sensors.Sensor {
id: freqSensor
sensorId: "cpu/all/averageFrequency"
updateRateLimit: root.updateInterval
}
Component.onCompleted: {
console.warn("[KVitals] CpuSensors: ready.");
}
}
@@ -0,0 +1,113 @@
import QtQuick
import org.kde.ksysguard.sensors as Sensors
import org.kde.kitemmodels as KItemModels
Item {
id: root
property bool _dbg: { console.warn("[KVitals] DiskSensors: constructing..."); return true; }
property int updateInterval: 2000
property bool enabled: true
property string tempUnit: "C"
property string networkUnit: "bytes"
readonly property string diskReadValue: Utils.formatRate(diskReadSensor.status === Sensors.Sensor.Ready ? diskReadSensor.value : NaN, networkUnit)
readonly property string diskWriteValue: Utils.formatRate(diskWriteSensor.status === Sensors.Sensor.Ready ? diskWriteSensor.value : NaN, networkUnit)
// Highest temperature found across all discovered drive temp sensors
readonly property real diskTempNumber: _diskTempNum
readonly property string diskTempValue: isNaN(_diskTempNum) ? "" : Utils.formatTemp(_diskTempNum, tempUnit)
property real _diskTempNum: NaN
// I/O sensors
Sensors.Sensor {
id: diskReadSensor
sensorId: "disk/all/read"
updateRateLimit: root.updateInterval
enabled: root.enabled
}
Sensors.Sensor {
id: diskWriteSensor
sensorId: "disk/all/write"
updateRateLimit: root.updateInterval
enabled: root.enabled
}
// Matches lmsensors chips that are NVMe (nvme-pci-*) or SATA drivetemp
// (drivetemp-scsi-*) and picks temp1 (Composite) or temp2 (secondary sensor)
Sensors.SensorTreeModel { id: sensorTree }
KItemModels.KDescendantsProxyModel {
id: flatSensors
model: sensorTree
}
property var _tempSensorIds: []
function _refreshTempSensors() {
console.debug("[KVitals] DiskSensors: scan started. rows = " + flatSensors.rowCount());
var found = [];
for (var row = 0; row < flatSensors.rowCount(); row++) {
var idx = flatSensors.index(row, 0);
var sid = flatSensors.data(idx, Sensors.SensorTreeModel.SensorId);
if (!sid) continue;
if (/^lmsensors\/(nvme-pci-[^/]+|drivetemp-scsi-[^/]+)\/temp[12]$/.test(sid))
found.push(sid);
}
console.debug("[KVitals] DiskSensors: scan finished. found = " + JSON.stringify(found));
if (JSON.stringify(found) !== JSON.stringify(_tempSensorIds)) {
console.debug("[KVitals] DiskSensors: temp sensors updated. ids = " + JSON.stringify(found));
_tempSensorIds = found;
}
}
property bool _discoveryDirty: false
Timer {
id: discoveryTimer
interval: 500
repeat: false
running: _discoveryDirty
onTriggered: {
_discoveryDirty = false;
root._refreshTempSensors();
}
}
Connections {
target: flatSensors
function onRowsInserted() { root._discoveryDirty = true; }
function onRowsRemoved() { root._discoveryDirty = true; }
function onModelReset() { root._discoveryDirty = true; }
}
Component.onCompleted: {
console.warn("[KVitals] DiskSensors: ready.");
_refreshTempSensors();
}
// Poll discovered temp sensors
Sensors.SensorDataModel {
id: tempData
sensors: root._tempSensorIds
updateRateLimit: root.updateInterval
enabled: root._tempSensorIds.length > 0
onDataChanged: root._aggregateTemp()
onReadyChanged: { if (ready) root._aggregateTemp(); }
}
function _aggregateTemp() {
var max = NaN;
for (var i = 0; i < _tempSensorIds.length; i++) {
var col = tempData.column(_tempSensorIds[i]);
if (col < 0) continue;
var val = tempData.data(tempData.index(0, col), Sensors.SensorDataModel.Value);
if (typeof val !== "number" || isNaN(val) || val <= 0) continue;
if (isNaN(max) || val > max) max = val;
}
_diskTempNum = max;
}
}
@@ -0,0 +1,117 @@
import QtQuick
import org.kde.ksysguard.sensors as Sensors
import org.kde.kitemmodels as KItemModels
Item {
id: root
property int updateInterval: 2000
property string fanUnit: "rpm" // "rpm" or "percent"
readonly property var discoveredFans: _discovered
property var _discovered: []
readonly property string fanValue: _fanStr
readonly property bool hasFanData: _fanStr.length > 0
property string _fanStr: ""
// -------------------------------------------------------------------------
// Step 1: Discover available Fans via SensorTreeModel
// -------------------------------------------------------------------------
Sensors.SensorTreeModel {
id: sensorTree
}
KItemModels.KDescendantsProxyModel {
id: flatSensors
model: sensorTree
}
function refreshDiscovered() {
var found = [];
for (var row = 0; row < flatSensors.rowCount(); row++) {
var idx = flatSensors.index(row, 0);
var sensorId = flatSensors.data(idx, Sensors.SensorTreeModel.SensorId);
if (!sensorId || sensorId.length === 0) continue;
// Match any sensor that contains /fan and doesn't end with a non-digit (typically fan1, fan2, etc)
var match = sensorId.match(/^(lmsensors|cpu|gpu)\/.*\/fan\d+$/i);
if (!match) continue;
// Some names are like "cpu_fan", we can try to extract the last part or use the sensor Name
var name = flatSensors.data(idx, Qt.DisplayRole) || "Fan " + (found.length + 1);
found.push({ id: sensorId, name: name });
}
if (JSON.stringify(found) !== JSON.stringify(_discovered)) {
_discovered = found;
}
}
Connections {
target: flatSensors
function onRowsInserted() { root.refreshDiscovered(); }
function onRowsRemoved() { root.refreshDiscovered(); }
function onModelReset() { root.refreshDiscovered(); }
}
Component.onCompleted: refreshDiscovered()
// -------------------------------------------------------------------------
// Step 2: Poll discovered fans
// -------------------------------------------------------------------------
readonly property var _activeSensorIds: _discovered.map(function(f){ return f.id; })
Sensors.SensorDataModel {
id: fanData
sensors: root._activeSensorIds
updateRateLimit: root.updateInterval
enabled: root._activeSensorIds.length > 0
onDataChanged: root.aggregate()
onReadyChanged: { if (ready) root.aggregate(); }
}
function _modelValue(sensorId) {
var col = fanData.column(sensorId);
if (col < 0) return NaN;
var idx = fanData.index(0, col);
if (!idx.valid) return NaN;
var val = fanData.data(idx, Sensors.SensorDataModel.Value);
return (val === undefined || val === null) ? NaN : val;
}
function _modelMax(sensorId) {
var col = fanData.column(sensorId);
if (col < 0) return NaN;
var idx = fanData.index(0, col);
if (!idx.valid) return NaN;
var val = fanData.data(idx, Sensors.SensorDataModel.Maximum);
return (val === undefined || val === null) ? NaN : val;
}
function aggregate() {
var parts = [];
for (var i = 0; i < _discovered.length; i++) {
var f = _discovered[i];
var v = _modelValue(f.id);
if (isNaN(v) || v <= 0) continue; // Ignore 0 RPM or disconnected fans
var str = "";
if (fanUnit === "percent") {
var max = _modelMax(f.id);
if (isNaN(max) || max <= 0) {
continue;
}
var pct = Math.min(100, Math.round((v / max) * 100));
str = pct + "%";
} else {
str = Math.round(v) + " RPM";
}
parts.push(str);
}
_fanStr = parts.join(" ");
}
onFanUnitChanged: aggregate()
}
@@ -0,0 +1,270 @@
import QtQuick
import org.kde.ksysguard.sensors as Sensors
import org.kde.kitemmodels as KItemModels
Item {
id: root
property bool _dbg: { console.warn("[KVitals] GpuSensors: constructing..."); return true; }
property int updateInterval: 2000
// Comma-separated selected GPU IDs e.g. "gpu0,gpu1". Empty = all discovered.
property string gpuSelection: ""
// User-defined labels: "gpu0:My iGPU|gpu1:dGPU". Empty string = use default "GPU N" name.
property string gpuLabels: ""
// Temperature unit: "C" (default) or "F"
property string tempUnit: "C"
// Per-GPU sub-metric visibility: "gpu0:usage,vram|gpu1:usage,temp"
// Empty string (default) = all three sub-metrics enabled for every GPU.
property string gpuMetrics: ""
// List of { id: "gpu0", name: "GPU 1" } derived from SensorTreeModel (no polling)
readonly property var discoveredGpus: _discovered
property var _discovered: []
// Aggregated display (single-GPU compat)
readonly property real gpuUsageNumber: _usageNum
readonly property real gpuTempNumber: _tempNum
readonly property string gpuValue: _usageStr
readonly property string gpuRamValue: _vramStr
readonly property string gpuTempValue: _tempStr
readonly property string gpuDisplayValue:
[_usageStr, _vramStr, _tempStr].filter(function(v){return v;}).join(" ")
readonly property bool hasGpuData: gpuDisplayValue.length > 0
readonly property bool hasGpuUsageData: _usageStr.length > 0
readonly property bool hasGpuVramData: _vramStr.length > 0
readonly property bool hasGpuTempData: _tempStr.length > 0
// Per-GPU list for multi display: [{ id, name, usage, vram, temp, usageNumber, tempNumber }]
readonly property var gpuDataList: _dataList
property var _dataList: []
property real _usageNum: NaN
property real _tempNum: NaN
property string _usageStr: ""
property string _vramStr: ""
property string _tempStr: ""
// -------------------------------------------------------------------------
// Step 1: Discover available GPUs via SensorTreeModel (metadata only, no polling)
// -------------------------------------------------------------------------
Sensors.SensorTreeModel {
id: sensorTree
}
KItemModels.KDescendantsProxyModel {
id: flatSensors
model: sensorTree
}
// Parse "gpu0:Label A|gpu1:Label B" → { gpu0: "Label A", gpu1: "Label B" }
function parseGpuLabels(str) {
var result = {};
if (!str) return result;
var pairs = str.split("|");
for (var i = 0; i < pairs.length; i++) {
var sep = pairs[i].indexOf(":");
if (sep > 0)
result[pairs[i].substring(0, sep)] = pairs[i].substring(sep + 1);
}
return result;
}
// Parse "gpu0:usage,vram|gpu1:usage,temp" → { gpu0: ["usage","vram"], gpu1: ["usage","temp"] }
// Missing GPU or empty string → default all three enabled.
function parseGpuMetrics(str) {
var result = {};
if (!str) return result;
var pairs = str.split("|");
for (var i = 0; i < pairs.length; i++) {
var sep = pairs[i].indexOf(":");
if (sep <= 0) continue;
var id = pairs[i].substring(0, sep);
var metrics = pairs[i].substring(sep + 1).split(",")
.filter(function(m){ return m === "usage" || m === "vram" || m === "temp"; });
if (metrics.length > 0) result[id] = metrics;
}
return result;
}
// Return enabled sub-metric list for a specific GPU (["usage","vram","temp"] if unconfigured)
function gpuMetricsFor(gpuId, metricsMap) {
return (metricsMap[gpuId] && metricsMap[gpuId].length > 0)
? metricsMap[gpuId]
: ["usage", "vram", "temp"];
}
function refreshDiscovered() {
console.debug("[KVitals] GpuSensors: scan started. rows = " + flatSensors.rowCount());
var found = [];
for (var row = 0; row < flatSensors.rowCount(); row++) {
var idx = flatSensors.index(row, 0);
var sensorId = flatSensors.data(idx, Sensors.SensorTreeModel.SensorId);
if (!sensorId || sensorId.length === 0) continue;
var match = sensorId.match(/^gpu\/(gpu\d+)\/usage$/);
if (!match) continue;
found.push({ id: match[1], name: "GPU " + (found.length + 1) });
}
console.debug("[KVitals] GpuSensors: scan finished. found = " + JSON.stringify(found));
if (JSON.stringify(found) !== JSON.stringify(_discovered)) {
console.warn("[KVitals] GpuSensors: discovered GPUs updated = " + JSON.stringify(found));
_discovered = found;
if (typeof Plasmoid !== "undefined" && Plasmoid.configuration)
Plasmoid.configuration.gpuDiscovered =
found.map(function(g){ return g.id + ":" + g.name; }).join(",");
}
}
property bool _discoveryDirty: false
Timer {
id: discoveryTimer
interval: 500
repeat: false
running: _discoveryDirty
onTriggered: {
_discoveryDirty = false;
root.refreshDiscovered();
}
}
Connections {
target: flatSensors
function onRowsInserted() { root._discoveryDirty = true; }
function onRowsRemoved() { root._discoveryDirty = true; }
function onModelReset() { root._discoveryDirty = true; }
function onDataChanged() { root._discoveryDirty = true; }
}
Component.onCompleted: {
console.warn("[KVitals] GpuSensors: ready. selection=" + gpuSelection);
refreshDiscovered();
}
// -------------------------------------------------------------------------
// Step 2: Compute active sensor IDs — per GPU, only poll enabled sub-metrics
// -------------------------------------------------------------------------
readonly property var _activeIds: {
if (!gpuSelection || gpuSelection === "")
return _discovered.map(function(g){ return g.id; });
if (gpuSelection === "none")
return [];
return gpuSelection.split(",")
.map(function(s){ return s.trim(); })
.filter(function(s){ return s.length > 0; });
}
readonly property var _activeSensorIds: {
var ids = [];
var mm = parseGpuMetrics(gpuMetrics);
for (var i = 0; i < _activeIds.length; i++) {
var g = _activeIds[i];
var m = gpuMetricsFor(g, mm);
if (m.indexOf("usage") >= 0) ids.push("gpu/" + g + "/usage");
if (m.indexOf("vram") >= 0) {
ids.push("gpu/" + g + "/usedVram");
ids.push("gpu/" + g + "/totalVram");
}
if (m.indexOf("temp") >= 0) ids.push("gpu/" + g + "/temperature");
}
return ids;
}
// -------------------------------------------------------------------------
// Step 3: Single SensorDataModel — polls ONLY the selected sensors
// -------------------------------------------------------------------------
Sensors.SensorDataModel {
id: gpuData
sensors: root._activeSensorIds
updateRateLimit: root.updateInterval
enabled: root._activeSensorIds.length > 0
onDataChanged: root.aggregate()
onReadyChanged: { if (ready) root.aggregate(); }
}
// -------------------------------------------------------------------------
// Step 4: Aggregate values — label resolution: custom label > default name > "GPU N"
// -------------------------------------------------------------------------
function _modelValue(sensorId) {
var col = gpuData.column(sensorId);
if (col < 0) return NaN;
var idx = gpuData.index(0, col);
if (!idx.valid) return NaN;
var val = gpuData.data(idx, Sensors.SensorDataModel.Value);
return (val === undefined || val === null) ? NaN : val;
}
function aggregate() {
var ids = _activeIds;
var customLabels = parseGpuLabels(gpuLabels);
var mm = parseGpuMetrics(gpuMetrics);
var newList = [];
var totalUsage = 0, usageCount = 0;
var totalVramUsed = 0, totalVramTotal = 0, hasVram = false;
var maxTemp = NaN;
for (var i = 0; i < ids.length; i++) {
var g = ids[i];
var m = gpuMetricsFor(g, mm);
var showU = m.indexOf("usage") >= 0;
var showV = m.indexOf("vram") >= 0;
var showT = m.indexOf("temp") >= 0;
// Resolve display name: custom label > default name > fallback
var hwName = "GPU " + (i + 1);
for (var j = 0; j < _discovered.length; j++) {
if (_discovered[j].id === g) { hwName = _discovered[j].name; break; }
}
var name = customLabels[g] || hwName;
var uVal = showU ? _modelValue("gpu/" + g + "/usage") : NaN;
var vuVal = showV ? _modelValue("gpu/" + g + "/usedVram") : NaN;
var vtVal = showV ? _modelValue("gpu/" + g + "/totalVram") : NaN;
var tVal = showT ? _modelValue("gpu/" + g + "/temperature") : NaN;
var uStr = !isNaN(uVal) ? Math.round(uVal) + "%" : "";
var vStr = "";
if (!isNaN(vuVal) && !isNaN(vtVal) && vtVal > 0 && vuVal >= 0)
vStr = Utils.formatBytes(vuVal) + "/" + Utils.formatBytes(vtVal) + "G";
// tVal === 0 is ksystemstats' null sentinel for iGPU (no hwmon node)
var tStr = (!isNaN(tVal) && tVal > 0) ? Utils.formatTemp(tVal, tempUnit) : "";
newList.push({ id: g, name: name,
usage: uStr, vram: vStr, temp: tStr,
usageNumber: !isNaN(uVal) ? uVal : NaN,
tempNumber: (!isNaN(tVal) && tVal > 0) ? tVal : NaN });
if (!isNaN(uVal)) { totalUsage += uVal; usageCount++; }
if (!isNaN(vuVal) && !isNaN(vtVal) && vtVal > 0 && vuVal >= 0) {
totalVramUsed += vuVal;
totalVramTotal += vtVal;
hasVram = true;
}
if (!isNaN(tVal) && tVal > 0 && (isNaN(maxTemp) || tVal > maxTemp)) maxTemp = tVal;
}
_dataList = newList;
_usageNum = usageCount > 0 ? totalUsage / usageCount : NaN;
_usageStr = usageCount > 0 ? Math.round(_usageNum) + "%" : "";
_vramStr = (hasVram && totalVramTotal > 0)
? Utils.formatBytes(totalVramUsed) + "/" + Utils.formatBytes(totalVramTotal) + "G" : "";
_tempNum = !isNaN(maxTemp) ? maxTemp : NaN;
_tempStr = !isNaN(maxTemp) ? Utils.formatTemp(maxTemp, tempUnit) : "";
}
// Re-aggregate when gpuMetrics, labels, selection, or unit change
onGpuMetricsChanged: aggregate()
onGpuLabelsChanged: aggregate()
onGpuSelectionChanged: aggregate()
onTempUnitChanged: aggregate()
}
@@ -0,0 +1,38 @@
import QtQuick
import org.kde.ksysguard.sensors as Sensors
Item {
id: root
property bool _dbg: { console.warn("[KVitals] MemorySensors: constructing..."); return true; }
property int updateInterval: 2000
readonly property real ramPercentage: {
if (ramUsedSensor.status !== Sensors.Sensor.Ready || ramTotalSensor.status !== Sensors.Sensor.Ready)
return NaN;
if (ramTotalSensor.value <= 0) return NaN;
return (ramUsedSensor.value / ramTotalSensor.value) * 100;
}
readonly property string ramValue: {
if (isNaN(ramPercentage))
return "...";
return Utils.formatBytes(ramUsedSensor.value) + "/" + Utils.formatBytes(ramTotalSensor.value) + "G";
}
Sensors.Sensor {
id: ramUsedSensor
sensorId: "memory/physical/used"
updateRateLimit: root.updateInterval
}
Sensors.Sensor {
id: ramTotalSensor
sensorId: "memory/physical/total"
updateRateLimit: root.updateInterval
}
Component.onCompleted: {
console.warn("[KVitals] MemorySensors: ready.");
}
}
@@ -0,0 +1,43 @@
import QtQuick
import org.kde.ksysguard.sensors as Sensors
Item {
id: root
property bool _dbg: { console.warn("[KVitals] NetworkSensors: constructing..."); return true; }
property int updateInterval: 2000
property string networkInterface: "auto"
property string networkUnit: "bytes"
readonly property string netIfacePath: {
if (networkInterface === "" || networkInterface === "auto")
return "all";
return networkInterface;
}
readonly property string netDownValue: {
if (netDownSensor.status !== Sensors.Sensor.Ready) return "...";
return Utils.formatRate(netDownSensor.value, networkUnit);
}
readonly property string netUpValue: {
if (netUpSensor.status !== Sensors.Sensor.Ready) return "...";
return Utils.formatRate(netUpSensor.value, networkUnit);
}
Sensors.Sensor {
id: netDownSensor
sensorId: "network/" + root.netIfacePath + "/download"
updateRateLimit: root.updateInterval
}
Sensors.Sensor {
id: netUpSensor
sensorId: "network/" + root.netIfacePath + "/upload"
updateRateLimit: root.updateInterval
}
Component.onCompleted: {
console.warn("[KVitals] NetworkSensors: ready.");
}
}
@@ -0,0 +1,31 @@
import QtQuick
import org.kde.ksysguard.sensors as Sensors
Item {
id: root
property bool _dbg: { console.warn("[KVitals] TempSensors: constructing..."); return true; }
property int updateInterval: 2000
property string tempUnit: "C"
readonly property real tempNumericValue: {
if (tempSensor.status !== Sensors.Sensor.Ready)
return NaN;
return tempSensor.value;
}
readonly property string tempValue: {
if (isNaN(tempNumericValue)) return "--";
return Utils.formatTemp(tempNumericValue, tempUnit);
}
Sensors.Sensor {
id: tempSensor
sensorId: "cpu/all/averageTemperature"
updateRateLimit: root.updateInterval
}
Component.onCompleted: {
console.warn("[KVitals] TempSensors: ready.");
}
}
@@ -0,0 +1,99 @@
pragma Singleton
import QtQuick
import org.kde.ksysguard.sensors as Sensors
QtObject {
function formatBytes(bytes) {
if (typeof bytes !== "number" || isNaN(bytes))
return "...";
var gb = bytes / (1024 * 1024 * 1024);
return gb.toFixed(1);
}
// unit: "bytes" (default, KB/MB) or "bits" (Kb/Mb)
// Suffix convention: uppercase B = bytes, lowercase b = bits
function formatRate(bytesPerSec, unit) {
if (typeof bytesPerSec !== "number" || isNaN(bytesPerSec))
return "...";
if (unit === "bits") {
var bps = bytesPerSec * 8;
if (bps >= 1000000)
return (bps / 1000000).toFixed(1) + "Mb";
return Math.max(0, bps / 1000).toFixed(1) + "Kb";
}
var kbps = bytesPerSec / 1024;
if (kbps >= 1024)
return (kbps / 1024).toFixed(1) + "MB";
return Math.max(0, kbps).toFixed(1) + "KB";
}
// celsiusValue: raw °C number from sensor; unit: "C" or "F"
function formatTemp(celsiusValue, unit) {
if (typeof celsiusValue !== "number" || isNaN(celsiusValue))
return "";
if (unit === "F")
return Math.round(celsiusValue * 9 / 5 + 32) + "°F";
return Math.round(celsiusValue) + "°C";
}
function sensorValueOrNaN(sensor) {
if (!sensor || sensor.status !== Sensors.Sensor.Ready)
return NaN;
if (typeof sensor.value !== "number" || isNaN(sensor.value))
return NaN;
return sensor.value;
}
function firstReadyNumber(sensors, requirePositive) {
for (var i = 0; i < sensors.length; i++) {
var value = sensorValueOrNaN(sensors[i]);
if (isNaN(value))
continue;
if (requirePositive && value <= 0)
continue;
return value;
}
return NaN;
}
function maxReadyNumber(sensors, requirePositive) {
var maxValue = NaN;
for (var i = 0; i < sensors.length; i++) {
var value = sensorValueOrNaN(sensors[i]);
if (isNaN(value))
continue;
if (requirePositive && value <= 0)
continue;
if (isNaN(maxValue) || value > maxValue)
maxValue = value;
}
return maxValue;
}
function firstReadyVramPair(pairs) {
for (var i = 0; i < pairs.length; i++) {
var used = sensorValueOrNaN(pairs[i].used);
var total = sensorValueOrNaN(pairs[i].total);
if (isNaN(used) || isNaN(total))
continue;
if (total <= 0 || used < 0)
continue;
return { used: used, total: total };
}
return null;
}
function resolveColor(numericValue, warningThreshold, criticalThreshold,
warningColor, criticalColor, baseColor, inverted) {
if (isNaN(numericValue))
return baseColor;
if (inverted) {
if (numericValue <= criticalThreshold) return criticalColor;
if (numericValue <= warningThreshold) return warningColor;
} else {
if (numericValue >= criticalThreshold) return criticalColor;
if (numericValue >= warningThreshold) return warningColor;
}
return baseColor;
}
}
@@ -0,0 +1,10 @@
module sensors
singleton Utils 1.0 Utils.qml
CpuSensors 1.0 CpuSensors.qml
MemorySensors 1.0 MemorySensors.qml
TempSensors 1.0 TempSensors.qml
GpuSensors 1.0 GpuSensors.qml
BatterySensors 1.0 BatterySensors.qml
NetworkSensors 1.0 NetworkSensors.qml
DiskSensors 1.0 DiskSensors.qml
FanSensors 1.0 FanSensors.qml
@@ -0,0 +1,133 @@
# Architecture
KVitals is a KDE Plasma 6 widget (plasmoid) with a modular architecture connecting native **KSysGuard sensors** to a **QML UI** through dedicated sensor components.
## Data Flow
![KVitals Data Flow](dataflow.svg)
## Sensor Modules (`contents/ui/sensors/`)
Each system metric has its own QML component under `sensors/`. These components encapsulate all sensor subscriptions, data parsing, and value formatting for their metric.
| Module | Sensors | Exposed Properties |
|---|---|---|
| `CpuSensors.qml` | `cpu/all/usage` | `cpuValue` |
| `MemorySensors.qml` | `memory/physical/used`, `total` | `ramValue` |
| `TempSensors.qml` | `cpu/all/averageTemperature` | `tempValue` |
| `GpuSensors.qml` | `gpu/all/usage`, `totalVram`, `usedVram`, `temperature` | `gpuValue`, `gpuRamValue`, `gpuTempValue`, `gpuDisplayValue`, `hasGpuData` |
| `BatterySensors.qml` | `power/<device>/chargePercentage`, `chargeRate` | `batValue`, `powerValue` |
| `NetworkSensors.qml` | `network/<iface>/download`, `upload` | `netDownValue`, `netUpValue` |
A shared `Utils.qml` singleton provides formatting helpers (`formatBytes`, `formatRate`) and sensor-reading utilities (`sensorValueOrNaN`, `firstReadyNumber`, `maxReadyNumber`, `firstReadyVramPair`).
### Performance Benefits
1. **Zero Subprocesses**: No `bash`, `awk`, or `cat` commands are spawned.
2. **Stable File Descriptors**: No CLI pipes need to be kept open, eliminating Plasma 6 Wayland FD-exhaustion crashes.
3. **Low Latency**: The widget reads the exact same backend API as the official KDE System Monitor.
## Orchestrator (`main.qml`)
`main.qml` acts as a lightweight orchestrator:
1. **Reads configuration** from `Plasmoid.configuration`
2. **Instantiates sensor modules** with the configured `updateInterval`
3. **Builds metrics models** using the `orderedKeys` array (derived from the `metricOrder` config)
4. **Applies view-specific visibility rules** such as `compactShow*` settings and compact grouping
5. **Passes models** to `CompactView` and `FullView` for rendering
```
main.qml
├── CpuSensors { id: cpu }
├── MemorySensors { id: memory }
├── TempSensors { id: temp }
├── GpuSensors { id: gpu }
├── BatterySensors { id: battery }
├── NetworkSensors { id: network }
├── compactRepresentation: CompactView { metricsModel: ... }
└── fullRepresentation: FullView { metricsModel: ... }
```
## Views
### CompactView (Panel)
A `RowLayout` with a `Repeater` that renders each compact-visible metric as:
- **Icon** (optional, via `Kirigami.Icon` with `isMask: true`)
- **Label** (optional, e.g., "CPU:")
- **Value** (always shown, e.g., "26%")
- **Separator** (`|` between metrics)
Visibility of icons/labels is controlled by the `displayMode` property. Metric inclusion is controlled by both the metric-level `show*` settings and the compact-panel `compactShow*` settings, allowing a metric to remain visible in the popup/tooltip while being hidden from the panel.
The compact panel also supports horizontal and vertical delegates through the `layoutType` setting.
!!! tip
Icons use `isMask: true` to render as monochrome, matching the panel's text color regardless of the icon theme.
### FullView (Popup)
A `ColumnLayout` with a `Repeater` showing a detailed row per enabled metric with label and bold value, displayed when clicking the widget.
### Tooltip
Multi-line text showing all enabled metrics, displayed on hover. Compact-panel visibility settings do not filter the tooltip.
## Configuration System
```
config/main.xml ← Config schema (entry names, types, defaults)
config/config.qml ← Tab registration (General, Metrics, Icons, Colors)
ui/configGeneral.qml ← General tab (display mode, layout, font, interval)
ui/configMetrics.qml ← Metrics tab (show/hide toggles, compact panel visibility, metric order, grouping, network interface, battery device)
ui/configIcons.qml ← Icons tab (per-metric icon picker)
ui/configColors.qml ← Colors tab (font color, warning/critical colors, thresholds)
```
All config values are accessed in `main.qml` via `Plasmoid.configuration.<key>`.
!!! tip "Adding a New Sensor"
1. Create `contents/ui/sensors/NewSensor.qml` exposing formatted value properties
2. Register it in `sensors/qmldir`
3. Instantiate it in `main.qml`
4. Add it to the `orderedKeys` loop in compact/full/tooltip builders
5. Add `show*` and `compactShow*` config entries in `main.xml`
6. Add the metric and compact panel checkboxes in `configMetrics.qml`
## Project Structure
```
kvitals/
├── metadata.json # Plasmoid metadata (name, version, id)
├── install.sh # Local install script
├── install-remote.sh # Remote install (curl/wget)
├── CHANGELOG.md # Version history
├── docs/ # Documentation
│ ├── installation.md
│ ├── configuration.md
│ ├── architecture.md
│ ├── contributing.md
│ └── troubleshooting.md
└── contents/
├── config/
│ ├── config.qml # Tab registration
│ └── main.xml # Config schema
└── ui/
├── main.qml # Widget orchestrator
├── CompactView.qml # Panel representation
├── FullView.qml # Popup representation
├── configGeneral.qml # General settings tab
├── configMetrics.qml # Metrics settings tab
├── configIcons.qml # Icons settings tab
├── configColors.qml # Colors settings tab
└── sensors/ # Sensor modules
├── qmldir # QML module definition
├── CpuSensors.qml # CPU usage
├── MemorySensors.qml # RAM usage
├── TempSensors.qml # CPU temperature
├── GpuSensors.qml # GPU usage, VRAM, temp
├── BatterySensors.qml # Battery & power
├── NetworkSensors.qml # Network speed
└── Utils.qml # Shared formatting helpers
```
@@ -0,0 +1,250 @@
# Changelog
All notable changes to KVitals will be documented in this file.
## [2.10.1] - 2026-06-29
### Fixed
- **Plasmashell Boot Crashes**: Resolved a critical race condition that caused `plasmashell` to enter a crash loop during system boot. Sensor module loading is now deferred until after window attachment is fully complete, preventing the `KirigamiPlasmaStyle` SIGSEGV (#49).
## [2.10.0] - 2026-06-27
### Added
- **Fan Speed Monitoring** (`Metrics` settings): A new standalone "Fan" metric that dynamically discovers and reports fan speeds (including GPU and CPU fans) directly from the system (#47).
- Automatically identifies fans through `SensorTreeModel`.
- Supports RPM and Percentage display units (configurable in `General` settings).
- Fully integrates with compact panel, full popup, and tooltip views.
- Safely handles fans that do not report a maximum RPM by omitting them from percentage-based aggregations to prevent misleading data.
- **Display Mode 'None'** (`General` settings): A new display mode that completely hides the metric labels and icons, showing only the raw values to save space (#47).
- **Config UI Redesign** (`Metrics` settings): The metrics configuration page has been overhauled for better UX, with inline contextual settings (e.g. CPU, GPU, Network options expand directly under their respective metrics) and debounced sensor discovery to eliminate UI freezes on load (#48).
## [2.9.0] - 2026-06-19
### Added
- **Per-GPU Sub-metric Visibility** (`Metrics` settings — GPU Selection): Each GPU entry now has independent **Usage**, **VRAM**, and **Temperature** toggles, letting you show only the metrics you care about without disabling the GPU entirely (#44).
- Toggling a sub-metric off immediately stops polling those sensors — no unnecessary kernel data fetched.
- A **minimum-one** guard prevents all three sub-metrics from being deselected at once (the last checked box is disabled), keeping at least one value visible per GPU.
- Sub-metric checkboxes are automatically disabled when the parent GPU is deselected, matching visual state to functional reality.
- Storage format uses a compact pipe-separated string (`gpu0:usage,vram|gpu1:usage,temp`). GPUs using all defaults are omitted, keeping the config short. Empty string (default) = all three enabled for every GPU — fully backwards-compatible with existing configs.
## [2.8.1] - 2026-05-23
### Fixed
- **Installation via KDE Store leaving stale widget state** (`install-remote.sh`): Users who first installed via the KDE Store (or an older `install-remote.sh`) and then upgraded manually could end up with a mismatched `kpackage/generic/` registration. This caused settings like **Show in compact panel** to silently not apply, because KDE resolves widget configuration from the kpackage path, not the plasmoids path. The remote install script now mirrors the local `install.sh` behaviour exactly: it removes any previous entry under `~/.local/share/kpackage/generic/<id>` (including stale symlinks), creates the install directory under `~/.local/share/plasma/plasmoids/`, and creates a fresh symlink at the kpackage path pointing to it.
## [2.8.0] - 2026-05-22
### Added
- **Disk I/O & Temperature** (`Metrics` settings — Disk I/O & Temp): New metric showing real-time disk read/write rates and the highest drive temperature across all NVMe and SATA drives. Displayed as `DSK: ↓2.1MB ↑76KB · 42°C` in the compact panel (#36).
- Drive temperatures are discovered dynamically via `SensorTreeModel` + `lmsensors` (supports `nvme-pci-*` and `drivetemp-scsi-*` chips) — zero polling overhead when the metric is disabled.
- Dedicated **Disk Temp** threshold sliders added to the Colors settings page (default: warning 45°C, critical 60°C).
- **Unit Preferences** (`General` settings — Unit Preferences section): Choose display units globally across all metrics (#37).
- **Temperature**: Celsius (°C, default) or Fahrenheit (°F). Applies to CPU temp, GPU temp, and Disk temp everywhere — panel, popup, and tooltip.
- **Network / Disk I/O**: Bytes (KB/MB, default) or Bits (Kb/Mb). Applies to Network and Disk I/O rates. Suffix convention follows industry standard: uppercase `B` = bytes, lowercase `b` = bits.
- Threshold slider labels in the Colors settings page update live to reflect the chosen temperature unit (stored values remain in °C for correct sensor comparison).
## [2.7.0] - 2026-05-15
### Added
- **Multi-GPU Support** (`Metrics` settings — GPU Selection): On systems with more than one GPU, each GPU is now listed individually as a separate metric in both the compact panel and the full popup view (#22). Works automatically — no configuration needed on single-GPU machines.
- Each GPU is detected dynamically via `SensorTreeModel` metadata; no persistent subscriptions run during discovery.
- The GPU Selection section in settings shows all discovered GPUs with independent enable/disable checkboxes.
- **GPU Custom Labels** (`Metrics` settings — GPU Selection): On multi-GPU systems, each GPU entry in the panel shows a customizable label. Type a name in the **Label** field (e.g. `iGPU`, `dGPU`) to override the default `GPU 1` / `GPU 2` identifiers. Leave it empty to keep the default numbering.
- **Hybrid GPU power hint**: When two or more GPUs are detected, a contextual note appears in the GPU Selection section explaining that unchecking the discrete GPU prevents KVitals from polling it, allowing it to suspend when idle.
### Fixed
- **Unintended dGPU Wakeup** on hybrid GPU laptops (Intel/AMD + NVIDIA setups using `supergfxctl` / `asusctl`): The previous implementation used permanent `Sensors.Sensor` subscriptions for up to 6 hardcoded GPU slots. These subscriptions polled every GPU continuously, preventing the dGPU from entering its suspended/power-save state even when it was idle (#26).
- **New architecture**: Discovery uses `SensorTreeModel` + `KDescendantsProxyModel` (pure metadata query, no value subscriptions). Data polling uses a single `SensorDataModel` constrained strictly to the GPUs the user has selected.
- **Result**: Deselecting a GPU in settings stops all polling for that GPU immediately. On hybrid setups, unchecking the dGPU allows it to fully suspend.
- **Note**: If the dGPU remains active even after unchecking it in KVitals, the cause is likely unrelated — some Xwayland applications keep the GPU awake independently of any sensor polling. This is a system/compositor-level behavior outside the scope of KVitals.
## [2.6.0] - 2026-05-10
### Added
- **Compact Panel Visibility** (`Metrics` settings): Each metric now has an independent "Show in compact panel" toggle, allowing metrics to appear in the full popup view but stay hidden from the panel bar (#29, thanks @keiishu). Disabling a metric preserves its compact visibility state for when it is re-enabled.
- **CPU Frequency** (`Metrics` settings): Display the average CPU frequency in the widget. Auto-formats as GHz (≥ 1000 MHz) or MHz (#33).
- **Merge into CPU** (compact view): Appends frequency as a second segment next to CPU usage (`CPU: 34% · 3.20 GHz`). Compatible with Merge CPU & Temp — all three values appear as segments.
- **Full view sub-item**: When enabled, CPU Frequency appears as a dedicated row directly under CPU Usage in the popup.
- **Bold Font** (`General` settings): Toggle bold styling for all metric value labels across compact and full views (#30). Defaults to off.
### Fixed
- Inconsistent font weight across metrics in vertical layout: RAM and Network values (rendered via `SegmentsRow`) were always bold while CPU/GPU were not. All value labels now follow the new Bold Font setting uniformly.
## [2.5.0] - 2026-04-30
### Added
- **Layout Type** (`General` settings): Choose between **Horizontal** (default, unchanged) and **Vertical** layout for the compact panel view. In vertical mode, the metric value is displayed on top with the label/icon dimmed below — ideal for tall panels or icon-only display (#11).
- **Metric Grouping** (`Metrics` settings — Grouping section):
- **Merge CPU & Temp**: Combines CPU temperature as a second value next to CPU usage (`CPU: 45% · 62°C`), using the same segment display as GPU. The CPU Temperature entry is hidden from the metric order list while merged.
- **Merge Battery & Power**: Combines power consumption as a second value next to battery level (`BAT: 87% · 12.4W`). Power Consumption entry is hidden from the metric order list while merged.
- **Split GPU Metrics**: Optionally break GPU usage, VRAM and temperature into separate panel entries instead of the default grouped display (default: grouped).
### Changed
- Metric order list now hides absorbed metrics when grouping is active (e.g. "CPU Temperature" disappears when "Merge CPU & Temp" is enabled), keeping the list clean and non-redundant.
- `CompactView` refactored to use a `Loader`-based delegate system, enabling runtime layout switching without widget reload.
### Fixed
- `Unable to assign [undefined] to QColor` runtime error when CPU+Temp or Battery+Power merge was enabled — missing top-level `color` field on segmented metric objects.
- Defensive `|| baseTextColor` fallback added to all value label color bindings in `CompactView`.
## [2.4.0] - 2026-04-01
### Added
- **Custom Font Color**: Override the widget font color to match your panel theme (#20). Configurable via the new **Colors** settings tab.
- **Threshold-Based Coloring**: Metric values dynamically change color when they exceed configurable warning/critical thresholds (#12). Supported metrics:
- CPU usage (default: warning 70%, critical 90%)
- CPU temperature (default: warning 60°C, critical 85°C)
- RAM usage (default: warning 70%, critical 90%)
- GPU usage (default: warning 70%, critical 90%)
- GPU temperature (default: warning 60°C, critical 85°C)
- Battery level (inverted: warning below 30%, critical below 15%)
- **Colors Config Tab**: New settings page with color pickers for font/warning/critical colors and per-metric threshold sliders.
- Sensor modules now expose raw numeric values (`cpuNumericValue`, `tempNumericValue`, `ramPercentage`, `batNumericValue`) for threshold comparison.
- `Utils.resolveColor()` function for flexible threshold-triggered color resolution.
### Fixed
- Fixed the Colors tab color picker turning white after selecting a color; it now uses a stable native platform color dialog and preserves the selected swatch correctly.
### Notes
- Network and Power metrics are excluded from threshold coloring (no meaningful universal threshold).
- Both features are **opt-in** — disabled by default. Existing users are unaffected.
## [2.3.0] - 2026-03-13
### Changed
- **Sensor Module Architecture**: Extracted all sensor logic from `main.qml` into dedicated QML components under `contents/ui/sensors/`:
- `CpuSensors.qml` — CPU usage monitoring
- `MemorySensors.qml` — RAM usage monitoring
- `TempSensors.qml` — CPU temperature monitoring
- `GpuSensors.qml` — GPU usage, VRAM, and temperature monitoring
- `BatterySensors.qml` — Battery and power monitoring with auto-detection
- `NetworkSensors.qml` — Network download/upload speed monitoring
- `Utils.qml` — Shared formatting helpers (byte formatting, rate formatting)
- **View Separation**: Extracted compact and full representations into `CompactView.qml` and `FullView.qml`.
- **Reduced `main.qml`**: From ~700 lines to ~140 lines — now acts purely as an orchestrator.
### Notes
- No user-facing or configuration changes. The widget behaves identically to v2.2.1.
- This refactor improves maintainability and makes it easier to add new sensor types in the future.
## [2.2.1] - 2026-03-07
### Fixed
- **Battery Detection Hotfix**: Replaced `SensorTreeModel` with a crash-free **Two-Stage Hybrid Detection** system (#14):
- **Stage 1 (Silent Probe)**: Silently probes common battery paths (`BAT0`, `BAT1`, `BATT`, etc.) for instant detection without running any subprocesses.
- **Stage 2 (Fallback)**: If no standard battery is found, falls back to a single `qdbus` query to list all sensors, completely avoiding `PlasmaCore.DataSource` file descriptor leaks. Includes a manual config fallback if `qdbus` is unavailable.
## [2.2.0] - 2026-03-05
### Added
- **Custom Metric Order**: Added a new configuration option to arrange metrics (CPU, RAM, GPU, etc.) individually in whatever order you prefer (#7).
- **Dynamic Battery Detection**: Replaced hardcoded `BAT0`/`BAT1` sensors with dynamic `SensorTreeModel` discovery. The widget will now automatically find any battery your system has (BAT0, BATT, CMB0, macsmc-battery, etc.) (#14).
## [2.1.1] - 2026-03-03
### Fixed
- Fixed a "Detected anchors on an item that is managed by a layout" QML warning spanning the journal log caused by a `MouseArea` anchoring inside a `RowLayout` (#13).
## [2.1.0] - 2026-03-01
### Added
- **GPU Metrics Support**: Added VRAM usage and GPU temperature monitoring to the widget.
- GPU data is retrieved natively using KDE KSysGuard sensors (`org.kde.ksysguard.sensors`).
## [2.0.0] - 2026-02-27
### Changed
- **Major Architecture Overhaul**: Replaced the previous `sys-stats.sh` backend with native KDE KSysGuard sensors (`org.kde.ksysguard.sensors`).
- Completely eliminates "file descriptor leak" crashes (Issue #8) and improves overall performance by relying directly on the `ksystemstats` D-Bus daemon instead of constantly spawning bash processes.
- Automatic fallback for battery monitoring (BAT0 and BAT1) logic implemented directly in QML.
## [1.4.1] - 2026-02-24
### Fixed
- RAM usage showing empty on non-English locales — `free` translates its `Mem:` header based on locale, causing the parser to match nothing
- Switched RAM data source from `free -b` to `/proc/meminfo` (locale-independent, faster, more accurate)
## [1.4.0] - 2026-02-22
### Added
- **Display mode setting** — choose between Text, Icons, or Icons + Text for the panel
- **Custom icon picker** — select icons from your installed theme for each metric (via KDE's native icon picker)
- **Icon size slider** — adjust icon size (8–24px) when using icon mode
- **Font customization** — choose any system font and font size for the panel text
- **Settings tabs** — split configuration into General, Metrics, and Icons tabs
- **Reset to defaults** button on the Icons tab
- **CHANGELOG.md** — version history
- **Documentation** — MkDocs site with installation, configuration, architecture, contributing, and troubleshooting guides
## [1.3.0] - 2026-02-16
### Added
- Power consumption tracking (via `/sys/class/power_supply/`) — contributed by [@Pijuli](https://github.com/Pijuli)
### Fixed
- ShellCheck warnings from power consumption PR (SC2034, SC2155)
## [1.2.1] - 2026-02-16
### Fixed
- AMD CPU temperature detection — added `k10temp`, `zenpower`, `zenergy`, `amdgpu` to thermal_zone and hwmon detection
- lm-sensors fallback now matches AMD `Tccd1` label
- Reordered temperature fallback tiers to prioritize CPU-specific sources over generic thermal zones
## [1.2.0] - 2026-02-13
### Added
- Auto-detect network interface via `ip route` with manual override in settings
- Network interface selector in widget configuration
### Fixed
- ShellCheck warnings (SC2010, SC2155)
## [1.1.0] - 2026-02-12
### Changed
- Modularized `sys-stats.sh` into functions
- Enhanced CPU temperature detection with 4-tier fallback (thermal_zone → hwmon → lm-sensors → generic)
## [1.0.0] - 2026-02-12
### Added
- Initial release
- CPU usage (delta-based from `/proc/stat`)
- RAM usage (from `/proc/meminfo`)
- CPU temperature (multi-source detection)
- Battery status with emoji indicators
- Network speed (delta-based from `/proc/net/dev`)
- Configurable update interval
- Toggle visibility per metric
@@ -0,0 +1,156 @@
# Configuration
Right-click the widget → **Configure KVitals...** to open the settings dialog. Settings are organized into four tabs.
## General Tab
| Setting | Description | Default |
|---------------------|--------------------------------------------------------------------------------|--------------------|
| **Display mode** | How metrics are shown in the panel | Text |
| **Layout** | Compact panel layout direction | Horizontal |
| **Icon size** | Icon dimensions in pixels (only visible when using icons) | 12 px |
| **Font** | Font family for all panel text (searchable dropdown of system fonts, editable) | monospace |
| **Font size** | Text size in pixels. `0` uses the system default | 0 (system default) |
| **Update interval** | How often stats are refreshed | 2.0 seconds |
### Display Modes
| Mode | Description |
|------------------|---------------------------------------------------------------|
| **Text** | Labels + values: `CPU: 26% \| RAM: 8.8/39.0G` |
| **Icons** | Icons + values only: `🖥 26% \| 🧠 8.8/39.0G` |
| **Icons + Text** | Icons + labels + values: `🖥 CPU: 26% \| 🧠 RAM: 8.8/39.0G` |
!!! tip "Saving Panel Space"
**Icons** mode is the most compact — great for small panels or when you have many metrics enabled.
### Layout Types
| Layout | Description |
|----------------|--------------------------------------------------------------|
| **Horizontal** | Shows each compact metric in a single row, separated by `\|` |
| **Vertical** | Stacks the value above the icon |
## Metrics Tab
| Setting | Description | Default |
|---------------------------|-----------------------------------------------------------------------------------|--------------------------------------|
| **Metric Order** | Use the up/down buttons to rearrange metrics in the panel | CPU, RAM, Temp, GPU, Bat, Power, Net |
| **Metric enable toggles** | Enables or disables each metric | On |
| **Show in compact panel** | Controls whether each enabled metric appears in the panel representation | On |
| **Network interface** | Select network interface (`auto` or manual) | auto |
| **Battery device** | Leave empty for automatic battery detection, or enter a sensor device id manually | auto |
### Supported Metrics
| Metric | Compact Label | Description |
|-----------------------|---------------|-----------------------------------------------------|
| **CPU Usage** | `CPU:` | CPU utilization percentage |
| **RAM Usage** | `RAM:` | Used/total memory |
| **CPU Temperature** | `TEMP:` | CPU temperature in °C |
| **GPU Metrics** | `GPU:` / `<name>:` | GPU usage %, VRAM used/total, and GPU temperature. On multi-GPU systems, each selected GPU appears as a separate labeled entry. |
| **Battery Status** | `BAT:` | Battery percentage |
| **Power Consumption** | `PWR:` | Power draw in watts |
| **Network Speed** | `NET:` | Download/upload speeds |
### Compact Panel Visibility
Each metric has two visibility controls:
| Control | Effect |
|---------------------------|-----------------------------------------------------------------------------------------------------------------------------|
| **Metric checkbox** | Enables the metric globally. |
| **Show in compact panel** | Hides or shows the metric in the panel widget. The metric remains available in the dropdown menu and tooltip while enabled. |
Use this when you still want to track a metric in the tooltip or dropdown but want to hide it from the panel to save
space.
### Grouping
| Setting | Description | Default |
|---------------------------|-----------------------------------------------------------------------------------------------------------|---------|
| **Merge CPU & Temp** | Shows CPU temperature as a second value next to CPU usage in the widget | Off |
| **Merge Battery & Power** | Shows power consumption as a second value next to battery level in the widget | Off |
| **Split GPU metrics** | Shows GPU usage, VRAM, and GPU temperature as separate compact panel entries instead of one grouped entry | Off |
Merged compact rows only absorb the second metric when both metrics are enabled and selected for the compact panel.
### Network Interface
When set to `auto`, the widget natively aggregates the traffic across all active network connections using KDE's
`network/all` sensor. This handles VPN routing and switching networks automatically.
You can manually select a specific interface (e.g., `wlan0`, `enp3s0`) from the dropdown if you only want to monitor a
single device.
!!! note
The manual interface list is populated dynamically from `/sys/class/net/`.
### GPU Selection
When the **GPU Metrics** metric is enabled, a **GPU Selection** section appears listing every GPU detected on your
system. GPUs are discovered dynamically via the KDE sensor tree — no polling is required during discovery.
| Control | Description |
|------------------|-----------------------------------------------------------------------------------------------|
| **Checkbox** | Enable or disable monitoring for each individual GPU |
| **Label field** | Override the display name for a GPU. Leave empty to use the name reported by ksystemstats. |
**Label resolution order**: custom label → ksystemstats-provided name (e.g. `GPU 1`) → `GPU N` fallback.
!!! tip "Hybrid GPU Laptops (Intel/AMD + NVIDIA)"
On hybrid setups using tools such as `supergfxctl` or `asusctl`, KVitals will only poll the GPUs whose
checkboxes are ticked. **Unchecking the discrete GPU** stops all polling for it, allowing it to enter its
suspended/power-save state when idle.
## Icons Tab
Each metric has its own icon that can be customized:
| Metric | Default Icon | Icon Name |
|-------------|--------------|-----------------------|
| CPU | 🖥 | `cpu` |
| RAM | 🧠 | `memory` |
| Temperature | 🌡 | `temperature-normal` |
| GPU | GPU | `video-card` |
| Battery | 🔋 | `battery-good` |
| Power | ⚡ | `battery-charging-60` |
| Network | 📶 | `network-wireless` |
Click **"Change..."** to open KDE's native icon picker, which lets you browse and search all icons from your installed
icon theme (Breeze, Papirus, Tela, etc.).
Click **"Reset to defaults"** to restore all icons to their default values.
!!! note "Monochrome Rendering"
Icons are rendered with `isMask: true`, meaning they adopt the panel's text color (monochrome). This ensures
visibility on both light and dark panels.
!!! tip "Finding Icons"
The icon picker shows all icons from your installed theme. Use the search bar to find icons by name — try keywords
like "chip", "thermometer", "download", or "lightning".
## Colors Tab
| Setting | Description | Default |
|-------------------------------|--------------------------------------------------------------|-------------------------|
| **Use custom font color** | Overrides the widget text color with a custom color | Off |
| **Color** | Font color as a picked or typed `#RRGGBB` value | Plasma theme text color |
| **Enable threshold coloring** | Changes color of supported metric values based on thresholds | Off |
| **Warning color** | Color used when a warning threshold is reached | `#e5a50a` |
| **Critical color** | Color used when a critical threshold is reached | `#da4453` |
Threshold coloring supports CPU usage, CPU temperature, RAM usage, GPU usage, GPU temperature, and battery level.
| Metric | Default warning color | Default critical color |
|-----------------|-----------------------|------------------------|
| CPU usage | 70% | 90% |
| CPU temperature | 60°C | 85°C |
| RAM usage | 70% | 90% |
| GPU usage | 70% | 90% |
| GPU temperature | 60°C | 85°C |
| Battery level | 30% | 15% |
!!! note "Battery Thresholds"
Battery thresholds are inverted: warning and critical states trigger when the battery level falls _below_ the
configured values.
@@ -0,0 +1,86 @@
# Contributing
Thanks for your interest in contributing to KVitals!
## Getting Started
1. Fork the repository
2. Clone your fork:
```bash
git clone https://github.com/<your-username>/kvitals.git
cd kvitals
```
3. Install locally for development:
```bash
bash install.sh
```
## Development Workflow
### Making Changes
1. Edit files in the project directory
2. Reinstall and test:
```bash
bash install.sh
kquitapp6 plasmashell && kstart plasmashell &
```
3. Check for QML errors:
```bash
journalctl -b --no-pager | grep kvitals
```
!!! tip "Fast Iteration"
You don't always need to restart plasmashell. For config-only changes, just reopen the settings dialog. For QML changes, a restart is required.
### Adding a New Metric
1. **Sensors** — Find the relevant `org.kde.ksysguard.sensors` sensor ID using `kstatsviewer`
2. **Settings** — Add `show*` and `compactShow*` entries to `contents/config/main.xml`
3. **Configuration UI** — Add the metric and compact visibility checkboxes to `configMetrics.qml`
4. **Icons** — Add an icon picker to `configIcons.qml`
5. **UI** — Add property bindings and model entries in `main.qml`
!!! note
Don't forget to add a default icon name for the new metric in `configIcons.qml`'s reset button handler.
### Adding a New Setting
1. Add the entry to `contents/config/main.xml` with a default value
2. Add the UI control to the appropriate config tab (`configGeneral.qml`, `configMetrics.qml`, `configIcons.qml`, or `configColors.qml`)
3. Bind the value in `main.qml` via `Plasmoid.configuration.<key>`
## Pull Requests
1. Create a feature branch: `git checkout -b feat/my-feature`
2. Make your changes and test locally
3. Ensure ShellCheck passes
4. Push and open a PR against `master`
!!! tip "Commit Messages"
Use conventional commits for clear history:
- `feat:` — New feature
- `fix:` — Bug fix
- `chore:` — Maintenance
- `docs:` — Documentation
## Code Style
- **QML** — Follow KDE's QML conventions, use `Kirigami` components where possible
- **Commits** — Use conventional commits: `feat:`, `fix:`, `chore:`, `docs:`
## Reporting Issues
When filing a bug report, please include:
- KDE Plasma version (`plasmashell --version`)
- Linux distribution and version
- Whether you're using Intel or AMD CPU
- Relevant journal output (`journalctl -b | grep kvitals`)
!!! note "Debugging Output"
To capture detailed logs for a bug report:
```bash
journalctl -b --no-pager | grep -i "kvitals\|sys-state" > kvitals-debug.log
```
File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 32 KiB

@@ -0,0 +1,30 @@
# KVitals
A lightweight KDE Plasma 6 panel widget that displays live system vitals directly in your top bar.
```
CPU: 26% | RAM: 8.8/39.0G | TEMP: 96°C | 🔋BAT: 78% | PWR: +20W | NET: ↓82.2K ↑58.9K
```
## Features
- **Live monitoring** — CPU, RAM, temperature, GPU, battery, power, network
- **Display modes** — Text, Icons, or Icons + Text
- **Custom icons** — Pick any icon from your installed KDE theme
- **Font customization** — Choose any system font and size
- **Settings tabs** — General, Metrics, Icons, and Colors
- **Minimal footprint** — Native KSysGuard integration + QML, no heavy dependencies
## Quick Start
```bash
git clone https://github.com/yassine20011/kvitals.git
cd kvitals && bash install.sh
```
Then right-click your panel → **Add Widgets** → search **KVitals**.
## Links
- [GitHub Repository](https://github.com/yassine20011/kvitals)
- [KDE Store](https://www.pling.com/p/2347917/)
@@ -0,0 +1,58 @@
# Installation
## KDE Store (Recommended)
Install directly from the KDE Store:
👉 **[Get KVitals on the KDE Store](https://www.pling.com/p/2347917/)**
Or from within KDE Plasma:
1. Right-click on the panel → **Add Widgets...**
2. Click **Get New Widgets...** → **Download New Plasma Widgets...**
3. Search for **"KVitals"**
4. Click **Install**
## Quick Install (curl)
```bash
curl -fsSL https://github.com/yassine20011/kvitals/releases/latest/download/install-remote.sh | bash
```
## Quick Install (wget)
```bash
wget -qO- https://github.com/yassine20011/kvitals/releases/latest/download/install-remote.sh | bash
```
## Manual Install
```bash
git clone https://github.com/yassine20011/kvitals.git
cd kvitals
bash install.sh
```
Then add the widget:
1. Right-click on the panel → **Add Widgets...**
2. Search for **KVitals**
3. Drag it onto your panel
!!! note "Restart Required"
You may need to restart Plasma for the widget to appear:
```bash
plasmashell --replace &
```
## Requirements
- KDE Plasma 6.0+
## Uninstall
```bash
rm -rf ~/.local/share/plasma/plasmoids/org.kde.plasma.kvitals
plasmashell --replace &
```
!!! warning
This permanently removes the widget and all its configuration. Your settings will not be preserved.
@@ -0,0 +1,39 @@
# As a condition of accessing this website, the website operator
# explicitly GRANTS permission for the following content signals:
# search: building a search index and providing search results
# ai-input: inputting content into one or more AI models
# ai-train: training or fine-tuning AI models.
# BEGIN Content Signals
User-agent: *
Content-Signal: search=yes,ai-input=yes,ai-train=yes
Allow: /
# END Content Signals
# Explicitly welcoming popular AI scrapers and search bots
User-agent: Amazonbot
Allow: /
User-agent: Applebot-Extended
Allow: /
User-agent: Bytespider
Allow: /
User-agent: CCBot
Allow: /
User-agent: ClaudeBot
Allow: /
User-agent: Google-Extended
Allow: /
User-agent: GPTBot
Allow: /
User-agent: meta-externalagent
Allow: /
Sitemap: https://kvitals.dev/sitemap.xml
@@ -0,0 +1,141 @@
# Troubleshooting
## Temperature Shows "--"
**Cause:** The widget couldn't find a temperature source on your system.
**Fix:** Check which thermal sources are available:
```bash
# Check thermal zones
cat /sys/class/thermal/thermal_zone*/type 2>/dev/null
# Check hwmon
for d in /sys/class/hwmon/hwmon*/; do
echo "$(cat "$d/name" 2>/dev/null): $d"
done
# Check lm-sensors
sensors 2>/dev/null | head -20
```
!!! tip "AMD Systems"
If you're on AMD, make sure `k10temp` or `zenpower` kernel module is loaded:
```bash
sudo modprobe k10temp
```
To load it automatically on boot, add `k10temp` to `/etc/modules-load.d/k10temp.conf`.
## RAM Shows Empty (versions ≤ 1.4.0)
**Cause:** On versions before 1.4.1, RAM was read by parsing the `free` command, which translates its output headers (e.g. `Mem:`) based on your system locale. Non-English locales caused the parser to match nothing.
**Fix:** Update to KVitals 1.4.1+, which reads directly from `/proc/meminfo` (always English, locale-independent).
## Battery/Power Shows Nothing
**Cause:** No battery detected (e.g., desktop systems without a battery or UPS).
**Behavior in KVitals (v2.2.0+):** The widget uses KDE's native `SensorTreeModel` to dynamically scan your system's hardware tree for any connected battery (including `BAT0`, `BAT1`, `BATT`, `CMB0`, `macsmc-battery`, etc.). If nothing shows up, it means the KDE `ksystemstats` daemon cannot find a battery API on your machine.
!!! note
This is expected behavior on desktop systems. Disable battery and power metrics in **Settings → Metrics** tab to hide the empty entries.
## Network Speed Shows 0
**Cause:** Wrong network interface selected.
**Fix:**
1. Open **Settings → Metrics** and ensure the network interface is set to `auto`.
2. If you want to monitor a specific connection, select it from the dropdown list.
!!! tip
If you use multiple connections (WiFi + Ethernet), set the interface manually to the one you want to monitor.
## GPU Shows Only Usage (or Missing VRAM/Temp)
**Cause:** GPU sensor availability depends on your driver/backend. Some systems expose only usage, while VRAM or temperature sensors are missing or report no data.
**Behavior in KVitals:** The widget now shows only the GPU fields that are available on your system (no placeholder `...` / `--` for unsupported GPU sub-metrics).
**Fix/Debug:** List GPU sensor IDs reported by Plasma KSystemStats:
```bash
qdbus --literal org.kde.ksystemstats1 /org/kde/ksystemstats1 org.kde.ksystemstats1.allSensors \
| rg -o '"gpu/[^"]+"' | tr -d '"' | sort -u
```
Then test a specific sensor value:
```bash
qdbus --literal org.kde.ksystemstats1 /org/kde/ksystemstats1 org.kde.ksystemstats1.sensorData gpu/all/usage
```
!!! tip
On multi-GPU systems, per-GPU sensors such as `gpu/gpu1/*` may exist even when aggregate sensors are partial.
## Metric Shows in Popup But Not Panel
**Cause:** The metric is enabled, but its **Show in compact panel** checkbox is disabled in the Metrics settings.
**Fix:**
1. Open **Settings → Metrics**.
2. Find the metric in the order list.
3. Enable **Show in compact panel** under that metric.
!!! note
Compact grouping also depends on compact visibility. For example, **Merge CPU & Temp** only shows temperature next to CPU when both metrics are enabled and selected for the compact panel.
## Widget Shows "KVitals" or "..."
**Cause:** The KSysGuard daemon hasn't returned sensor data yet.
**Fix:** Wait a few seconds for the data to populate. If it still doesn't, try restarting the `plasma-ksystemstats` service:
```bash
systemctl --user restart plasma-ksystemstats.service
```
## Icons Not Visible on Panel
**Cause:** Icons are rendered with `isMask: true` (monochrome). If your panel background is the same color as the text color, icons may be invisible.
!!! tip
Try switching to a different Plasma theme, or adjust the panel opacity. You can also switch to **Text** display mode if icons aren't working well with your theme.
## Settings Dialog Shows Warnings in Journal
!!! note "Harmless Warnings"
You may see `cfg_*Default` warnings in the journal. These are harmless Plasma 6 KCM warnings about default property injection and **do not affect functionality**.
## Widget Not Appearing After Install
**Fix:**
1. Restart plasmashell:
```bash
kquitapp6 plasmashell && kstart plasmashell &
```
2. If still missing, check the install path:
```bash
ls ~/.local/share/plasma/plasmoids/org.kde.plasma.kvitals/
```
!!! warning
If the directory doesn't exist, the install failed. Re-run `bash install.sh` from the project directory.
## Custom Font Not Applying
**Cause:** The font name might not match exactly.
**Fix:**
1. Check available fonts: `fc-list | grep -i "font-name"`
2. In settings, use the exact family name from the dropdown
3. Font size `0` means "use system default" — set a specific value if needed
!!! tip
The font dropdown is searchable — start typing the font name to filter the list. You can also type a custom font name directly.
@@ -0,0 +1,51 @@
#!/usr/bin/env bash
set -euo pipefail
REPO="yassine20011/kvitals"
PLASMOID_ID="org.kde.plasma.kvitals"
DEST_DIR="$HOME/.local/share/plasma/plasmoids/$PLASMOID_ID"
KPACKAGE_DIR="$HOME/.local/share/kpackage/generic/$PLASMOID_ID"
TMP_DIR=$(mktemp -d)
cleanup() { rm -rf "$TMP_DIR"; }
trap cleanup EXIT
echo "⚡ Installing KVitals..."
# Download and extract
# Clone repository
if ! command -v git &>/dev/null; then
echo "❌ Error: git is required"
exit 1
fi
echo " Cloning repository..."
git clone --depth 1 "https://github.com/$REPO.git" "$TMP_DIR/kvitals"
SRC_DIR="$TMP_DIR/kvitals"
# Remove old installation
for dir in "$DEST_DIR" "$KPACKAGE_DIR"; do
if [[ -d "$dir" ]] || [[ -L "$dir" ]]; then
echo " Removing previous installation from $dir..."
rm -rf "$dir"
fi
done
# Install
mkdir -p "$DEST_DIR"
cp "$SRC_DIR/metadata.json" "$DEST_DIR/"
cp -r "$SRC_DIR/contents" "$DEST_DIR/"
mkdir -p "$(dirname "$KPACKAGE_DIR")"
ln -s "$DEST_DIR" "$KPACKAGE_DIR"
echo ""
echo "✅ KVitals installed to: $DEST_DIR"
echo ""
echo "Next steps:"
echo " 1. Restart Plasma: plasmashell --replace &"
echo " 2. Right-click panel → Add Widgets → search 'KVitals'"
echo " 3. Drag it onto your panel"
echo ""
echo "To uninstall: rm -rf $DEST_DIR $KPACKAGE_DIR"
@@ -0,0 +1,37 @@
#!/usr/bin/env bash
set -euo pipefail
PLASMOID_ID="org.kde.plasma.kvitals"
SRC_DIR="$(cd "$(dirname "$0")" && pwd)"
DEST_DIR="$HOME/.local/share/plasma/plasmoids/$PLASMOID_ID"
KPACKAGE_DIR="$HOME/.local/share/kpackage/generic/$PLASMOID_ID"
echo "Installing KVitals plasmoid..."
# Remove old installation if present
for dir in "$DEST_DIR" "$KPACKAGE_DIR"; do
if [[ -d "$dir" ]] || [[ -L "$dir" ]]; then
echo " Removing previous installation from $dir..."
rm -rf "$dir"
fi
done
# Install to primary location
mkdir -p "$DEST_DIR"
cp -r "$SRC_DIR/metadata.json" "$DEST_DIR/"
cp -r "$SRC_DIR/contents" "$DEST_DIR/"
mkdir -p "$(dirname "$KPACKAGE_DIR")"
ln -s "$DEST_DIR" "$KPACKAGE_DIR"
echo ""
echo "✅ Installed to: $DEST_DIR"
echo ""
echo "Next steps:"
echo " 1. Right-click on your KDE top panel"
echo " 2. Click 'Add Widgets...'"
echo " 3. Search for 'KVitals'"
echo " 4. Drag it onto your panel"
echo ""
echo "To uninstall: rm -rf $DEST_DIR $KPACKAGE_DIR"
@@ -0,0 +1,21 @@
{
"KPlugin": {
"Id": "org.kde.plasma.kvitals",
"Name": "KVitals",
"Description": "Live system vitals in the panel: CPU, RAM, Temp, GPU, Battery, Network, Disk, Fan",
"Icon": "utilities-system-monitor",
"Category": "System Information",
"Authors": [
{
"Name": "Yassine Amjad",
"Email": "yassine.amjad001@gmail.com"
}
],
"Website": "https://github.com/yassine20011/kvitals",
"BugReportUrl": "https://github.com/yassine20011/kvitals/issues",
"Version": "2.10.1",
"License": "GPL-3.0"
},
"KPackageStructure": "Plasma/Applet",
"X-Plasma-API-Minimum-Version": "6.0"
}
@@ -0,0 +1,82 @@
site_name: KVitals
site_description: A lightweight KDE Plasma 6 panel widget for live system vitals
site_url: https://kvitals.dev/
repo_url: https://github.com/yassine20011/kvitals
repo_name: yassine20011/kvitals
theme:
name: material
palette:
- scheme: slate
primary: deep purple
accent: pink
toggle:
icon: material/brightness-7
name: Switch to light mode
- scheme: default
primary: deep purple
accent: pink
toggle:
icon: material/brightness-4
name: Switch to dark mode
features:
- navigation.instant
- navigation.tabs
- navigation.sections
- navigation.top
- search.highlight
- search.suggest
- content.code.copy
icon:
repo: fontawesome/brands/github
markdown_extensions:
- admonition
- pymdownx.details
- pymdownx.superfences
- pymdownx.highlight:
anchor_linenums: true
- pymdownx.inlinehilite
- pymdownx.tabbed:
alternate_style: true
- tables
- attr_list
- md_in_html
- toc:
permalink: true
nav:
- Home: index.md
- Installation: installation.md
- Configuration: configuration.md
- Architecture: architecture.md
- Contributing: contributing.md
- Troubleshooting: troubleshooting.md
- Changelog: changelog.md
extra:
social:
- icon: fontawesome/brands/github
link: https://github.com/yassine20011
plugins:
- search
- llmstxt:
markdown_description: >
KVitals is a lightweight KDE Plasma 6 panel widget that displays live
system vitals including CPU usage, memory usage, CPU temperature,
GPU metrics, battery status, power draw, and network upload/download
speeds directly in your panel. It uses native KDE KSysGuard sensors and
is fully configurable through a settings UI.
full_output: llms-full.txt
sections:
Getting started:
- index.md: Overview and features of KVitals
- installation.md: How to install KVitals on KDE Plasma 6
- configuration.md: Widget settings and customization options
Technical reference:
- architecture.md: System architecture, data flow, and component design
- troubleshooting.md: Common issues and solutions
Community:
- contributing.md: How to contribute to the project
- changelog.md: Version history and release notes
@@ -0,0 +1,24 @@
#!/usr/bin/env bash
set -e
PLASMOID_NAME="org.kde.plasma.kvitals"
VERSION=$(grep '"Version"' metadata.json | cut -d '"' -f 4)
FILENAME="${PLASMOID_NAME}-v${VERSION}.plasmoid"
echo "📦 Packaging $PLASMOID_NAME version $VERSION..."
# A .plasmoid file is just a ZIP archive containing the package files
# We exclude the git directory, install scripts, and screenshots
zip -r "$FILENAME" \
metadata.json \
contents \
LICENSE \
README.md \
-x "*.git*" \
-x "install.sh" \
-x "install-remote.sh" \
-x "package.sh" \
-x "*.DS_Store"
echo "✅ Created package: $FILENAME"
Binary file not shown.

After

Width:  |  Height:  |  Size: 974 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 KiB