diff --git a/docs/config/README.md b/docs/config/README.md index c5215067..02381655 100644 --- a/docs/config/README.md +++ b/docs/config/README.md @@ -316,26 +316,17 @@ The module is only visible when the device's battery is below 10%. ### Options -| Option | Default | Description | -| -------------------- | --------------------------------- | ------------------------------------------------- | -| `full_symbol` | `"•"` | The symbol shown when the battery is full. | -| `charging_symbol` | `"⇡"` | The symbol shown when the battery is charging. | -| `discharging_symbol` | `"⇣"` | The symbol shown when the battery is discharging. | -| `format` | `"[$symbol$percentage]($style) "` | The format for the module. | -| `display` | [link](#battery-display) | Display threshold and style for the module. | -| `disabled` | `false` | Disables the `battery` module. | +| Option | Default | Description | +| -------------------- | --------------------------------- | --------------------------------------------------- | +| `full_symbol` | `""` | The symbol shown when the battery is full. | +| `charging_symbol` | `""` | The symbol shown when the battery is charging. | +| `discharging_symbol` | `""` | The symbol shown when the battery is discharging. | +| `unknown_symbol` | `""` | The symbol shown when the battery state is unknown. | +| `empty_symbol` | `""` | The symbol shown when the battery state is empty. | +| `format` | `"[$symbol$percentage]($style) "` | The format for the module. | +| `display` | [link](#battery-display) | Display threshold and style for the module. | +| `disabled` | `false` | Disables the `battery` module. | -
-There are also options for some uncommon battery states. - -| Variable | Description | -| ---------------- | --------------------------------------------------- | -| `unknown_symbol` | The symbol shown when the battery state is unknown. | -| `empty_symbol` | The symbol shown when the battery state is empty. | - -Note: Battery indicator will be hidden if the status is `unknown` or `empty` unless you specify the option in the config. - -
### Example diff --git a/docs/presets/README.md b/docs/presets/README.md index e07d717e..58f2b942 100644 --- a/docs/presets/README.md +++ b/docs/presets/README.md @@ -20,11 +20,6 @@ If emojis aren't your thing, this might catch your eye! [aws] symbol = " " -[battery] -full_symbol = "" -charging_symbol = "" -discharging_symbol = "" - [conda] symbol = " " diff --git a/src/configs/battery.rs b/src/configs/battery.rs index ec728770..4349a25c 100644 --- a/src/configs/battery.rs +++ b/src/configs/battery.rs @@ -7,8 +7,8 @@ pub struct BatteryConfig<'a> { pub full_symbol: &'a str, pub charging_symbol: &'a str, pub discharging_symbol: &'a str, - pub unknown_symbol: Option<&'a str>, - pub empty_symbol: Option<&'a str>, + pub unknown_symbol: &'a str, + pub empty_symbol: &'a str, pub display: Vec>, pub disabled: bool, pub format: &'a str, @@ -17,11 +17,11 @@ pub struct BatteryConfig<'a> { impl<'a> RootModuleConfig<'a> for BatteryConfig<'a> { fn new() -> Self { BatteryConfig { - full_symbol: "•", - charging_symbol: "↑", - discharging_symbol: "↓", - unknown_symbol: None, - empty_symbol: None, + full_symbol: "", + charging_symbol: "", + discharging_symbol: "", + unknown_symbol: "", + empty_symbol: "", format: "[$symbol$percentage]($style) ", display: vec![BatteryDisplayConfig { threshold: 10, diff --git a/src/modules/battery.rs b/src/modules/battery.rs index 2b773bf2..3f53573a 100644 --- a/src/modules/battery.rs +++ b/src/modules/battery.rs @@ -35,8 +35,8 @@ pub fn module<'a>(context: &'a Context) -> Option> { battery::State::Full => Some(config.full_symbol), battery::State::Charging => Some(config.charging_symbol), battery::State::Discharging => Some(config.discharging_symbol), - battery::State::Unknown => config.unknown_symbol, - battery::State::Empty => config.empty_symbol, + battery::State::Unknown => Some(config.unknown_symbol), + battery::State::Empty => Some(config.empty_symbol), _ => { log::debug!("Unhandled battery state `{}`", state); None @@ -85,7 +85,12 @@ fn get_battery_status() -> Option { }) } Err(e) => { - log::warn!("Unable to access battery information:\n{}", &e); + let level = if cfg!(target_os = "linux") { + log::Level::Info + } else { + log::Level::Warn + }; + log::log!(level, "Unable to access battery information:\n{}", &e); None } })