forked from external/yambar
module/battery: don’t terminate when failing to update
Some battery drivers will remove their sysfs directory when the battery goes from charging to discharging, or vice verse. This caused yambar’s battery module to terminate, resulting in the last known battery state to “freeze”. With this patch, failure to read the battery directory the *first* time is still considered a hard failure, resulting in an error message and then termination. However, subsequent failures, i.e. while polling the battery state, is *not* considered fatal; we simply don’t update the bar, and retry again the next poll interval. Error messages are still logged however. Closes #44
This commit is contained in:
parent
d95023adc8
commit
aadb1b22b3
2 changed files with 5 additions and 3 deletions
|
@ -20,6 +20,9 @@
|
|||
* fcft >= 2.4.0 is now required.
|
||||
* sway-xkb: non-keyboard inputs are now ignored
|
||||
(https://codeberg.org/dnkl/yambar/issues/51).
|
||||
* battery: don’t terminate (causing last status to “freeze”) when
|
||||
failing to update; retry again later
|
||||
(https://codeberg.org/dnkl/yambar/issues/44).
|
||||
|
||||
|
||||
### Deprecated
|
||||
|
|
|
@ -434,9 +434,8 @@ run(struct module *mod)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (!update_status(mod))
|
||||
break;
|
||||
bar->refresh(bar);
|
||||
if (update_status(mod))
|
||||
bar->refresh(bar);
|
||||
}
|
||||
|
||||
out:
|
||||
|
|
Loading…
Add table
Reference in a new issue