[][src]Struct cnx::widgets::Volume

pub struct Volume { /* fields omitted */ }

Shows the current volume of the default ALSA output.

This widget shows the current volume of the default ALSA output, or 'M' if the output is muted.

The widget uses alsa-lib to receive events when the volume changes, avoiding expensive polling. If you do not have alsa-lib installed, you can disable the volume-widget feature on the cnx crate to avoid compiling this widget.

Methods

impl Volume[src]

pub fn new(cnx: &Cnx, attr: Attributes) -> Volume[src]

Creates a new Volume widget.

Creates a new Volume widget, whose text will be displayed with the given Attributes.

The Cnx instance is borrowed during construction in order to get access to handles of its event loop. However, it is not borrowed for the lifetime of the widget. See the cnx_add_widget!() for more discussion about the lifetime of the borrow.

Examples

let attr = Attributes {
    font: Font::new("SourceCodePro 21"),
    fg_color: Color::white(),
    bg_color: None,
    padding: Padding::new(8.0, 8.0, 0.0, 0.0),
};

let mut cnx = Cnx::new(Position::Top)?;
cnx_add_widget!(cnx, Volume::new(&cnx, attr.clone()));

Trait Implementations

impl Widget for Volume[src]

Auto Trait Implementations

impl !Send for Volume

impl !Sync for Volume

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Erased for T