[modules/traffic] Add alignment and minimum width

Set the minimum width for uplink and downlink widgets to "down 1000MB",
which should be plenty, and change alignment to right (personally, I
find this looks nicer).

To not have the icons on the left side "jump around" depending on the
value, make them suffixes.

If this solution is not sufficient, alternatively, the widget itself
could perform value padding. In that case, the whole alignment and
min-width settings would be obsolete and the icons could remain on the
left side.
This commit is contained in:
Tobias Witek 2017-04-22 08:26:28 +02:00
parent 5db5e02086
commit e6357f4c90
3 changed files with 8 additions and 4 deletions

View file

@ -54,9 +54,13 @@ class Module(bumblebee.engine.Module):
widget_tx = self.widget(txname)
if not widget_rx:
widget_rx = bumblebee.output.Widget(name=rxname)
widget_rx.set("theme-minwidth", "down 1000MB")
widget_rx.set("theme-align", "right")
widgets.append(widget_rx)
if not widget_tx:
widget_tx = bumblebee.output.Widget(name=txname)
widget_tx.set("theme-minwidth", "down 1000MB")
widget_tx.set("theme-align", "right")
widgets.append(widget_tx)
prev_rx = widget_rx.get("rx", 0)

View file

@ -64,7 +64,7 @@
"prefix": "sensors"
},
"traffic": {
"rx": { "prefix": "down"},
"tx": {"prefix": "up"}
"rx": { "suffix": "down"},
"tx": {"suffix": "up"}
}
}

View file

@ -80,7 +80,7 @@
"prefix": "🌡"
},
"traffic":{
"rx": { "prefix": "" },
"tx": { "prefix": "" }
"rx": { "suffix": "" },
"tx": { "suffix": "" }
}
}