|
|
@ -23,6 +23,8 @@ use std::cell::RefCell; |
|
|
|
use std::collections::HashSet; |
|
|
|
use std::collections::HashSet; |
|
|
|
use swaybar_types as s; |
|
|
|
use swaybar_types as s; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const NAME: &str = "battery"; |
|
|
|
|
|
|
|
|
|
|
|
pub struct BarModuleBattery { |
|
|
|
pub struct BarModuleBattery { |
|
|
|
config: config::ModuleConfig, |
|
|
|
config: config::ModuleConfig, |
|
|
|
manager: RefCell<bat::Manager>, |
|
|
|
manager: RefCell<bat::Manager>, |
|
|
@ -110,11 +112,11 @@ impl BarModuleFn for BarModuleBattery { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fn name() -> &'static str { |
|
|
|
fn name() -> &'static str { |
|
|
|
"battery" |
|
|
|
NAME |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fn instance(&self) -> &str { |
|
|
|
fn matches(&self, name: &str, instance: &str) -> bool { |
|
|
|
&self.config.instance |
|
|
|
NAME == name && self.config.instance == instance |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fn build(&self) -> s::Block { |
|
|
|
fn build(&self) -> s::Block { |
|
|
|