Add charging indicator and pacman package, bump to 1.1.0

- Show charge/discharge power in watts, a battery graphic with charge
  bolt, a power history graph and the estimated time until full or
  remaining (respecting the 80 % charge limit) in the app, the panel
  widget, its tooltip and `predatorctl status`
- Add packaging/arch/PKGBUILD that builds a pacman package; the kernel
  module ships as DKMS source and is rebuilt for every kernel
- Bump version to 1.1.0

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-07 17:37:03 +02:00
co-authored by Claude Opus 5.5
parent ea7ce49452
commit 2ef62e85cd
17 changed files with 315 additions and 25 deletions
+14 -1
View File
@@ -247,7 +247,7 @@ def set_lightbar(mode="static", color=(0, 200, 255), brightness=200, speed=5, di
# --------------------------------------------------------------- Battery
def battery():
def battery(limit_80=False):
bat = next(iter(glob.glob("/sys/class/power_supply/BAT*")), None)
ac = next((p for p in glob.glob("/sys/class/power_supply/*")
if _read(p + "/type") == "Mains"), None)
@@ -268,6 +268,19 @@ def battery():
"cycles": _read_int(bat + "/cycle_count"),
"health": round(100.0 * full / design, 1) if full and design else None,
})
# remaining time in minutes (to full while charging, to empty while discharging)
now = _read_int(bat + "/charge_now") or _read_int(bat + "/energy_now")
rate = cur if _read_int(bat + "/charge_now") is not None else pwr
minutes = None
if now is not None and full and rate:
rate = abs(rate)
if out["status"] == "Charging":
target = full * 0.8 if limit_80 else full
minutes = int(max(0, target - now) / rate * 60)
elif out["status"] == "Discharging":
minutes = int(now / rate * 60)
out["minutes_left"] = minutes
out["charging"] = out["status"] == "Charging"
return out