From d15750008f76b5d5c6f5e7bb7e27578b88a64f08 Mon Sep 17 00:00:00 2001 From: Naya Verdier Date: Sun, 6 Aug 2017 11:21:54 -0700 Subject: [PATCH 1/3] Revert part of commit df6e323 to fix the CPU icon After that commit it because unrecognized to awesome fonts causing a box to be in place of the CPU icon. --- themes/icons/awesome-fonts.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/icons/awesome-fonts.json b/themes/icons/awesome-fonts.json index 9917d97..e014fab 100644 --- a/themes/icons/awesome-fonts.json +++ b/themes/icons/awesome-fonts.json @@ -7,7 +7,7 @@ "time": { "prefix": "" }, "datetime": { "prefix": "" }, "memory": { "prefix": "" }, - "cpu": { "prefix": "" }, + "cpu": { "prefix": "" }, "disk": { "prefix": "" }, "dnf": { "prefix": "" }, "pacman": { "prefix": "" }, From aa9941ceda96533d8e299a37d21750be73047c9b Mon Sep 17 00:00:00 2001 From: Naya Verdier Date: Sun, 6 Aug 2017 11:29:41 -0700 Subject: [PATCH 2/3] [module/datetime] Add locale parameter to override system default This change mostly affects the %x and %X variables, for example to change to 24 hour time you might set the locale to 'en_UK.UTF-8'. --- bumblebee/modules/datetime.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/bumblebee/modules/datetime.py b/bumblebee/modules/datetime.py index e1b9236..64df23e 100644 --- a/bumblebee/modules/datetime.py +++ b/bumblebee/modules/datetime.py @@ -6,6 +6,9 @@ Parameters: * datetime.format: strftime()-compatible formatting string * date.format : alias for datetime.format * time.format : alias for datetime.format + * datetime.locale: locale to use rather than the system default + * date.locale : alias for datetime.locale + * time.locale : alias for datetime.locale """ from __future__ import absolute_import @@ -13,8 +16,6 @@ import datetime import locale import bumblebee.engine -locale.setlocale(locale.LC_TIME, locale.getdefaultlocale()) - ALIASES = [ "date", "time" ] def default_format(module): @@ -28,9 +29,15 @@ def default_format(module): class Module(bumblebee.engine.Module): def __init__(self, engine, config): super(Module, self).__init__(engine, config, - bumblebee.output.Widget(full_text=self.get_time) - ) + bumblebee.output.Widget(full_text=self.get_time)) self._fmt = self.parameter("format", default_format(self.name)) + self._lcl = self.parameter("locale").split(".") + + # can't use the default in "parameter" because we split the + # string, while 'getdefaultlocale' already returns a tuple + if self._lcl is None: + self._lcl = locale.getdefaultlocale() + locale.setlocale(locale.LC_TIME, self._lcl) def get_time(self, widget): return datetime.datetime.now().strftime(self._fmt) From 7e1e0204436cb304245382fd2761d063a5798bac Mon Sep 17 00:00:00 2001 From: Naya Verdier Date: Sun, 6 Aug 2017 11:46:05 -0700 Subject: [PATCH 3/3] [module/datetime] Fix case when no locale is set --- bumblebee/modules/datetime.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bumblebee/modules/datetime.py b/bumblebee/modules/datetime.py index 64df23e..533261a 100644 --- a/bumblebee/modules/datetime.py +++ b/bumblebee/modules/datetime.py @@ -31,12 +31,14 @@ class Module(bumblebee.engine.Module): super(Module, self).__init__(engine, config, bumblebee.output.Widget(full_text=self.get_time)) self._fmt = self.parameter("format", default_format(self.name)) - self._lcl = self.parameter("locale").split(".") + lcl = self.parameter("locale") # can't use the default in "parameter" because we split the # string, while 'getdefaultlocale' already returns a tuple - if self._lcl is None: + if lcl is None: self._lcl = locale.getdefaultlocale() + else: + self._lcl = lcl.split(".") locale.setlocale(locale.LC_TIME, self._lcl) def get_time(self, widget):