From 1946fd98ff066be012147ea05c193f71c8918dc5 Mon Sep 17 00:00:00 2001 From: batman-nair Date: Thu, 21 Sep 2017 08:43:15 +0530 Subject: [PATCH 1/4] My changes --- bumblebee/modules/.battery.py.un~ | Bin 0 -> 2812 bytes bumblebee/modules/.traffic.py.un~ | Bin 0 -> 34029 bytes bumblebee/modules/battery.py | 4 +- bumblebee/modules/battery.py~ | 120 ++++++++++++++++++++++++ bumblebee/modules/traffic.py | 6 +- bumblebee/modules/traffic.py~ | 100 ++++++++++++++++++++ themes/.gruvbox-powerline-edit.json.un~ | Bin 0 -> 19264 bytes themes/.powerline-edit.json.un~ | Bin 0 -> 36019 bytes themes/gruvbox-powerline-edit.json | 51 ++++++++++ themes/gruvbox-powerline-edit.json~ | 51 ++++++++++ themes/powerline-edit.json | 48 ++++++++++ themes/powerline-edit.json~ | 48 ++++++++++ 12 files changed, 424 insertions(+), 4 deletions(-) create mode 100644 bumblebee/modules/.battery.py.un~ create mode 100644 bumblebee/modules/.traffic.py.un~ create mode 100644 bumblebee/modules/battery.py~ create mode 100644 bumblebee/modules/traffic.py~ create mode 100644 themes/.gruvbox-powerline-edit.json.un~ create mode 100644 themes/.powerline-edit.json.un~ create mode 100644 themes/gruvbox-powerline-edit.json create mode 100644 themes/gruvbox-powerline-edit.json~ create mode 100644 themes/powerline-edit.json create mode 100644 themes/powerline-edit.json~ diff --git a/bumblebee/modules/.battery.py.un~ b/bumblebee/modules/.battery.py.un~ new file mode 100644 index 0000000000000000000000000000000000000000..8ab0992c7cf91cb3c003c20b3bb893eb9e74e50e GIT binary patch literal 2812 zcmWH`%$*;a=aT=FfyqHLbGGG?z@8VEb2ledS!}%;aI#S`-PNSAxnu?7!%`Op28IeC zmQX+fMX4pFMR^KJdHRV;KskFL76D>LAZ7z%5CG9I%n-RntDglV%g7La0VE3qOb`l8 zf~0JLSOUcR4+LPNK%7xPgAf2lM>jY+7#O~Sg4_m(?SL2*&!DJ~L5gZH6FI(38^KWs zQpXI$FaV0q(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Dmv>H2jRwWs}Zv%R%srU#DkXE z6SL~LnM{=6FRhJ>j|Z*?Q?3t7l^_X{y^MlnJi9~&E?!3C#1?J1iy-=&9Z>aUbY5!a zW%Q~JsN~g)F~!}S&^&EA0qIEBD8#o|Mfb|q=oYr>0`rXN0H7mWqY&R>72L~PgPY%m z4a*7BemFbaCT6a&a}rY0aqutp)i#VWAF_tVk9ZXR}mBQLuuFpgYR8}7Mq z%^h|szWfY>grjjC1_{AP_(%oB5vyv$J+Hz#3=)opRfB}qQRxGOBUN{rT7gjgAk3TY z&o7&6q+*MMa6U*F4p&G`M5726a?>DjX;n4hmA5u7?6LFVIjM+cRb5)ujYePz+X1tN zfQ$h^`YEQ|vobpp+!*xQolbZD?A?2frkrY9Zp)FiLJ$dz zPncGNIAS#l@huA0UzK6aJu6GF7N|n8ZdwlENYyCBw^&8B$;?Nkglaw}2*f8%!|PIx zP>n)-i&aq1Dp2wgsJUPu48x&`tnKiPOfzNpXH`rmMr3NEfFL|!nhxHG)F{NaScUY= zh)7NN4}wpbRzo)uH45=93ejJe&5=%zNOUvq2f)vnMgunjH45=9Rsqc&k12VQ4g-Gh zJ89Ys+sM->#J5<*Gj~F~gr`ROtZUM8&_SbDEWR#9Oa-KPfwr(SCPL!^F8|jyNg6xKy^iuQ&HhAJdTf{v>8~Bhv5ATL zq6IKe$0BIXHA&IEQG%<8C7iVG&G|$eQQiAS(Gm)e;O5K@5wHhMUw|G#8-@55t3Y4hHs}IpxQ4&ym-Pqck+Uycb9dodbF#UjcWNZ}TTdZRI?6w_wGcXO(@bkb~SHK++`*JmR z7sL}~Zan<;eMLR88xKR(5Itt9gmxrs6yjT~B0QyJH6NL 0: del widgets[0] + for widget in new_widgets: + widgets.append(widget) + self._widgets = widgets + + def remaining(self): + estimate = 0.0 + try: + estimate = power.PowerManagement().get_time_remaining_estimate() + # do not show remaining if on AC + if estimate == power.common.TIME_REMAINING_UNLIMITED: + return None + if estimate == power.common.TIME_REMAINING_UNKNOWN: + return "n/a" + except Exception: + return "n/a" + return bumblebee.util.durationfmt(estimate*60, shorten=True, suffix=True) # estimate is in minutes + + def capacity(self, widget): + widget.set("capacity", -1) + widget.set("ac", False) + if not os.path.exists(widget.name): + widget.set("capacity", 100) + widget.set("ac", True) + return "ac" + capacity = 100 + try: + with open("{}/capacity".format(widget.name)) as f: + capacity = int(f.read()) + except IOError: + return "n/a" + capacity = capacity if capacity < 100 else 100 + widget.set("capacity", capacity) + if bumblebee.util.asbool(self.parameter("showdevice", False)): + widget.set("theme.minwidth", "100% ({})".format(os.path.basename(widget.name))) + return "{}% ({})".format(capacity, os.path.basename(widget.name)) + widget.set("theme.minwidth", "100%") + + remaining = None + if bumblebee.util.asbool(self.parameter("showremaining", True)): + remaining = self.remaining() + + return "{}%{}".format(capacity, "" if not remaining else " ({})".format(remaining)) + + def state(self, widget): + state = [] + capacity = widget.get("capacity") + + if capacity < 0: + return ["critical", "unknown"] + + if capacity < int(self.parameter("critical", 10)): + state.append("critical") + elif capacity < int(self.parameter("warning", 20)): + state.append("warning") + + if widget.get("ac"): + state.append("AC") + else: + charge = "" + with open("{}/status".format(widget.name)) as f: + charge = f.read().strip() + if charge == "Discharging": + state.append("discharging-{}".format(min([10, 25, 50, 80, 100] , key=lambda i:abs(i-capacity)))) + else: + if capacity > 95: + state.append("charged") + else: + state.append("charging") + + return state + +# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 diff --git a/bumblebee/modules/traffic.py b/bumblebee/modules/traffic.py index ee21794..500eaa5 100644 --- a/bumblebee/modules/traffic.py +++ b/bumblebee/modules/traffic.py @@ -23,6 +23,7 @@ class Module(bumblebee.engine.Module): self._exclude = tuple(filter(len, self.parameter("exclude", "lo,virbr,docker,vboxnet,veth").split(","))) self._status = "" + self._showname = self.parameter("showname", "True") self._prev = {} self._states = {} self._states["include"] = [] @@ -86,11 +87,12 @@ class Module(bumblebee.engine.Module): name = "traffic-{}".format(interface) - self.create_widget(widgets, name, interface) + if self._showname != "False": + self.create_widget(widgets, name, interface) for direction in ["rx", "tx"]: name = "traffic.{}-{}".format(direction, interface) - widget = self.create_widget(widgets, name, attributes={"theme.minwidth": "1000.00MB"}) + widget = self.create_widget(widgets, name, attributes={"theme.minwidth": "100.00MB"}) prev = self._prev.get(name, 0) speed = bumblebee.util.bytefmt(int(data[direction]) - int(prev)) widget.full_text(speed) diff --git a/bumblebee/modules/traffic.py~ b/bumblebee/modules/traffic.py~ new file mode 100644 index 0000000..5dbad89 --- /dev/null +++ b/bumblebee/modules/traffic.py~ @@ -0,0 +1,100 @@ +# pylint: disable=C0111,R0903 + +"""Displays network IO for interfaces. + +Parameters: + * traffic.exclude: Comma-separated list of interface prefixes to exclude (defaults to "lo,virbr,docker,vboxnet,veth") + * traffic.states: Comma-separated list of states to show (prefix with "^" to invert - i.e. ^down -> show all devices that are not in state down) +""" + +import re +import psutil +import netifaces + +import bumblebee.util +import bumblebee.input +import bumblebee.output +import bumblebee.engine + +class Module(bumblebee.engine.Module): + def __init__(self, engine, config): + widgets = [] + super(Module, self).__init__(engine, config, widgets) + self._exclude = tuple(filter(len, self.parameter("exclude", "lo,virbr,docker,vboxnet,veth").split(","))) + self._status = "" + + self._showname = self.parameter("showname", "True") + self._prev = {} + self._states = {} + self._states["include"] = [] + self._states["exclude"] = [] + for state in tuple(filter(len, self.parameter("states", "").split(","))): + if state[0] == "^": + self._states["exclude"].append(state[1:]) + else: + self._states["include"].append(state) + self._update_widgets(widgets) + + def state(self, widget): + if "traffic.rx" in widget.name: + return "rx" + if "traffic.tx" in widget.name: + return "tx" + return self._status + + def update(self, widgets): + self._update_widgets(widgets) + + def create_widget(self, widgets, name, txt=None, attributes={}): + widget = bumblebee.output.Widget(name=name) + widget.full_text(txt) + widgets.append(widget) + + for key in attributes: + widget.set(key, attributes[key]) + + return widget + + def get_addresses(self, intf): + retval = [] + try: + for ip in netifaces.ifaddresses(intf).get(netifaces.AF_INET, []): + if ip.get("addr", "") != "": + retval.append(ip.get("addr")) + except Exception: + return [] + return retval + + def _update_widgets(self, widgets): + interfaces = [ i for i in netifaces.interfaces() if not i.startswith(self._exclude) ] + + del widgets[:] + + counters = psutil.net_io_counters(pernic=True) + for interface in interfaces: + if not interface: interface = "lo" + state = "down" + if len(self.get_addresses(interface)) > 0: + state = "up" + + if len(self._states["exclude"]) > 0 and state in self._states["exclude"]: continue + if len(self._states["include"]) > 0 and state not in self._states["include"]: continue + + data = { + "rx": counters[interface].bytes_recv, + "tx": counters[interface].bytes_sent, + } + + name = "traffic-{}".format(interface) + + #self.create_widget(widgets, name, interface) + + for direction in ["rx", "tx"]: + name = "traffic.{}-{}".format(direction, interface) + widget = self.create_widget(widgets, name, attributes={"theme.minwidth": "100.00MB"}) + prev = self._prev.get(name, 0) + speed = bumblebee.util.bytefmt(int(data[direction]) - int(prev)) + widget.full_text(speed) + self._prev[name] = data[direction] + +# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 diff --git a/themes/.gruvbox-powerline-edit.json.un~ b/themes/.gruvbox-powerline-edit.json.un~ new file mode 100644 index 0000000000000000000000000000000000000000..57a2bd4d4c65a6afe38e3b3690fb1af6a9525357 GIT binary patch literal 19264 zcmeI4J#1V>5P;7=Nqn(M0{)4E30%(nCI+7G&gLBPBLo$QCK8d{5On9nqDWlf2qKC| zL6MLs=%7IKKtq8*G@+phAR?%dkPrg#Q&LbMm~Y?Cdy~uQyt##L$C}%{y?5`e=JU+% z&aQp(rL*rnf9~n6pDLp>A71$3?4{4%`TgDJ{#y9)^=prRaQOQ_&aWQ*?b5!@%YVQ4 zb)`~iiq2H4)p}>Me!Ny+Y_(6cn(fo8b!k5)dW-0YuS?@Z; zGL{$am5*){y_I+Wh`3wvCdvO`f%Q)he(Z2mDu2$){W1Hr=)X`o0YbMqW!=%+WgcVU=Znb z6^{~hyF^vMT67?xRI?0O7MAo@?SpcDWRMTqSeyG`CsQv3)o#-CaU<6(AI%AZftKsNI z`;UD$qAR@)R8`Y8FcuF?0n=D!m}+53Z&l|IQa96<`DyEQz4J|rE+6Z*YzvCbGI zsv3fB!J!)q9qUT30~N^_6)@f*nwIElk(jcGUviVeA*8-7>X+#AOV;ZavBAIfgG(OTZfQG$qoYEgpDVe>r(D_QV_(i2r&|Z^CO3ISB_J0D9#%*HnJ1!Hz3$1MVdebjQ5MW?cNkb)ht7ncd8|&JS56yIeT)k|^Lri~E6tC03 z2oin=RKWFszDbDG5<`|Dh~DT$1fERP@pLOdfB=qG1*hpZnh+o+aLyF}!Al6ZH+#W> zXhjro6ZMUAXXIql1wV>`hqEy%9G?JJm4@VJSRq0}aJ@AM*8wJzNDnqJ5nEM22<9|` zsYPPS5NvN-Y>v+2dlHJ(P^&MmpnP$KXTW~3lvF~ zBywtzm@^_IC+@%p<)ySVMe(bCW1ch*3aG$7BC1l8 z3b&l3Ae%U z)BWL4i4IhYrgvZj-G17V*I|VS2|@Rm^SZrx936}fcqKYekxNklV+xpRjo2~--7}#9 zv)SgSLF9_n1z*%(M+zQxIz_b>LsfVC@#i5(pIbddO;FVrSqD+OPHK|a}8j&PV*%XWrBW#&F pOG-%{MMz*X%iurgd~UrC(-;34$7QZ(O-ui*X1$ZGT>Sa{e*u<(jdlP4 literal 0 HcmV?d00001 diff --git a/themes/.powerline-edit.json.un~ b/themes/.powerline-edit.json.un~ new file mode 100644 index 0000000000000000000000000000000000000000..754aa7309051a1484cd0886243153ef122ac95f4 GIT binary patch literal 36019 zcmeI5+wWXe702gy>E-m-mflMd>|u%*r05T9e+3jRh&Q|dRWOyHw)SEZTTCG}hBT2E zgMWYzMnzxL&=`%WFZyImj4wR+pby6QVq%aO;)7CRY=Y~v&sj6ynI6W?+2w8RW_PdO z%$zeT-_NYQ*WPEJnMY2Y{{F*f?tA=igZT$8tUSMa->-(B`Q@w6JolS#z4XJu(XU^B z_TdAUfBo6N-hB7Zmj{CZbz4izPHkiD_Do+gBD1+5n{%#8# zgPp5U+UBtP*)%&4z0)e78TYE;iDuy2cPIabds}p%s;qheBYkQ5fJE52EIr#CbQcw! zN0y_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vLIL<}>k#=9CM>x-iefiWk%4 Date: Thu, 21 Sep 2017 09:43:13 +0530 Subject: [PATCH 2/4] Ignore Vim swap files --- .gitignore | 2 + bumblebee/modules/.battery.py.un~ | Bin 2812 -> 0 bytes bumblebee/modules/.traffic.py.un~ | Bin 34029 -> 0 bytes bumblebee/modules/battery.py~ | 120 ------------------------ bumblebee/modules/traffic.py~ | 100 -------------------- themes/.gruvbox-powerline-edit.json.un~ | Bin 19264 -> 0 bytes themes/.powerline-edit.json.un~ | Bin 36019 -> 0 bytes themes/gruvbox-powerline-edit.json~ | 51 ---------- themes/powerline-edit.json~ | 48 ---------- 9 files changed, 2 insertions(+), 319 deletions(-) delete mode 100644 bumblebee/modules/.battery.py.un~ delete mode 100644 bumblebee/modules/.traffic.py.un~ delete mode 100644 bumblebee/modules/battery.py~ delete mode 100644 bumblebee/modules/traffic.py~ delete mode 100644 themes/.gruvbox-powerline-edit.json.un~ delete mode 100644 themes/.powerline-edit.json.un~ delete mode 100644 themes/gruvbox-powerline-edit.json~ delete mode 100644 themes/powerline-edit.json~ diff --git a/.gitignore b/.gitignore index d7d9fd4..a8daa9c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ +# Vim swap files *swp +*~ # Byte-compiled / optimized / DLL files __pycache__/ diff --git a/bumblebee/modules/.battery.py.un~ b/bumblebee/modules/.battery.py.un~ deleted file mode 100644 index 8ab0992c7cf91cb3c003c20b3bb893eb9e74e50e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2812 zcmWH`%$*;a=aT=FfyqHLbGGG?z@8VEb2ledS!}%;aI#S`-PNSAxnu?7!%`Op28IeC zmQX+fMX4pFMR^KJdHRV;KskFL76D>LAZ7z%5CG9I%n-RntDglV%g7La0VE3qOb`l8 zf~0JLSOUcR4+LPNK%7xPgAf2lM>jY+7#O~Sg4_m(?SL2*&!DJ~L5gZH6FI(38^KWs zQpXI$FaV0q(I|w42F+kO_{;(dYw( z1YH0y`ugxip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SL~LnM{=6FRhJ>j|Z*?Q?3t7l^_X{y^MlnJi9~&E?!3C#1?J1iy-=&9Z>aUbY5!a zW%Q~JsN~g)F~!}S&^&EA0qIEBD8#o|Mfb|q=oYr>0`rXN0H7mWqY&R>72L~PgPY%m z4a*7BemFbaCT6a&a}rY0aqutp)i#VWAF_tVk9ZXR}mBQLuuFpgYR8}7Mq z%^h|szWfY>grjjC1_{AP_(%oB5vyv$J+Hz#3=)opRfB}qQRxGOBUN{rT7gjgAk3TY z&o7&6q+*MMa6U*F4p&G`M5726a?>DjX;n4hmA5u7?6LFVIjM+cRb5)ujYePz+X1tN zfQ$h^`YEQ|vobpp+!*xQolbZD?A?2frkrY9Zp)FiLJ$dz zPncGNIAS#l@huA0UzK6aJu6GF7N|n8ZdwlENYyCBw^&8B$;?Nkglaw}2*f8%!|PIx zP>n)-i&aq1Dp2wgsJUPu48x&`tnKiPOfzNpXH`rmMr3NEfFL|!nhxHG)F{NaScUY= zh)7NN4}wpbRzo)uH45=93ejJe&5=%zNOUvq2f)vnMgunjH45=9Rsqc&k12VQ4g-Gh zJ89Ys+sM->#J5<*Gj~F~gr`ROtZUM8&_SbDEWR#9Oa-KPfwr(SCPL!^F8|jyNg6xKy^iuQ&HhAJdTf{v>8~Bhv5ATL zq6IKe$0BIXHA&IEQG%<8C7iVG&G|$eQQiAS(Gm)e;O5K@5wHhMUw|G#8-@55t3Y4hHs}IpxQ4&ym-Pqck+Uycb9dodbF#UjcWNZ}TTdZRI?6w_wGcXO(@bkb~SHK++`*JmR z7sL}~Zan<;eMLR88xKR(5Itt9gmxrs6yjT~B0QyJH6NL 0: del widgets[0] - for widget in new_widgets: - widgets.append(widget) - self._widgets = widgets - - def remaining(self): - estimate = 0.0 - try: - estimate = power.PowerManagement().get_time_remaining_estimate() - # do not show remaining if on AC - if estimate == power.common.TIME_REMAINING_UNLIMITED: - return None - if estimate == power.common.TIME_REMAINING_UNKNOWN: - return "n/a" - except Exception: - return "n/a" - return bumblebee.util.durationfmt(estimate*60, shorten=True, suffix=True) # estimate is in minutes - - def capacity(self, widget): - widget.set("capacity", -1) - widget.set("ac", False) - if not os.path.exists(widget.name): - widget.set("capacity", 100) - widget.set("ac", True) - return "ac" - capacity = 100 - try: - with open("{}/capacity".format(widget.name)) as f: - capacity = int(f.read()) - except IOError: - return "n/a" - capacity = capacity if capacity < 100 else 100 - widget.set("capacity", capacity) - if bumblebee.util.asbool(self.parameter("showdevice", False)): - widget.set("theme.minwidth", "100% ({})".format(os.path.basename(widget.name))) - return "{}% ({})".format(capacity, os.path.basename(widget.name)) - widget.set("theme.minwidth", "100%") - - remaining = None - if bumblebee.util.asbool(self.parameter("showremaining", True)): - remaining = self.remaining() - - return "{}%{}".format(capacity, "" if not remaining else " ({})".format(remaining)) - - def state(self, widget): - state = [] - capacity = widget.get("capacity") - - if capacity < 0: - return ["critical", "unknown"] - - if capacity < int(self.parameter("critical", 10)): - state.append("critical") - elif capacity < int(self.parameter("warning", 20)): - state.append("warning") - - if widget.get("ac"): - state.append("AC") - else: - charge = "" - with open("{}/status".format(widget.name)) as f: - charge = f.read().strip() - if charge == "Discharging": - state.append("discharging-{}".format(min([10, 25, 50, 80, 100] , key=lambda i:abs(i-capacity)))) - else: - if capacity > 95: - state.append("charged") - else: - state.append("charging") - - return state - -# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 diff --git a/bumblebee/modules/traffic.py~ b/bumblebee/modules/traffic.py~ deleted file mode 100644 index 5dbad89..0000000 --- a/bumblebee/modules/traffic.py~ +++ /dev/null @@ -1,100 +0,0 @@ -# pylint: disable=C0111,R0903 - -"""Displays network IO for interfaces. - -Parameters: - * traffic.exclude: Comma-separated list of interface prefixes to exclude (defaults to "lo,virbr,docker,vboxnet,veth") - * traffic.states: Comma-separated list of states to show (prefix with "^" to invert - i.e. ^down -> show all devices that are not in state down) -""" - -import re -import psutil -import netifaces - -import bumblebee.util -import bumblebee.input -import bumblebee.output -import bumblebee.engine - -class Module(bumblebee.engine.Module): - def __init__(self, engine, config): - widgets = [] - super(Module, self).__init__(engine, config, widgets) - self._exclude = tuple(filter(len, self.parameter("exclude", "lo,virbr,docker,vboxnet,veth").split(","))) - self._status = "" - - self._showname = self.parameter("showname", "True") - self._prev = {} - self._states = {} - self._states["include"] = [] - self._states["exclude"] = [] - for state in tuple(filter(len, self.parameter("states", "").split(","))): - if state[0] == "^": - self._states["exclude"].append(state[1:]) - else: - self._states["include"].append(state) - self._update_widgets(widgets) - - def state(self, widget): - if "traffic.rx" in widget.name: - return "rx" - if "traffic.tx" in widget.name: - return "tx" - return self._status - - def update(self, widgets): - self._update_widgets(widgets) - - def create_widget(self, widgets, name, txt=None, attributes={}): - widget = bumblebee.output.Widget(name=name) - widget.full_text(txt) - widgets.append(widget) - - for key in attributes: - widget.set(key, attributes[key]) - - return widget - - def get_addresses(self, intf): - retval = [] - try: - for ip in netifaces.ifaddresses(intf).get(netifaces.AF_INET, []): - if ip.get("addr", "") != "": - retval.append(ip.get("addr")) - except Exception: - return [] - return retval - - def _update_widgets(self, widgets): - interfaces = [ i for i in netifaces.interfaces() if not i.startswith(self._exclude) ] - - del widgets[:] - - counters = psutil.net_io_counters(pernic=True) - for interface in interfaces: - if not interface: interface = "lo" - state = "down" - if len(self.get_addresses(interface)) > 0: - state = "up" - - if len(self._states["exclude"]) > 0 and state in self._states["exclude"]: continue - if len(self._states["include"]) > 0 and state not in self._states["include"]: continue - - data = { - "rx": counters[interface].bytes_recv, - "tx": counters[interface].bytes_sent, - } - - name = "traffic-{}".format(interface) - - #self.create_widget(widgets, name, interface) - - for direction in ["rx", "tx"]: - name = "traffic.{}-{}".format(direction, interface) - widget = self.create_widget(widgets, name, attributes={"theme.minwidth": "100.00MB"}) - prev = self._prev.get(name, 0) - speed = bumblebee.util.bytefmt(int(data[direction]) - int(prev)) - widget.full_text(speed) - self._prev[name] = data[direction] - -# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 diff --git a/themes/.gruvbox-powerline-edit.json.un~ b/themes/.gruvbox-powerline-edit.json.un~ deleted file mode 100644 index 57a2bd4d4c65a6afe38e3b3690fb1af6a9525357..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 19264 zcmeI4J#1V>5P;7=Nqn(M0{)4E30%(nCI+7G&gLBPBLo$QCK8d{5On9nqDWlf2qKC| zL6MLs=%7IKKtq8*G@+phAR?%dkPrg#Q&LbMm~Y?Cdy~uQyt##L$C}%{y?5`e=JU+% z&aQp(rL*rnf9~n6pDLp>A71$3?4{4%`TgDJ{#y9)^=prRaQOQ_&aWQ*?b5!@%YVQ4 zb)`~iiq2H4)p}>Me!Ny+Y_(6cn(fo8b!k5)dW-0YuS?@Z; zGL{$am5*){y_I+Wh`3wvCdvO`f%Q)he(Z2mDu2$){W1Hr=)X`o0YbMqW!=%+WgcVU=Znb z6^{~hyF^vMT67?xRI?0O7MAo@?SpcDWRMTqSeyG`CsQv3)o#-CaU<6(AI%AZftKsNI z`;UD$qAR@)R8`Y8FcuF?0n=D!m}+53Z&l|IQa96<`DyEQz4J|rE+6Z*YzvCbGI zsv3fB!J!)q9qUT30~N^_6)@f*nwIElk(jcGUviVeA*8-7>X+#AOV;ZavBAIfgG(OTZfQG$qoYEgpDVe>r(D_QV_(i2r&|Z^CO3ISB_J0D9#%*HnJ1!Hz3$1MVdebjQ5MW?cNkb)ht7ncd8|&JS56yIeT)k|^Lri~E6tC03 z2oin=RKWFszDbDG5<`|Dh~DT$1fERP@pLOdfB=qG1*hpZnh+o+aLyF}!Al6ZH+#W> zXhjro6ZMUAXXIql1wV>`hqEy%9G?JJm4@VJSRq0}aJ@AM*8wJzNDnqJ5nEM22<9|` zsYPPS5NvN-Y>v+2dlHJ(P^&MmpnP$KXTW~3lvF~ zBywtzm@^_IC+@%p<)ySVMe(bCW1ch*3aG$7BC1l8 z3b&l3Ae%U z)BWL4i4IhYrgvZj-G17V*I|VS2|@Rm^SZrx936}fcqKYekxNklV+xpRjo2~--7}#9 zv)SgSLF9_n1z*%(M+zQxIz_b>LsfVC@#i5(pIbddO;FVrSqD+OPHK|a}8j&PV*%XWrBW#&F pOG-%{MMz*X%iurgd~UrC(-;34$7QZ(O-ui*X1$ZGT>Sa{e*u<(jdlP4 diff --git a/themes/.powerline-edit.json.un~ b/themes/.powerline-edit.json.un~ deleted file mode 100644 index 754aa7309051a1484cd0886243153ef122ac95f4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 36019 zcmeI5+wWXe702gy>E-m-mflMd>|u%*r05T9e+3jRh&Q|dRWOyHw)SEZTTCG}hBT2E zgMWYzMnzxL&=`%WFZyImj4wR+pby6QVq%aO;)7CRY=Y~v&sj6ynI6W?+2w8RW_PdO z%$zeT-_NYQ*WPEJnMY2Y{{F*f?tA=igZT$8tUSMa->-(B`Q@w6JolS#z4XJu(XU^B z_TdAUfBo6N-hB7Zmj{CZbz4izPHkiD_Do+gBD1+5n{%#8# zgPp5U+UBtP*)%&4z0)e78TYE;iDuy2cPIabds}p%s;qheBYkQ5fJE52EIr#CbQcw! zN0y_Tuc{UlVAhEnKm$}N0m_x=+2(-yMFKU~* zl6D5<_c4ueY!hd-aqJI?(|p5;!H%KmR;wg|mK#20&DM?{(H`C+GlYG&9Xq<5<_D5b zLUX-UFOcRf$TK5LL4=Z`bg?~aSGs>mbQi{%KQAO2iNZz8{C#8t%?7Jpz;>h6%{&kt zCMpz^98@pq$X45%4Xrw=t_W<0I!JA_>II4%8suD&k~W9jKb0Iov&X8F>*yp~aDYm) ziPk?LGO`A^R*<452i(6D+)eg&tc^Ih86gL$G=8=oLXks*Tq{UXlSA&`iQHl{t`Rh( z6;AH8Lk>_0QtKcPW0Y&fC~h*qy*RHSSKC|aD7XEJJoEPD(cBwWTf|2=20Ia?$Sh`; zE*DI!nvBtbYOA;h#z;{_kRme&-GYYQbc&)^dYXBhg=u(o> zUZiW#jmSZ2yLbo1NH0Z@A~T2Fq6Xb`dO35fgVhf4501f31Sv9$+07d3K($lc17pk$ zM35pg2i+Xtg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2r#nRkmPP}^g5fyZK}F)9?498y0}QbT()Zo>9ODEWF3$m|ne zpvFrhrbLw9CQ7EyytUX{+B2QAmPJ2q^Zl`sB1lHdO6`g+NcQvMwt#DN;s_>}rDr=* zvQ@PU(S?L)U9%JqB41$l8?HgJA`XD7wi;0+qVzU%5dBu8$QRwY7BUBh(Jxg3=72Z? zG=K&u5v8}81L}7P)KU{mJ}_Mg3NUwwBS5>+DmWv9K!lQ#1FHF{%J!~_+TIOV4$7`S zzQ&LC0_skyUVzAv0nQaEX>-8+QM*E7h7Qib*#_?6#4nimPGC6QC9c7+wi?_-l-?!? z7TTk+yRwWwDK{U&(lKo!2$J`-C!qmXgq8?WWTK=a!tO%!=Y(i|GkAGurFU%+f#kjE zf#yGOfpR^6My`$u1tkN~E4wv{{0nL6HtEPVTIYA<$tRDW{hF=TKI*F#8dG=&K!S9h zKLQ#m6qFojb%M5GGAVRu3)T6@+VJxD#GO@E7p;y~LxL2t6qJ#Yb`ET|3sP9E;HN|Q z0rO`xydcCf2A2{EFYXSTOfFvLIL<}>k#=9CM>x-iefiWk%4 Date: Thu, 21 Sep 2017 10:13:17 +0530 Subject: [PATCH 3/4] Removed my theme changes --- themes/gruvbox-powerline-edit.json | 51 ------------------------------ themes/powerline-edit.json | 48 ---------------------------- 2 files changed, 99 deletions(-) delete mode 100644 themes/gruvbox-powerline-edit.json delete mode 100644 themes/powerline-edit.json diff --git a/themes/gruvbox-powerline-edit.json b/themes/gruvbox-powerline-edit.json deleted file mode 100644 index c943358..0000000 --- a/themes/gruvbox-powerline-edit.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "icons": [ "paxy97", "awesome-fonts" ], - "defaults": { - "warning": { - "fg": "#1d2021", - "bg": "#d79921e6" - }, - "critical": { - "fg": "#fbf1c7", - "bg": "#cc241de6" - }, - "default-separators": false, - "separator-block-width": 0 - }, - "cycle": [ - { - "fg": "#ebdbb2", - "bg": "#171a1ce6" - }, - { - "fg": "#fbf1c7", - "bg": "#282828e6" - } - ], - "dnf": { - "good": { - "fg": "#002b36", - "bg": "#859900e6" - } - }, - "battery": { - "charged": { - "fg": "#1d2021", - "bg": "#b8bb26e6" - }, - "AC": { - "fg": "#1d2021", - "bg": "#b8bb26e6" - } - }, - "cmus": { - "fg": "#fbf1c7", - "bg": "#080808e6" - }, - "bluetooth": { - "ON": { - "fg": "#1d2021", - "bg": "#b8bb26e6" - } - } -} diff --git a/themes/powerline-edit.json b/themes/powerline-edit.json deleted file mode 100644 index 1828ebd..0000000 --- a/themes/powerline-edit.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "icons": [ "awesome-fonts" ], - "defaults": { - "separator-block-width": 0, - "critical": { - "fg": "#ffffff", - "bg": "#ff0000" - }, - "warning": { - "fg": "#d75f00", - "bg": "#ffd700" - }, - "default_separators": false - }, - "cycle": [ - { - "fg": "#ffd700", - "bg": "#d75f00" - }, - { - "fg": "#ffffff", - "bg": "#0000f066" - } - ], - "dnf": { - "good": { - "fg": "#494949", - "bg": "#41db00" - } - }, - "battery": { - "charged": { - "fg": "#494949", - "bg": "#41db00" - }, - "AC": { - "fg": "#494949", - "bg": "#41db00" - }, - "charging": { - - "fg": "#494949", - "bg": "#41db00" - - } - - } -} From 0ed315653c40226a19fe5608a6d767cddf879506 Mon Sep 17 00:00:00 2001 From: batman-nair Date: Mon, 16 Oct 2017 18:35:38 +0530 Subject: [PATCH 4/4] Added theme sac_red --- themes/sac_red.json | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 themes/sac_red.json diff --git a/themes/sac_red.json b/themes/sac_red.json new file mode 100644 index 0000000..fade76e --- /dev/null +++ b/themes/sac_red.json @@ -0,0 +1,44 @@ +{ + "icons": [ "paxy97", "awesome-fonts" ], + "defaults": { + "warning": { + "fg": "#FDFFFC", + "bg": "#B91372" + }, + "critical": { + "fg": "#FDFFFC", + "bg": "#FF0022" + }, + "default-separators": false, + "separator-block-width": 0 + }, + "cycle": [ + { + "fg": "#FDFFFC", + "bg": "#990014" + }, + { + "fg": "#FDFFFC", + "bg": "#011627" + } + ], + "battery": { + "charged": { + "fg": "#FDFFFC", + "bg": "#41EAD4" + }, + "AC": { + "fg": "#FDFFFC", + "bg": "#41EAD4" + } + }, + "bluetooth": { + "ON": { + "fg": "#FDFFFC", + "bg": "#41EAD4" + } + }, + "cmus": { + "bg": "#C42021" + } +}