1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
use crate::config::{ModuleConfig, RootModuleConfig, SegmentConfig};
use ansi_term::{Color, Style};
use starship_module_config_derive::ModuleConfig;
#[derive(Clone, ModuleConfig)]
pub struct BatteryConfig<'a> {
pub full_symbol: SegmentConfig<'a>,
pub charging_symbol: SegmentConfig<'a>,
pub discharging_symbol: SegmentConfig<'a>,
pub unknown_symbol: Option<SegmentConfig<'a>>,
pub empty_symbol: Option<SegmentConfig<'a>>,
pub display: Vec<BatteryDisplayConfig>,
pub disabled: bool,
pub percentage: SegmentConfig<'a>,
}
impl<'a> RootModuleConfig<'a> for BatteryConfig<'a> {
fn new() -> Self {
BatteryConfig {
full_symbol: SegmentConfig {
value: "•",
style: None,
},
charging_symbol: SegmentConfig {
value: "↑",
style: None,
},
discharging_symbol: SegmentConfig {
value: "↓",
style: None,
},
unknown_symbol: None,
empty_symbol: None,
display: vec![BatteryDisplayConfig {
threshold: 10,
style: Color::Red.bold(),
}],
disabled: false,
percentage: SegmentConfig {
value: "",
style: None,
},
}
}
}
#[derive(Clone, ModuleConfig)]
pub struct BatteryDisplayConfig {
pub threshold: i64,
pub style: Style,
}
|