From cc9e641561d1904544bf40bbe4377bdd89ff91f0 Mon Sep 17 00:00:00 2001 From: tobyp Date: Sun, 10 Nov 2019 20:30:46 +0100 Subject: [PATCH] Support disabling scrollable by setting width=-1 on the module --- bumblebee/output.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/bumblebee/output.py b/bumblebee/output.py index 004dfe8..44515aa 100644 --- a/bumblebee/output.py +++ b/bumblebee/output.py @@ -12,14 +12,17 @@ import bumblebee.util def scrollable(func): def wrapper(module, widget): text = func(module, widget) - if not text: return text - width = widget.get("theme.width", module.parameter("width", 30)) + if not text: + return text + width = widget.get("theme.width", int(module.parameter("width", 30))) if bumblebee.util.asbool(module.parameter("scrolling.makewide", "true")): widget.set("theme.minwidth", "A"*width) + if width < 0: + return text if len(text) <= width: return text # we need to shorten - + try: bounce = int(module.parameter("scrolling.bounce", 1)) except ValueError: @@ -31,7 +34,7 @@ def scrollable(func): start = widget.get("scrolling.start", -1) direction = widget.get("scrolling.direction", "right") start += scroll_speed if direction == "right" else -(scroll_speed) - + if width + start > len(text) + (scroll_speed -1): if bounce: widget.set("scrolling.direction", "left")