Daemon and CLI tool for my Zenbook's battery charge limit
Because Linux is a dysfunctional desktop experience I cannot have a charge limit applied in a matter that isn't a JavaScript vibe slop shell extension or a non-persistent setting in a shitty settings page so here we are.
./scripts/install.shThe installer adds you to the zenbookd group, which is what grants access to the
daemon's socket. Log back in (or run newgrp zenbookd) before the CLI will work.
zenbookd status # current charge, health and config
zenbookd set-limit 80 # hold the battery at 80%
zenbookd boost # charge to 100% now, restore the limit after
zenbookd boost --stop # cancel an active boost early
zenbookd set-periodic-charge on # enable/disable periodic full charge
zenbookd set-charge-period 30 # days between periodic full charges
zenbookd set-wifi-power-save on # disable Wi-Fi power saving while on AC
zenbookd reload # re-read config.toml without restarting
zenbookd --version # print the versionstatus prints a panel:
╭─ zenbookd ──────────────────────────────╮
│ │
│ Charge ██████████████░░░░░░ 72% │
│ Health ███████████████████░ 94% │
│ │
├─────────────────────────────────────────┤
│ │
│ Charge limit 80% │
│ Applied threshold 100% boost │
│ Periodic full charge every 30 days │
│ Last full charge 12 days ago │
│ Boost 23h 9m left │
│ │
╰─────────────────────────────────────────╯
Colour follows NO_COLOR and is dropped when the output is not a terminal. The box
falls back to ASCII when the locale is not UTF-8, and to a plain list when the
terminal is too narrow to hold it.
/etc/zenbookd/config.toml:
# Percentage (1-100) the battery is held at.
charge_limit = 80
# Periodically charge to 100% to let the BMS recalibrate.
enable_periodic_full_charge = true
# How often that full charge happens, in days.
full_charge_period = 30
# Disable Wi-Fi power saving while on AC power, restoring it once unplugged.
disable_wifi_power_save_on_ac = trueChanges made through the CLI are written back here, preserving comments and any
other keys already in the file, so edits and commands stay in sync. Hand edits
take effect after zenbookd reload (or a service restart). The daemon keeps
its own state (last full charge, any active boost) in
/var/lib/zenbookd/state.toml.
MIT, see LICENSE.md.