fix battery widget
This commit is contained in:
@@ -164,7 +164,7 @@ where
|
||||
canvas.fg_color = color_parse(&normal_fg_color).unwrap_or(FALLBACK_COLOR);
|
||||
|
||||
for i in 0..num_devices {
|
||||
let label = canvas.label(
|
||||
let label = canvas.label_centered(
|
||||
button_x + 2.,
|
||||
button_y + 2.,
|
||||
button_w - 4.,
|
||||
@@ -322,7 +322,7 @@ fn battery_update(control: &mut Control<(), ElemState>, _: &mut (), app: &mut Ap
|
||||
let text = match device {
|
||||
Some(d) => d
|
||||
.soc
|
||||
.map(|soc| format!("{}{}", tags[d.role as usize], soc as u32))
|
||||
.map(|soc| format!("{}{}", tags[d.role as usize], (soc * 100.) as u32))
|
||||
.unwrap_or_else(|| "".into()),
|
||||
None => "".into(),
|
||||
};
|
||||
|
||||
@@ -96,17 +96,18 @@ watch_elements:
|
||||
text: "Chicago" # change TZ2 label here
|
||||
|
||||
- type: Batteries
|
||||
rect: [0, 20, 400, 40]
|
||||
rect: [0, 0, 400, 40]
|
||||
font_size: 14
|
||||
num_devices: 9
|
||||
low_threshold: 15
|
||||
normal_fg_color: "#406040"
|
||||
layout: Horizontal
|
||||
normal_fg_color: "#99BBAA"
|
||||
# below is not yet implemented
|
||||
normal_bg_color: "#353535"
|
||||
low_fg_color: "#604040"
|
||||
low_bg_color: "#353535"
|
||||
charging_fg_color: "#204070"
|
||||
charging_bg_color: "#353535"
|
||||
layout: Horizontal
|
||||
|
||||
# sample
|
||||
# - type: ExecLabel
|
||||
|
||||
Reference in New Issue
Block a user