gdritter repos knurling / 81f6f45
Add a vertical bar widget Getty Ritter 4 years ago
2 changed file(s) with 12 addition(s) and 0 deletion(s). Collapse all Expand all
5757 match section["name"].as_str().ok_or(format_err!(""))? {
5858 "box" => target.push(Box::new(w::SmallBox)),
5959 "battery" => target.push(Box::new(w::Battery::new()?)),
60 "caesura" => target.push(Box::new(w::Caesura)),
6061 "sep" => target = &mut conf.right,
6162 "stdin" => target.push(Box::new(w::Stdin::new())),
6263 "time" => target.push(Box::new(w::Time::new())),
6364 _ => (),
6465 }
6566 }
67
6668 if let Some(color) = table.get("background") {
6769 conf.bg_color = color_from_hex(color.as_str().ok_or(format_err!("`background` not a str"))?)?;
6870 }
9292 }
9393 }
9494
95 pub struct Caesura;
9596
97 impl Widget for Caesura {
98 fn draw(&self, d: &Drawing, loc: Located) -> i32 {
99 let x = loc.target_x(d, 1);
100 d.ctx.move_to(x, d.buffer);
101 d.ctx.line_to(x, d.size.ht as f64 - d.buffer);
102 d.ctx.stroke();
103 2
104 }
105 }
96106
97107 pub struct Battery {
98108 file_list: Vec<std::path::PathBuf>,