Rust Blocks
A lightweight implementation for an i3 status bar written in Rust.
See the i3bar protocol for details on the protocol.
Installation
- Get Rust
- Clone this repo (optional)
- Run
cargo install --path <repo path>
(if you did step 2) orcargo install rs-blocks
- Use
rs-blocks
!
Configuration
rs-blocks
will look for $XDG_CONFIG_HOME/rs-blocks/config
for a config file.
Alternatively, a config file can be specified by using the argument --config
.
Config files should be in toml format. The section title must match an available block type, and the remaining config within each section will be used to configure that block.
Multiple entries of the same block can be given as long as they specify different
name
s. E.g.:
[time]
name = "time1"
format = "%D"
[time]
name = "time2"
format = "%S"
Blocks will appear in the order they are given in the config file.
Available blocks are:
- Battery
- Brightness (using
brightnessctl
) - CPU
- Memory
- Network
- Time
- Volume (using
amixer
)
Implementation
Blocks are represented by infinite loops in threads sending a (name, text)
structs
through a channel, received on the main thread. The trait Configure
should be
implemented for setting up a block (a toml string is passed as the config argument)
and the Sender
trait should be implemented for creating a message sending
function (see these traits for details).