[PR #1341] [MERGED] fix(examples): wrong battery detection logic in some config files #2723

Closed
opened 2026-05-22 22:57:39 +01:00 by JakeStanger · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/JakeStanger/ironbar/pull/1341
Author: @purrion
Created: 1/20/2026
Status: Merged
Merged: 1/20/2026
Merged by: @JakeStanger

Base: masterHead: master


📝 Commits (1)

  • 738885b fix(examples): wrong battery detection logic in some config files

📊 Changes

8 files changed (+10 additions, -8 deletions)

View changed files

📝 examples/desktop/config.corn (+1 -1)
📝 examples/desktop/config.json (+1 -1)
📝 examples/desktop/config.toml (+1 -1)
📝 examples/desktop/config.yaml (+2 -1)
📝 examples/minimal/config.corn (+1 -1)
📝 examples/minimal/config.json (+1 -1)
📝 examples/minimal/config.toml (+1 -1)
📝 examples/minimal/config.yaml (+2 -1)

📄 Description

The current used condition is [ -f /sys/class/power_supply/BAT0 ] always returns 1 (exit code) as /sys/class/power_supply/BAT0 is a directory, not a file. It seems to be a omission because I notice you mentioned the corrected command in #698.

However, it still doesn't work with my laptop. There's only one internal battery, and it's labeled as BAT1 rather than BAT0.

Some checks:
> ls /sys/class/power_supply
ACAD  BAT1

> sudo dmesg | grep 'BAT'                                                                            
[    0.466610] ACPI: battery: Slot [BAT1] (battery present)

> upower -e                                              
/org/freedesktop/UPower/devices/battery_BAT1
/org/freedesktop/UPower/devices/line_power_ACAD
/org/freedesktop/UPower/devices/DisplayDevice

Thus, I suggest another check condition to make it work:

ls /sys/class/power_supply/ | grep --quiet '^BAT'

(Additional affected file: docs)


🔄 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/1341 **Author:** [@purrion](https://github.com/purrion) **Created:** 1/20/2026 **Status:** ✅ Merged **Merged:** 1/20/2026 **Merged by:** [@JakeStanger](https://github.com/JakeStanger) **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (1) - [`738885b`](https://github.com/JakeStanger/ironbar/commit/738885b11bdbf728e58e534d1895d82099f4e5c5) fix(examples): wrong battery detection logic in some config files ### 📊 Changes **8 files changed** (+10 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `examples/desktop/config.corn` (+1 -1) 📝 `examples/desktop/config.json` (+1 -1) 📝 `examples/desktop/config.toml` (+1 -1) 📝 `examples/desktop/config.yaml` (+2 -1) 📝 `examples/minimal/config.corn` (+1 -1) 📝 `examples/minimal/config.json` (+1 -1) 📝 `examples/minimal/config.toml` (+1 -1) 📝 `examples/minimal/config.yaml` (+2 -1) </details> ### 📄 Description The current used condition is `[ -f /sys/class/power_supply/BAT0 ]` always returns `1` (exit code) as `/sys/class/power_supply/BAT0` is a directory, not a file. It seems to be a omission because I notice you mentioned the corrected command in #698. However, it still doesn't work with my laptop. There's only one internal battery, and it's labeled as `BAT1` rather than `BAT0`. <details> <summary>Some checks:</summary> ```cmd > ls /sys/class/power_supply ACAD BAT1 > sudo dmesg | grep 'BAT' [ 0.466610] ACPI: battery: Slot [BAT1] (battery present) > upower -e /org/freedesktop/UPower/devices/battery_BAT1 /org/freedesktop/UPower/devices/line_power_ACAD /org/freedesktop/UPower/devices/DisplayDevice ``` </details> Thus, I suggest another check condition to make it work: ``` ls /sys/class/power_supply/ | grep --quiet '^BAT' ``` (Additional affected file: [docs](https://github.com/JakeStanger/ironbar/blob/112ff0fb2989e1bb536840b44a85c843c94fe5b9/docs/Dynamic%20values.md?plain=1#L60)) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
JakeStanger 2026-05-22 22:57:39 +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#2723
No description provided.