Merge pull request #13 from paxy97/master
Missing battery fix and gruvbox theme
This commit is contained in:
commit
5149991ff3
2 changed files with 170 additions and 3 deletions
|
@ -1,5 +1,6 @@
|
|||
import datetime
|
||||
import bumblebee.module
|
||||
import os.path
|
||||
|
||||
def description():
|
||||
return "Displays battery status, percentage and whether it's charging or discharging."
|
||||
|
@ -11,11 +12,17 @@ class Module(bumblebee.module.Module):
|
|||
def __init__(self, output, config, alias):
|
||||
super(Module, self).__init__(output, config, alias)
|
||||
self._battery = config.parameter("device", "BAT0")
|
||||
self._capacity = 0
|
||||
self._capacity = 100
|
||||
self._status = "Unknown"
|
||||
|
||||
def widgets(self):
|
||||
with open("/sys/class/power_supply/{}/capacity".format(self._battery)) as f:
|
||||
self._AC = False;
|
||||
self._path = "/sys/class/power_supply/{}".format(self._battery)
|
||||
if not os.path.exists(self._path):
|
||||
self._AC = True;
|
||||
return bumblebee.output.Widget(self,"AC")
|
||||
|
||||
with open(self._path + "/capacity") as f:
|
||||
self._capacity = int(f.read())
|
||||
self._capacity = self._capacity if self._capacity < 100 else 100
|
||||
|
||||
|
@ -28,7 +35,10 @@ class Module(bumblebee.module.Module):
|
|||
return self._capacity < self._config.parameter("critical", 10)
|
||||
|
||||
def state(self, widget):
|
||||
with open("/sys/class/power_supply/{}/status".format(self._battery)) as f:
|
||||
if self._AC:
|
||||
return "AC"
|
||||
|
||||
with open(self._path + "/status") as f:
|
||||
self._status = f.read().strip()
|
||||
|
||||
if self._status == "Discharging":
|
||||
|
|
157
bumblebee/themes/gruvbox-powerline.json
Normal file
157
bumblebee/themes/gruvbox-powerline.json
Normal file
|
@ -0,0 +1,157 @@
|
|||
{
|
||||
"defaults": {
|
||||
"prefix": " ",
|
||||
"suffix" : " ",
|
||||
"cycle": [
|
||||
{
|
||||
"fg": "#ebdbb2",
|
||||
"bg": "#1d2021"
|
||||
},
|
||||
{
|
||||
"fg": "#fbf1c7",
|
||||
"bg": "#282828"
|
||||
}
|
||||
],
|
||||
"fg-critical": "#fbf1c7",
|
||||
"bg-critical": "#cc241d",
|
||||
"fg-warning": "#1d2021",
|
||||
"bg-warning": "#d79921",
|
||||
|
||||
"default-separators": false,
|
||||
"separator-block-width": 0,
|
||||
"separator": ""
|
||||
},
|
||||
"date": {
|
||||
"prefix": " "
|
||||
},
|
||||
"time": {
|
||||
"prefix": " "
|
||||
},
|
||||
"memory": {
|
||||
"prefix": " "
|
||||
},
|
||||
"cpu": {
|
||||
"prefix": " "
|
||||
},
|
||||
"disk": {
|
||||
"prefix": " "
|
||||
},
|
||||
"dnf": {
|
||||
"prefix": " ",
|
||||
"states": {
|
||||
"good": {
|
||||
"fg": "#002b36",
|
||||
"bg": "#859900"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pasink": {
|
||||
"states": {
|
||||
"muted": {
|
||||
"prefix": " "
|
||||
},
|
||||
"unmuted": {
|
||||
"prefix": " "
|
||||
}
|
||||
}
|
||||
},
|
||||
"pasource": {
|
||||
"states": {
|
||||
"muted": {
|
||||
"prefix": " "
|
||||
},
|
||||
"unmuted": {
|
||||
"prefix": " "
|
||||
}
|
||||
}
|
||||
},
|
||||
"nic": {
|
||||
"states": {
|
||||
"wireless-up": {
|
||||
"prefix": " "
|
||||
},
|
||||
"wireless-down": {
|
||||
"prefix": " "
|
||||
},
|
||||
"wired-up": {
|
||||
"prefix": " "
|
||||
},
|
||||
"wired-down": {
|
||||
"prefix": " "
|
||||
},
|
||||
"tunnel-up": {
|
||||
"prefix": " "
|
||||
},
|
||||
"tunnel-down": {
|
||||
"prefix": " "
|
||||
}
|
||||
}
|
||||
},
|
||||
"battery": {
|
||||
"states": {
|
||||
"charged": {
|
||||
"prefix": " ",
|
||||
"suffix": " ",
|
||||
"fg": "#1d2021",
|
||||
"bg": "#b8bb26"
|
||||
},
|
||||
"AC": {
|
||||
"suffix": " ",
|
||||
"fg": "#1d2021",
|
||||
"bg": "#b8bb26"
|
||||
},
|
||||
"charging": {
|
||||
"prefix": [ " ", " ", " ", " ", " " ],
|
||||
"suffix": " "
|
||||
},
|
||||
"discharging-10": {
|
||||
"prefix": " ",
|
||||
"suffix": " "
|
||||
},
|
||||
"discharging-25": {
|
||||
"prefix": " ",
|
||||
"suffix": " "
|
||||
},
|
||||
"discharging-50": {
|
||||
"prefix": " ",
|
||||
"suffix": " "
|
||||
},
|
||||
"discharging-80": {
|
||||
"prefix": " ",
|
||||
"suffix": " "
|
||||
},
|
||||
"discharging-100": {
|
||||
"prefix": " ",
|
||||
"suffix": " "
|
||||
}
|
||||
}
|
||||
},
|
||||
"cmus": {
|
||||
"states": {
|
||||
"playing": {
|
||||
"prefix": " "
|
||||
},
|
||||
"paused": {
|
||||
"prefix": " "
|
||||
},
|
||||
"stopped": {
|
||||
"prefix": " "
|
||||
}
|
||||
},
|
||||
"prev": {
|
||||
"prefix": " "
|
||||
},
|
||||
"next": {
|
||||
"prefix": " "
|
||||
},
|
||||
"shuffle": {
|
||||
"states": { "on": { "prefix": " " }, "off": { "prefix": " " } }
|
||||
},
|
||||
"repeat": {
|
||||
"states": { "on": { "prefix": " " }, "off": { "prefix": " " } }
|
||||
}
|
||||
},
|
||||
"brightness": {
|
||||
"prefix": " "
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue