Home

Awesome

bspc-rs

CI crate docs

This library provides an implementation of bspc in rust programming language. Feel free to open any issue or ask any questions.

Example

use bspc_rs::events::{self, Subscription, Event, NodeEvent};

fn main() {
    let subscriptions = vec![
        Subscription::NodeAdd,
        Subscription::NodeFocus,
        Subscription::NodeFlag,
        Subscription::NodeState,
        Subscription::NodeRemove,
    ];

    let mut subscriber = events::subscribe(false, None, &subscriptions).unwrap();

    for event in subscriber.events() {
        match event.unwrap() {
            Event::NodeEvent(event) => match event {
                NodeEvent::NodeFocus(node_info) => {
                    println!("Window with id {} is focused!", node_info.node_id);
                }
                NodeEvent::NodeRemove(node_info) => {
                    println!("Window with id {} was removed!", node_info.node_id);
                }
                _ => {}
            },
            _ => {}
        }
    }
}

Why choose bspc-rs?

More examples

This library was started as a desire to have a native bspc support in Rust in ixwindow project.

Some small useful scripts/utilities, that I use daily, written with the help of this library, (basically ported from bash version) can be found in examples directory.