Crates.io | bspc-rs |
lib.rs | bspc-rs |
version | 0.1.1 |
source | src |
created_at | 2023-03-18 22:15:55.230999 |
updated_at | 2023-03-30 19:08:29.488501 |
description | Implementation of bspc in Rust |
homepage | https://github.com/andreykaere/bspc-rs |
repository | https://github.com/andreykaere/bspc-rs |
max_upload_size | |
id | 814016 |
size | 83,519 |
This library provides an implementation of
bspc
in rust programming language.
Feel free to open any issue or ask any questions.
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);
}
_ => {}
},
_ => {}
}
}
}
bspc-rs
?Speed. If your script is dealing with the windows and you want to improve
the speed, than Rust and bspc-rs
might be a good choice for you.
Static types and compilation. This is another reason to choose bspc-rs
,
because you might catch some errors at compile-time. This is especially true
for big scripts, when mistake of making silly mistake is more high.
Native integration in Rust code. For example, if you need to do something,
besides just dealing with bspwm
, than you can take advantage of other Rust
libraries for your needs, that are not extracted into binary programs and
therefore can't be used in bash scripts.
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.