allow to use vertical bar in battery (#660)
* allow to use vertical bar in battery * add import statement lost in merge * convert to integer before using as index
This commit is contained in:
parent
36497db2f4
commit
8638ca0b1f
@ -6,7 +6,7 @@ import re
|
||||
from i3pystatus import IntervalModule, formatp
|
||||
from i3pystatus.core.command import run_through_shell
|
||||
from i3pystatus.core.desktop import DesktopNotification
|
||||
from i3pystatus.core.util import lchop, TimeWrapper, make_bar, make_glyph
|
||||
from i3pystatus.core.util import lchop, TimeWrapper, make_bar, make_glyph, make_vertical_bar
|
||||
|
||||
|
||||
class UEventParser(configparser.ConfigParser):
|
||||
@ -337,6 +337,8 @@ class BatteryChecker(IntervalModule):
|
||||
"glyph": make_glyph(self.percentage(batteries), self.glyphs),
|
||||
"bar": make_bar(self.percentage(batteries)),
|
||||
"bar_design": make_bar(self.percentage(batteries, design=True)),
|
||||
"vertical_bar": make_vertical_bar(self.percentage(batteries)),
|
||||
"vertical_bar_design": make_vertical_bar(self.percentage(batteries, design=True)),
|
||||
}
|
||||
|
||||
status = self.battery_status(batteries)
|
||||
|
@ -510,6 +510,7 @@ def make_vertical_bar(percentage, width=1):
|
||||
"""
|
||||
bar = ' _▁▂▃▄▅▆▇█'
|
||||
percentage //= 10
|
||||
percentage = int(percentage)
|
||||
if percentage < 0:
|
||||
output = bar[0]
|
||||
elif percentage >= len(bar):
|
||||
|
Loading…
Reference in New Issue
Block a user