Remove the battery widget if there is no battery
This commit is contained in:
parent
9ac8f2b2bb
commit
8f3e16f21e
1 changed files with 20 additions and 17 deletions
|
@ -51,6 +51,9 @@ class ConfigWrapper:
|
||||||
self._add_key(access_key, lazy.group[name].toscreen())
|
self._add_key(access_key, lazy.group[name].toscreen())
|
||||||
self._add_key(access_key, lazy.window.togroup(name), extra_mod='shift')
|
self._add_key(access_key, lazy.window.togroup(name), extra_mod='shift')
|
||||||
|
|
||||||
|
def _has_battery(self):
|
||||||
|
return len(glob('/sys/class/power_supply/BAT*')) > 0
|
||||||
|
|
||||||
def set_wallpaper(self):
|
def set_wallpaper(self):
|
||||||
images = glob(os.path.expanduser('~/pictures/wallpapers/enabled/*'))
|
images = glob(os.path.expanduser('~/pictures/wallpapers/enabled/*'))
|
||||||
if images:
|
if images:
|
||||||
|
@ -117,10 +120,7 @@ class ConfigWrapper:
|
||||||
)
|
)
|
||||||
|
|
||||||
def set_screens(self):
|
def set_screens(self):
|
||||||
screens = [
|
widgets = [
|
||||||
Screen(
|
|
||||||
top=bar.Bar(
|
|
||||||
[
|
|
||||||
widget.GroupBox(),
|
widget.GroupBox(),
|
||||||
widget.Prompt(),
|
widget.Prompt(),
|
||||||
widget.WindowName(),
|
widget.WindowName(),
|
||||||
|
@ -133,9 +133,12 @@ class ConfigWrapper:
|
||||||
widget.MemoryGraph(**self.graph_params('#CFCE44')),
|
widget.MemoryGraph(**self.graph_params('#CFCE44')),
|
||||||
widget.CPUGraph(**self.graph_params('#96AECF')),
|
widget.CPUGraph(**self.graph_params('#96AECF')),
|
||||||
widget.Clock(format=self.date_format),
|
widget.Clock(format=self.date_format),
|
||||||
],
|
]
|
||||||
30,
|
if not self._has_battery():
|
||||||
),
|
widgets = [w for w in widgets if not isinstance(w, widget.Battery)]
|
||||||
|
screens = [
|
||||||
|
Screen(
|
||||||
|
top=bar.Bar(widgets, 30)
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
return screens
|
return screens
|
||||||
|
|
Loading…
Reference in a new issue