summaryrefslogtreecommitdiffstats
path: root/src/configs/battery.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/configs/battery.rs')
-rw-r--r--src/configs/battery.rs52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/configs/battery.rs b/src/configs/battery.rs
new file mode 100644
index 000000000..e60b95e2f
--- /dev/null
+++ b/src/configs/battery.rs
@@ -0,0 +1,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,
+}