Crate redblocks[][src]

Expand description

About

Redblocks is a library inspired by dwmblocks for creating your own status blocks that writes to XROOTNAME?. Primaraly intended for along side the Penrose library.

Dependencies

  • xsetroot

Usage Requirments

Using redblock is intended to be simple, baring creating custom modules; if this is not the case I would consider that a bug and would engorage you to raise the issue as such.

The one caviate to the aformentioned principle is a basic understanding of rust is required to setup and configure your statusbar. You can paruse the reference for any concepts you don’t understand (baring anyghing specific to redblocks). For a more compleate introduction to the language I would encorage you to check out The Book. a great place to start learing is here; if you need help installing Rust please see the installation guide.

Setup

To use redblocks add the following to your Cargo.toml.

[dependencies]
redblocks = 0.2.0

Using Redblocks

Redblocks works on the principle of Widgets and Plugins. Widgets handles displaying the Plugin and timeing information. Plugins handle the actual data you watnt to display as how that information should be updated. Currently the following plugins are avalible, please see their respecive module for more information:

  • cpu
  • memory usage
  • time display

Example

#[macro_use]
extern crate redblocks;

use redblocks::{Widget, plugins::{TimePlugin, MemPlugin, CpuPlugin}};

fn main() {
    let time = Widget::new(TimePlugin::new("%A %D %_I:%M:%S %P"), 1);
   
    let cpu = Widget::new_mili(CpuPlugin::new(), 750);
    
    let mem = Widget::new(MemPlugin::new(), 2);

    let plugins = vec![mem, cpu, time];

    start_bar!(plugins);
}

Wishlist

  • internel xset root function

Modules

Library provided plugins

Macros

Constructs the StatusBar type as well as setting up the main event loop

Structs

Holds StatusBar

Handles timing and calling updates for plugins

Traits

Refreshes the widget plugin.

Type Definitions

Vec<Widget>