[][src]Trait i3status_rs::blocks::Block

pub trait Block {
    fn id(&self) -> usize;
fn view(&self) -> Vec<&dyn I3BarWidget>; fn update(&mut self) -> Result<Option<Update>, Error> { ... }
fn signal(&mut self, _signal: i32) -> Result<(), Error> { ... }
fn click(&mut self, _event: &I3BarEvent) -> Result<(), Error> { ... } }

The Block trait is used to interact with a block after it has been instantiated from ConfigBlock

Required methods

fn id(&self) -> usize[src]

A unique id for the block (asigend by the constructor).

fn view(&self) -> Vec<&dyn I3BarWidget>[src]

Use this function to return the widgets that comprise the UI of your component.

The music block may, for example, be comprised of a text widget and multiple buttons (buttons are also TextWidgets). Use a vec to wrap the references to your view.

Loading content...

Provided methods

fn update(&mut self) -> Result<Option<Update>, Error>[src]

Required if you don't want a static block.

Use this function to update the internal state of your block, for example during periodic updates. Return the duration until your block wants to be updated next. For example, a clock could request only to be updated every 60 seconds by returning Some(Update::Every(Duration::new(60, 0))) every time. If you return None, this function will not be called again automatically.

fn signal(&mut self, _signal: i32) -> Result<(), Error>[src]

Sends a signal event with the provided signal, this function is called on every block for every signal event

fn click(&mut self, _event: &I3BarEvent) -> Result<(), Error>[src]

Sends click events to the block.

Here you can react to the user clicking your block. The I3BarEvent instance contains all fields to describe the click action, including mouse button and location down to the pixel. You may also update the internal state here.

If block uses more that one widget, use the event.instance property to determine which widget was clicked.

Loading content...

Implementors

impl Block for Apt[src]

impl Block for Backlight[src]

impl Block for Battery[src]

impl Block for Bluetooth[src]

impl Block for Cpu[src]

impl Block for Custom[src]

impl Block for CustomDBus[src]

impl Block for DiskSpace[src]

impl Block for Docker[src]

impl Block for FocusedWindow[src]

impl Block for Github[src]

impl Block for Hueshift[src]

impl Block for IBus[src]

impl Block for KDEConnect[src]

impl Block for KeyboardLayout[src]

impl Block for Load[src]

impl Block for Memory[src]

impl Block for Music[src]

impl Block for Net[src]

impl Block for NetworkManager[src]

impl Block for Notify[src]

impl Block for NvidiaGpu[src]

impl Block for Pacman[src]

impl Block for Pomodoro[src]

impl Block for Sound[src]

impl Block for SpeedTest[src]

impl Block for Taskwarrior[src]

impl Block for Temperature[src]

impl Block for Template[src]

impl Block for Time[src]

impl Block for Toggle[src]

impl Block for Uptime[src]

impl Block for Watson[src]

impl Block for Weather[src]

impl Block for Xrandr[src]

impl<T: Block> Block for BaseBlock<T>[src]

Loading content...