Add {bar} to the battery module
Add {bar} (from util.make_bar()) formatter to the battery module. Also removed the final .strip() call as it was eating the padding used by make_bar.
This commit is contained in:
parent
ab36aee3c2
commit
61168e22de
@ -5,7 +5,7 @@ import re
|
|||||||
import configparser
|
import configparser
|
||||||
|
|
||||||
from i3pystatus import IntervalModule, formatp
|
from i3pystatus import IntervalModule, formatp
|
||||||
from i3pystatus.core.util import lchop, TimeWrapper
|
from i3pystatus.core.util import lchop, TimeWrapper, make_bar
|
||||||
from i3pystatus.core.desktop import DesktopNotification
|
from i3pystatus.core.desktop import DesktopNotification
|
||||||
|
|
||||||
|
|
||||||
@ -113,6 +113,7 @@ class BatteryChecker(IntervalModule):
|
|||||||
* `{consumption (Watts)}` — current power flowing into/out of the battery
|
* `{consumption (Watts)}` — current power flowing into/out of the battery
|
||||||
* `{status}`
|
* `{status}`
|
||||||
* `{battery_ident}` — the same as the setting
|
* `{battery_ident}` — the same as the setting
|
||||||
|
* `{bar}` —bar displaying the percentage graphically
|
||||||
"""
|
"""
|
||||||
|
|
||||||
settings = (
|
settings = (
|
||||||
@ -165,6 +166,7 @@ class BatteryChecker(IntervalModule):
|
|||||||
"percentage_design": battery.percentage(design=True),
|
"percentage_design": battery.percentage(design=True),
|
||||||
"consumption": battery.consumption(),
|
"consumption": battery.consumption(),
|
||||||
"remaining": TimeWrapper(0, "%E%h:%M"),
|
"remaining": TimeWrapper(0, "%E%h:%M"),
|
||||||
|
"bar": make_bar(battery.percentage()),
|
||||||
}
|
}
|
||||||
|
|
||||||
status = battery.status()
|
status = battery.status()
|
||||||
@ -195,7 +197,7 @@ class BatteryChecker(IntervalModule):
|
|||||||
fdict["status"] = self.status[fdict["status"]]
|
fdict["status"] = self.status[fdict["status"]]
|
||||||
|
|
||||||
self.output = {
|
self.output = {
|
||||||
"full_text": formatp(self.format, **fdict).strip(),
|
"full_text": formatp(self.format, **fdict),
|
||||||
"instance": self.battery_ident,
|
"instance": self.battery_ident,
|
||||||
"urgent": urgent,
|
"urgent": urgent,
|
||||||
"color": color,
|
"color": color,
|
||||||
|
Loading…
Reference in New Issue
Block a user