[−][src]Trait i3status_rs::blocks::Block
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.
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.