Crate bspc_rs

Source
Expand description

This library provides an implementation of bspc in rust programming language.

§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);
                }
                _ => {}
            },
            _ => {}
        }
    }
}

Modules§

errors
Contains errors, that are used in this crate.
events
properties
query
selectors
This module implements selectors for Node, Desktop and Monitor.
settings
This module is dedicated to various settings of bspwm. Its functions are equivalent to those, which are run by bspc config <setting> command in your shell.
tree

Type Aliases§

Id