pub struct Battery { /* private fields */ }
Expand description
Shows the current battery level.
Trait Implementations§
Source§impl PanelConfig for Battery
impl PanelConfig for Battery
Source§fn parse(
name: &'static str,
table: &mut HashMap<String, Value>,
_global: &Config,
) -> Result<Self>
fn parse( name: &'static str, table: &mut HashMap<String, Value>, _global: &Config, ) -> Result<Self>
Parses an instance of the panel from the global Config
Configuration options:
battery
: specify which battery to monitor- type: String
- default: “BAT0”
adapter
: specify which adapter to monitor- default: “AC”
- currently unused
full_at
: specify the minimum percentage to useformat_full
. If set, ignores thestatus
file when the battery percentage is above the provided value.- type: u64
interval
: how often (in seconds) to poll for new values- type: u64
- default: 10
format_charging
: format string when the battery is charging- type: String
- formatting options:
%percentage%
- default: “CHG: %percentage%%”
format_discharging
: format string when the battery is discharging- type: String
- formatting options:
%percentage%
- default: “DSCHG: %percentage%%”
format_not_charging
: format string when the battery is not charging- type: String
- formatting options:
%percentage%
- default: “NCHG: %percentage%%”
format_full
: format string when the battery is full- type: String
- formatting options:
%percentage%
- default: “FULL: %percentage%%”
format_unknown
: format string when the battery is unknown- type: String
- formatting options:
%percentage%
- default: “%percentage%%”
attrs
: A string specifying the attrs for the panel. SeeAttrs::parse
for details.highlight
: A string specifying the highlight for the panel. SeeHighlight::parse
for details.ramp
: A string specifying the ramp to show battery level. SeeRamp::parse
for details.- See
PanelCommon::parse_common
.
Source§fn props(&self) -> (&'static str, bool)
fn props(&self) -> (&'static str, bool)
Returns the name of the panel. If the panel supports events, each
instance must return a unique name.
Source§fn run<'async_trait>(
self: Box<Self>,
cr: Rc<Context>,
global_attrs: Attrs,
height: i32,
) -> Pin<Box<dyn Future<Output = PanelRunResult> + 'async_trait>>where
Self: 'async_trait,
fn run<'async_trait>(
self: Box<Self>,
cr: Rc<Context>,
global_attrs: Attrs,
height: i32,
) -> Pin<Box<dyn Future<Output = PanelRunResult> + 'async_trait>>where
Self: 'async_trait,
Performs any necessary setup, then returns a
PanelStream
representing the provided PanelConfig
. Read moreAuto Trait Implementations§
impl Freeze for Battery
impl !RefUnwindSafe for Battery
impl !Send for Battery
impl !Sync for Battery
impl Unpin for Battery
impl !UnwindSafe for Battery
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more