fix(battery): gate Full-as-Plugged behind full-at-plugged option, drop debug output
Reporting a full battery on AC as 'Plugged' is now opt-in via the 'full-at-plugged' config option (default false), so existing format-full / tooltip-format-full setups keep working. Also documents the option.
This commit is contained in:
@@ -27,6 +27,11 @@ The *battery* module displays the current capacity and state (eg. charging) of y
|
|||||||
default: false ++
|
default: false ++
|
||||||
Option to use the battery design capacity instead of its current maximal capacity.
|
Option to use the battery design capacity instead of its current maximal capacity.
|
||||||
|
|
||||||
|
*full-at-plugged*: ++
|
||||||
|
typeof: bool ++
|
||||||
|
default: false ++
|
||||||
|
When enabled, a battery that is *Full* while the adapter is online is reported with the *Plugged* status instead of *Full* (so you can style/format it separately). Disabled by default to preserve the existing *Full* behaviour.
|
||||||
|
|
||||||
*interval*: ++
|
*interval*: ++
|
||||||
typeof: integer ++
|
typeof: integer ++
|
||||||
default: 60 ++
|
default: 60 ++
|
||||||
|
|||||||
@@ -706,7 +706,7 @@ auto waybar::modules::Battery::update() -> void {
|
|||||||
if (!adapter_.empty()) {
|
if (!adapter_.empty()) {
|
||||||
std::ifstream(adapter_ / "online") >> adapter_online;
|
std::ifstream(adapter_ / "online") >> adapter_online;
|
||||||
}
|
}
|
||||||
if (status == "Full" && adapter_online) {
|
if (config_["full-at-plugged"].asBool() && status == "Full" && adapter_online) {
|
||||||
status = "Plugged";
|
status = "Plugged";
|
||||||
}
|
}
|
||||||
auto status_pretty = status;
|
auto status_pretty = status;
|
||||||
|
|||||||
Reference in New Issue
Block a user