From 03ada54681563e0a986122cb9fd6907e73d63955 Mon Sep 17 00:00:00 2001 From: TheEdgeOfRage Date: Sun, 5 Jan 2025 17:47:24 +0100 Subject: [PATCH] Add oled_offset module --- .../modules/contrib/oled_offset.py | 27 +++++++++++++++++++ tests/modules/contrib/test_oled_offset.py | 5 ++++ themes/icons/awesome-fonts.json | 3 +++ 3 files changed, 35 insertions(+) create mode 100644 bumblebee_status/modules/contrib/oled_offset.py create mode 100644 tests/modules/contrib/test_oled_offset.py diff --git a/bumblebee_status/modules/contrib/oled_offset.py b/bumblebee_status/modules/contrib/oled_offset.py new file mode 100644 index 00000000..d8cf34f6 --- /dev/null +++ b/bumblebee_status/modules/contrib/oled_offset.py @@ -0,0 +1,27 @@ +# pylint: disable=C0111,R0903 + +"""Creates an empty widget that changes width on a timer, +to reduce changes o OLED burn-in from other bumblebee modules. + +You should put this module as the last one, +so all the other modules are moved when this one changes in width + +contributed by `TheEdgeOfRage `_ - many thanks! +""" + +import core.module +import core.widget +import core.decorators + + +class Module(core.module.Module): + @core.decorators.every(minutes=1) + def __init__(self, config, theme): + super().__init__(config, theme, core.widget.Widget(self.content)) + self.__offset = 0 + + def content(self, _): + return self.__offset * " " + + def update(self): + self.__offset = (self.__offset + 1) % 3 diff --git a/tests/modules/contrib/test_oled_offset.py b/tests/modules/contrib/test_oled_offset.py new file mode 100644 index 00000000..50392b9c --- /dev/null +++ b/tests/modules/contrib/test_oled_offset.py @@ -0,0 +1,5 @@ +import pytest + +def test_load_module(): + __import__("modules.contrib.oled_offset") + diff --git a/themes/icons/awesome-fonts.json b/themes/icons/awesome-fonts.json index 7b86cb8a..35a70ccf 100644 --- a/themes/icons/awesome-fonts.json +++ b/themes/icons/awesome-fonts.json @@ -742,5 +742,8 @@ }, "power-profile": { "prefix": "\uF2C1" + }, + "oled_offset": { + "padding": "" } }