From 3293cbaac4de9373cda86c4720b53d07b1f6d640 Mon Sep 17 00:00:00 2001 From: Pavle Portic Date: Thu, 17 Nov 2016 23:02:49 +0100 Subject: [PATCH 1/3] [modules/battery] Display AC when no battery is present --- bumblebee/modules/battery.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/bumblebee/modules/battery.py b/bumblebee/modules/battery.py index 10a2600..2a570df 100644 --- a/bumblebee/modules/battery.py +++ b/bumblebee/modules/battery.py @@ -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": From a14483ec37c966ba6a6157df99a621087d4de959 Mon Sep 17 00:00:00 2001 From: Pavle Portic Date: Thu, 17 Nov 2016 23:02:57 +0100 Subject: [PATCH 2/3] [themes] Add gruvbox theme --- bumblebee/themes/gruvbox-powerline.json | 158 ++++++++++++++++++++++++ 1 file changed, 158 insertions(+) create mode 100644 bumblebee/themes/gruvbox-powerline.json diff --git a/bumblebee/themes/gruvbox-powerline.json b/bumblebee/themes/gruvbox-powerline.json new file mode 100644 index 0000000..2534520 --- /dev/null +++ b/bumblebee/themes/gruvbox-powerline.json @@ -0,0 +1,158 @@ +{ + "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": { + "prefix": "  ", + "states": { + "playing": { + "fg": "#1d2021", + "bg": "#b8bb26" + }, + "paused": { + "fg": "#1d2021", + "bg": "#d79921" + }, + "stopped": { + "fg": "#1d2021", + "bg": "#cc241d" + } + } + }, + "brightness": { + "prefix": "  " + }, + "pacman": { + "prefix": "  ", + "states": { + "available": { + "fg": "#1d2021", + "bg": "#b8bb26" + } + } + } +} From 9cf2a092da90079beef7f1ef10c30fb8def38624 Mon Sep 17 00:00:00 2001 From: Pavle Portic Date: Thu, 17 Nov 2016 23:21:05 +0100 Subject: [PATCH 3/3] [themes/gruvbox] Fix cmus icons --- bumblebee/themes/gruvbox-powerline.json | 309 ++++++++++++------------ 1 file changed, 154 insertions(+), 155 deletions(-) diff --git a/bumblebee/themes/gruvbox-powerline.json b/bumblebee/themes/gruvbox-powerline.json index 2534520..bb43b68 100644 --- a/bumblebee/themes/gruvbox-powerline.json +++ b/bumblebee/themes/gruvbox-powerline.json @@ -1,158 +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", + "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": { - "prefix": "  ", - "states": { - "playing": { - "fg": "#1d2021", - "bg": "#b8bb26" - }, - "paused": { - "fg": "#1d2021", - "bg": "#d79921" - }, - "stopped": { - "fg": "#1d2021", - "bg": "#cc241d" - } - } - }, - "brightness": { - "prefix": "  " - }, - "pacman": { - "prefix": "  ", - "states": { - "available": { - "fg": "#1d2021", - "bg": "#b8bb26" - } - } - } + "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": "  " + } }