hyprland workspace, service

This commit is contained in:
2026-09-13 18:15:22 +01:00
parent 57201bc0ff
commit a14b6f4967
12 changed files with 551 additions and 7 deletions
+2
View File
@@ -15,6 +15,7 @@ pub struct BarbarConfig {
pub enum Modules {
Clock,
Weather,
Workspaces,
}
impl Modules {
@@ -22,6 +23,7 @@ impl Modules {
match self {
Modules::Clock => "clock",
Modules::Weather => "weather",
Modules::Workspaces => "workspaces",
}
}
}
@@ -0,0 +1,33 @@
//! Hyprland compositor messages.
use crate::Service;
/// Route key a module subscribes under to receive compositor events. One
/// stream carries every event; the [`HyprlandEvent`] payload tags which one,
/// so modules filter on it.
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
pub enum HyprlandMsg {
Events,
}
impl HyprlandMsg {
/// Route key a module subscribes under to receive this service's events.
pub fn key(self) -> Service {
Service("hyprland.events")
}
}
/// A hyprland compositor event, published to subscribers of the events key.
#[derive(Clone, PartialEq, Eq, Debug)]
pub enum HyprlandEvent {
/// Focused workspace changed.
WorkspaceChanged { id: i32, name: String },
/// A workspace was created.
WorkspaceAdded { id: i32, name: String },
/// A workspace was destroyed.
WorkspaceRemoved { id: i32, name: String },
/// Focused window changed; empty class/title mean no window is focused.
ActiveWindow { class: String, title: String },
/// Focused monitor changed.
Monitor { name: String },
}
@@ -1,7 +1,9 @@
//! Messages owned by services.
mod datetime;
mod hyprland;
mod weather;
pub use datetime::*;
pub use hyprland::*;
pub use weather::*;