[modules] Add CPU module
Also, change minwidth from theme.minwidth to widget property
This commit is contained in:
parent
51faef9fd4
commit
d2e8057141
6 changed files with 48 additions and 3 deletions
|
@ -8,7 +8,7 @@ def scrollable(func):
|
|||
return text
|
||||
width = widget.get('theme.width', util.format.asint(module.parameter('width', 30)))
|
||||
if util.format.asbool(module.parameter('scrolling.makewide', True)):
|
||||
widget.set('theme.minwidth', 'A'*width)
|
||||
widget.minwidth = 'A'*width
|
||||
if width < 0 or len(text) <= width:
|
||||
return text
|
||||
|
||||
|
|
|
@ -5,6 +5,11 @@ import core.input
|
|||
import core.widget
|
||||
import core.decorators
|
||||
|
||||
try:
|
||||
error = ModuleNotFoundError('')
|
||||
except Exception as e:
|
||||
ModuleNotFoundError = Exception
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
def load(module_name, config=None):
|
||||
|
|
|
@ -86,7 +86,7 @@ class i3(object):
|
|||
'full_text': self.__decorate(module, widget, text),
|
||||
'color': self._theme.fg(widget),
|
||||
'background': self._theme.bg(widget),
|
||||
'min_width': widget.get('theme.minwidth'),
|
||||
'min_width': self.__decorate(module, widget, widget.minwidth),
|
||||
})
|
||||
return [attr]
|
||||
|
||||
|
|
|
@ -9,6 +9,8 @@ class Widget(util.store.Store, core.input.Object):
|
|||
self._module = module
|
||||
self._name = name
|
||||
|
||||
self.minwidth = None
|
||||
|
||||
def name(self):
|
||||
return self._name
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue