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 pligins; 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.4

Using Redblocks

Redblocks works on the principle of Widgets and Plugins. Widgets hold the Plugins and handles timeing information. Plugins handle the actual data you watnt to display as well as how that information should be updated. If you wish to display two or more plugins in the same widget you can use a Bridge with SubWidgets. Currently the following plugins are avalible, please see their respective documentation for more information:

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); // formats to "Saturday 06/26/2021 3:41:48 pm"

    let cpu = Widget::new_mili(CpuPlugin::new(), 750);

    let mem = Widget::new(MemPlugin::new(), 2);

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

    start_bar!(plugins);
}

Goals

  • internel xset root function
  • Penrose integration
  • More Plugins

Modules

Library provided plugins

Macros

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

Structs

Holds StatusBar

Allows for two or more plugins to be displayed side by side with no seperator; SubWidgets share the same timer

A Widget without any timeing control, only for use within a Bridge

Handles timing and calling updates for plugins

Traits

Refreshes the widget plugin.

Type Definitions

Vec<Widget>