omarchy-shell (Quickshell): let the battery indicator show "plugged" independently of "charging" — a distinction Waybar couldn't make #6203
abbood
started this conversation in
Suggestions
Replies: 1 comment
-
|
Opened a PR implementing this on the It fixes the exact case described above — |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Context
The Quickshell rewrite (
omarchy-shell, #5856) is rebuilding the bar from scratch. As of the currentomarchy-shellbranch the battery bar indicator doesn't exist yet —shell/plugins/services/battery/BatteryModel.jsis an empty stub, there's no battery bar widget (SystemStats.qmldoesn't render battery), andshell/plugins/services/battery/Service.qmlonly drives a single-threshold (10%) low-battery notification. So this is the ideal moment to flag a design consideration the old Waybar module physically couldn't express, so it doesn't get carried over by accident.The problem the Waybar module had
Waybar's native
batterymodule keys its icon off the rawstatusstring only. When a laptop is plugged in but the battery is still net-draining — i.e. the apps draw more than the charger supplies (very common on theperformancepower-profile, or with an under-spec USB-C PD charger) —statusreadsDischarging, identical to being unplugged. Waybar can't tell those two apart in config, so the charging/bolt indicator disappears while the charger is still connected. Two upstream reports confirm the limitation: Alexays/Waybar#253, #3202.The user impact is that a single glyph is forced to answer two independent questions and ends up answering neither reliably:
Why Quickshell can fix this cleanly (and Waybar couldn't)
Quickshell.Services.UPoweralready exposesUPower.onBattery(line-power state) separately from the devicestate— and the omarchy-shell code already uses both (Service.qml, andshell/plugins/panels/power/Model.jsreadsonBattery+device.stateindependently). That's exactly the two signals needed. So the new bar indicator can encode both facts at once, which is trivial in QML but impossible in Waybar config:!UPower.onBattery(line power present). Show a bolt/plug glyph whenever connected, regardless of net direction. (On many laptops this also matches a hardware charge LED, so it becomes a trustworthy "is it plugged?" signal.)device.state(ChargingvsDischargingwhile!onBattery). Distinguish with colour/arrow: e.g. green ↑ = net charging, amber ↓ = plugged but draining (→ "bigger adapter"), no bolt = on battery.Concretely: an indicator that shows the bolt on
!onBatteryand an arrow/colour ondevice.stategives users both answers at a glance.Bonus edge case worth a defensive note: EC fuel-gauge desync
On some laptops (e.g. Huawei MateBook, NVT packs) a deep discharge to ~0% desyncs the EC fuel gauge: afterwards the charger is connected but
status=Dischargingand the percentage is stuck near 0 while the machine keeps running — the reading is simply wrong until a hard reboot power-cycles the EC (hardware detail: aymanbagabas/Huawei-WMI#117). Two small implications for the shell:ExpectBatteryRecalibration/CriticalPowerActionsettings exist for exactly this. A lying 2% shouldn't be able to force a power event.Discharging" indicator above doubles as a useful tell for this state when it happens near 0%.Offer
Happy to help with the QML for the bar indicator or a test case. I've built a working reference (a script-based version) that implements the
onBattery-vs-statesplit described above, plus the tooltip that surfaces net watts and an estimated charger output — glad to share it if useful.Beta Was this translation helpful? Give feedback.
All reactions