mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
Add "{m}" battery format-time option for zero-pad minutes
This commit is contained in:
parent
03ca8de6d7
commit
6b83360e76
@ -114,9 +114,10 @@ The *battery* module displays the current capacity and state (eg. charging) of y
|
|||||||
|
|
||||||
The *battery* module allows you to define how time should be formatted via *format-time*.
|
The *battery* module allows you to define how time should be formatted via *format-time*.
|
||||||
|
|
||||||
The two arguments are:
|
The three arguments are:
|
||||||
*{H}*: Hours
|
*{H}*: Hours
|
||||||
*{M}*: Minutes
|
*{M}*: Minutes
|
||||||
|
*{m}*: Zero-padded minutes
|
||||||
|
|
||||||
# CUSTOM FORMATS
|
# CUSTOM FORMATS
|
||||||
|
|
||||||
|
@ -308,7 +308,8 @@ const std::string waybar::modules::Battery::formatTimeRemaining(float hoursRemai
|
|||||||
if (config_["format-time"].isString()) {
|
if (config_["format-time"].isString()) {
|
||||||
format = config_["format-time"].asString();
|
format = config_["format-time"].asString();
|
||||||
}
|
}
|
||||||
return fmt::format(format, fmt::arg("H", full_hours), fmt::arg("M", minutes));
|
std::string zero_pad_minutes = fmt::format("{:02d}", minutes);
|
||||||
|
return fmt::format(format, fmt::arg("H", full_hours), fmt::arg("M", minutes), fmt::arg("m", zero_pad_minutes));
|
||||||
}
|
}
|
||||||
|
|
||||||
auto waybar::modules::Battery::update() -> void {
|
auto waybar::modules::Battery::update() -> void {
|
||||||
|
Loading…
Reference in New Issue
Block a user