From 52b4bfac35e01b09b92bc6b6f9e1b985f23b9a7f Mon Sep 17 00:00:00 2001 From: Antonin Dach Date: Sat, 12 May 2018 19:37:19 +0200 Subject: [PATCH 1/3] [module] - adding caps/num/scrl indicator widget --- README.md | 2 +- bumblebee/modules/indicator.py | 51 ++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 bumblebee/modules/indicator.py diff --git a/README.md b/README.md index b016f2a..53102ce 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [![Test Coverage](https://codeclimate.com/github/tobi-wan-kenobi/bumblebee-status/badges/coverage.svg)](https://codeclimate.com/github/tobi-wan-kenobi/bumblebee-status/coverage) [![Issue Count](https://codeclimate.com/github/tobi-wan-kenobi/bumblebee-status/badges/issue_count.svg)](https://codeclimate.com/github/tobi-wan-kenobi/bumblebee-status) -**Many, many thanks to all contributors! As of now, 26 of the modules are from various contributors (!), and only 16 from myself.** +**Many, many thanks to all contributors! As of now, 27 of the modules are from various contributors (!), and only 16 from myself.** ![Solarized Powerline](https://github.com/tobi-wan-kenobi/bumblebee-status/blob/master/screenshots/themes/powerline-solarized.png) diff --git a/bumblebee/modules/indicator.py b/bumblebee/modules/indicator.py new file mode 100644 index 0000000..a4d1712 --- /dev/null +++ b/bumblebee/modules/indicator.py @@ -0,0 +1,51 @@ +#pylint: disable=C0111,R0903 + +"""Displays the indicator status, for numlock, scrolllock and capslock + +Parameters: + * indicator.include: Comma-separated list of interface prefixes to include (defaults to "numlock,capslock") + * indicator.signalstype: If you want the signali type color to be "critical" or "warning" (defaults to "warning") +""" + + +import bumblebee.input +import bumblebee.output +import bumblebee.engine + +class Module(bumblebee.engine.Module): + def __init__(self, engine, config): + widgets = [] + self.status = False + super(Module,self).__init__(engine, config, widgets) + self._include = tuple(filter(len, self.parameter("include", "NumLock,CapsLock").split(","))) + self._signalType = self.parameter("signaltype") if not self.parameter("signaltype") == None else "warning" + + def update(self, widgets): + self._update_widgets(widgets) + + def state(self, widget): + states = [] + if widget.status: + states.append(self._signalType) + elif not widget.status: + states.append("normal") + return states + + def _update_widgets(self, widgets): + status_line = "" + for line in bumblebee.util.execute("xset q").replace(" ", "").split("\n"): + if "capslock" in line.lower(): + status_line = line + break + + for indicator in self._include: + widget = self.widget(indicator) + if not widget: + widget = bumblebee.output.Widget(name=indicator) + widgets.append(widget) + + widget.status = True if indicator.lower()+":on" in status_line.lower() else False + widget.full_text(indicator) + + +# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 From 8946322bd5128cef05ff294c41d648ab61483843 Mon Sep 17 00:00:00 2001 From: Antonin Dach Date: Sat, 12 May 2018 20:23:55 +0200 Subject: [PATCH 2/3] [modul pacman] - enable suming up all updates to save screen real estate --- bumblebee/modules/pacman.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bumblebee/modules/pacman.py b/bumblebee/modules/pacman.py index b5921a7..3a24f5f 100644 --- a/bumblebee/modules/pacman.py +++ b/bumblebee/modules/pacman.py @@ -1,6 +1,9 @@ # pylint: disable=C0111,R0903 -"""Displays update information per repository for pacman." +"""Displays update information per repository for pacman. + +Parameters: + * pacman.sum: If you prefere displaying updates with a single digit (defaults to "False") Requires the following executables: * fakeroot @@ -45,8 +48,12 @@ class Module(bumblebee.engine.Module): bumblebee.output.Widget(full_text=self.updates) ) self._count = 0 + self._sum = True if self.parameter("sum") == "True" else False + def updates(self, widget): + if (self._sum): + return str(sum(map(lambda x: widget.get(x, 0), repos))) return '/'.join(map(lambda x: str(widget.get(x, 0)), repos)) def update(self, widgets): From 7a730be09e6512b62ea28488c4d0764db5665449 Mon Sep 17 00:00:00 2001 From: Antonin Dach Date: Sat, 12 May 2018 20:30:28 +0200 Subject: [PATCH 3/3] Ignore visual studio code project files if generated --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index a8daa9c..577808b 100644 --- a/.gitignore +++ b/.gitignore @@ -91,3 +91,6 @@ ENV/ # Rope project settings .ropeproject + +# Visual studio project files +.vscode/