bspc_rust_lib
The goal of this library is to offer a nice way to use as many bspc feature as possible through rust. This is a project I do because I use bspwm and want to practice rust. If you have something to contribute or discover an issue, please use the github-repo to contact me.
In general: The man pages for bspc are a bit lackluster and I couldn't find really good explainations some things. For example, I don't fully understand how the order in which constraints for nodes/desktops/monitors are set in queries affects the result, only that it does. So again, if I did something dumb and you notice, please let me know.
Examples
Subscription Example
use ;
This program runs the callback callback
each time a node gets added and passes the string "added node" to it.
callback
:
- Queries and prints the previously focused node.
- Prints the last element of the payload (the id of the newly added node).
- Prints the argument additionally passed to it ("node added").
This program also runs the callback callback2
each time a new desktop gets focused for a total of 3 times and passes the i32
73
to it.
callback2
:
- Prints the complete payload of the
desktop_focus
event ("man bspc" sectionEvents
-> [<monitor_id>, <desktop_id>]). - Prints the argument additionally passed to it (
73
).
Node Query Example
let windows = Nodes.get_response;
println!;
}
This snippet:
- Queries all nodes that are windows and are on the currently focused desktop.
- Gets the x-
window_class_names
for all queried nodes and prints them.
The same result is achievable by using the provided utility functions:
let focused_desktop = get_focused_desktop;
let windows = get_windows;
println!;