Real time utility that tracks every workspace currently in use in Hyprland filtered by monitor output, example:
{
"workspaces": {
"HDMI-3": [
2,
],
"DP-1": [
1,
],
},
"focused": [
"DP-1",
1,
],
"socket_path": "[...]/.socket2.sock",
}The script relies on tokio for handling asynchronous calls to the UNIX socket provided by Hyprland and serde_json for handling JSON encoded output from hyprctl.
On execution, the script fetches the current workspaces (filtered by monitor) as long with the focused monitor+workspace pair with the hyprctl commands:
# For workspace list
hyprctl workspaces -j # -j arg for JSON output
# For currently focused workspace
hyprctl activeworkspace -jAdapted for script execution in Rust (using std::process::{Command, Output} structs):
// For workspace list
let output: Output = Command::new("hyprctl")
.arg("workspaces")
.arg("-j")
.output()
.expect("Failed to execute command");
// Same concept for currently focused workspace
// ...The script then proceeds to listen for event calls on the UNIX socket such as:
createworkspaceworkspacedestroyworkspacefocusedmon
Keep in mind than no
v2is considered
This project aims to provide a lightweight solution to handle live workspaces information for a taskbar (Wayland, Hyprland).