mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
formatting is hard.
This commit is contained in:
parent
d8b6201632
commit
25f31b19f6
@ -34,7 +34,6 @@ waybar::modules::Battery::Battery(const Json::Value& config)
|
|||||||
for (auto const& bat : batteries_) {
|
for (auto const& bat : batteries_) {
|
||||||
inotify_add_watch(fd_, (bat / "uevent").c_str(), IN_ACCESS);
|
inotify_add_watch(fd_, (bat / "uevent").c_str(), IN_ACCESS);
|
||||||
}
|
}
|
||||||
old_status_ = "";
|
|
||||||
worker();
|
worker();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,7 +66,7 @@ std::tuple<uint16_t, std::string> waybar::modules::Battery::getInfos()
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
uint16_t total = 0;
|
uint16_t total = 0;
|
||||||
std::string status;
|
std::string status = "Unknown";
|
||||||
for (auto const& bat : batteries_) {
|
for (auto const& bat : batteries_) {
|
||||||
uint16_t capacity;
|
uint16_t capacity;
|
||||||
std::string _status;
|
std::string _status;
|
||||||
@ -125,9 +124,9 @@ auto waybar::modules::Battery::update() -> void
|
|||||||
old_status_ = status;
|
old_status_ = status;
|
||||||
if (!state.empty() && config_["format-" + status + "-" + state].isString()) {
|
if (!state.empty() && config_["format-" + status + "-" + state].isString()) {
|
||||||
format = config_["format-" + status + "-" + state].asString();
|
format = config_["format-" + status + "-" + state].asString();
|
||||||
}else if (config_["format-" + status].isString()) {
|
} else if (config_["format-" + status].isString()) {
|
||||||
format = config_["format-" + status].asString();
|
format = config_["format-" + status].asString();
|
||||||
}else if (!state.empty() && config_["format-" + state].isString()) {
|
} else if (!state.empty() && config_["format-" + state].isString()) {
|
||||||
format = config_["format-" + state].asString();
|
format = config_["format-" + state].asString();
|
||||||
}
|
}
|
||||||
if (format.empty()) {
|
if (format.empty()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user