hyprland workspace, service
This commit is contained in:
@@ -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::*;
|
||||
|
||||
Reference in New Issue
Block a user