[PR #1126] [MERGED] Upower Ironvars & Dynamic Thresholds for Styling #1164

Closed
opened 2026-05-22 21:55:46 +01:00 by JakeStanger · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/JakeStanger/ironbar/pull/1126
Author: @JakeStanger
Created: 8/25/2025
Status: Merged
Merged: 8/25/2025
Merged by: @JakeStanger

Base: masterHead: feat/upower-improvements


📝 Commits (3)

  • 630f88e refactor(ironvar): make NamespaceTrait public
  • a2bd428 feat(upower): expose properties as ironvars
  • c76e569 feat(upower): dynamic thresholds for styling

📊 Changes

6 files changed (+241 additions, -97 deletions)

View changed files

📝 docs/modules/Upower.md (+28 -13)
📝 src/clients/mod.rs (+7 -3)
📝 src/clients/sysinfo.rs (+2 -2)
📝 src/clients/upower/mod.rs (+74 -16)
📝 src/ironvar.rs (+1 -1)
📝 src/modules/upower.rs (+129 -62)

📄 Description

The upower client can now be queried using the ironvar system to read all battery information. Not all properties are currently available in the module, and this serves more as a debug view than anything.

A new thresholds config option has also been added to the module, which can be used for applying styles dynamically based on the current battery percentage. For example, given the below config:

{
  end = [
    {
      type = "upower"
      format = "{percentage}%"
      thresholds.warning = 20
      thresholds.critical = 5
    }
  ]
}

At battery levels below 20%, the .warning class will be applied to the top-level widget. Below 5%, .critical will be applied instead. Above 20%, no class applies.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/JakeStanger/ironbar/pull/1126 **Author:** [@JakeStanger](https://github.com/JakeStanger) **Created:** 8/25/2025 **Status:** ✅ Merged **Merged:** 8/25/2025 **Merged by:** [@JakeStanger](https://github.com/JakeStanger) **Base:** `master` ← **Head:** `feat/upower-improvements` --- ### 📝 Commits (3) - [`630f88e`](https://github.com/JakeStanger/ironbar/commit/630f88ea4c75363920a2cf11da1c6f4287274d08) refactor(ironvar): make `NamespaceTrait` public - [`a2bd428`](https://github.com/JakeStanger/ironbar/commit/a2bd42867b861f5e94d7467b2059baf47bb9a4b5) feat(upower): expose properties as ironvars - [`c76e569`](https://github.com/JakeStanger/ironbar/commit/c76e56919fb0c293e47c2d90c4826c8ab17a3b9e) feat(upower): dynamic thresholds for styling ### 📊 Changes **6 files changed** (+241 additions, -97 deletions) <details> <summary>View changed files</summary> 📝 `docs/modules/Upower.md` (+28 -13) 📝 `src/clients/mod.rs` (+7 -3) 📝 `src/clients/sysinfo.rs` (+2 -2) 📝 `src/clients/upower/mod.rs` (+74 -16) 📝 `src/ironvar.rs` (+1 -1) 📝 `src/modules/upower.rs` (+129 -62) </details> ### 📄 Description The `upower` client can now be queried using the ironvar system to read all battery information. Not all properties are currently available in the module, and this serves more as a debug view than anything. A new `thresholds` config option has also been added to the module, which can be used for applying styles dynamically based on the current battery percentage. For example, given the below config: ```corn { end = [ { type = "upower" format = "{percentage}%" thresholds.warning = 20 thresholds.critical = 5 } ] } ``` At battery levels below 20%, the `.warning` class will be applied to the top-level widget. Below 5%, `.critical` will be applied instead. Above 20%, no class applies. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
JakeStanger 2026-05-22 21:55:46 +01:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
JakeStanger/ironbar#1164
No description provided.