[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:
parent
5db5e02086
commit
e6357f4c90
3 changed files with 8 additions and 4 deletions
|
@ -54,9 +54,13 @@ class Module(bumblebee.engine.Module):
|
||||||
widget_tx = self.widget(txname)
|
widget_tx = self.widget(txname)
|
||||||
if not widget_rx:
|
if not widget_rx:
|
||||||
widget_rx = bumblebee.output.Widget(name=rxname)
|
widget_rx = bumblebee.output.Widget(name=rxname)
|
||||||
|
widget_rx.set("theme-minwidth", "down 1000MB")
|
||||||
|
widget_rx.set("theme-align", "right")
|
||||||
widgets.append(widget_rx)
|
widgets.append(widget_rx)
|
||||||
if not widget_tx:
|
if not widget_tx:
|
||||||
widget_tx = bumblebee.output.Widget(name=txname)
|
widget_tx = bumblebee.output.Widget(name=txname)
|
||||||
|
widget_tx.set("theme-minwidth", "down 1000MB")
|
||||||
|
widget_tx.set("theme-align", "right")
|
||||||
widgets.append(widget_tx)
|
widgets.append(widget_tx)
|
||||||
|
|
||||||
prev_rx = widget_rx.get("rx", 0)
|
prev_rx = widget_rx.get("rx", 0)
|
||||||
|
|
|
@ -64,7 +64,7 @@
|
||||||
"prefix": "sensors"
|
"prefix": "sensors"
|
||||||
},
|
},
|
||||||
"traffic": {
|
"traffic": {
|
||||||
"rx": { "prefix": "down"},
|
"rx": { "suffix": "down"},
|
||||||
"tx": {"prefix": "up"}
|
"tx": {"suffix": "up"}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,7 +80,7 @@
|
||||||
"prefix": "🌡"
|
"prefix": "🌡"
|
||||||
},
|
},
|
||||||
"traffic":{
|
"traffic":{
|
||||||
"rx": { "prefix": "" },
|
"rx": { "suffix": "" },
|
||||||
"tx": { "prefix": "" }
|
"tx": { "suffix": "" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue