pub struct Hyprland { /* private fields */ }Expand description
The Hyprland service, from cx.hyprland(). A clone is cheap and
shares the one connection.
Implementations§
Source§impl Hyprland
impl Hyprland
Sourcepub fn focus_workspace(&self, target: &str)
pub fn focus_workspace(&self, target: &str)
Switches to the workspace target, as Hyprland names it: a number
such as 2, or name:web. Hyprland reads a dispatch as Lua when its
config is Lua, as hyprland.lua can be from 0.55 on and always is
from 0.57 on, and as workspace 2 otherwise. So the first call asks
Hyprland’s status, and switches wait for its answer. Under Lua
target goes as a quoted Lua string, so no name runs as code; in the
old syntax it goes as it is, so a target with whitespace or a control
character is logged and not sent. Hyprland’s refusal is logged.
Sourcepub fn dispatch(&self, command: &str)
pub fn dispatch(&self, command: &str)
Sends Hyprland dispatch command, as hyprctl dispatch does, on a
connection of its own, and never waits for it. Hyprland’s refusal is
logged, and so is a command over 8 KiB, which isn’t sent.
When Hyprland’s config is Lua, as hyprland.lua can be from 0.55 on
and always is from 0.57 on, command is a Lua expression that
Hyprland runs inside the compositor, such as
hl.dsp.focus({ workspace = "2" }). Otherwise it is a dispatcher and
its arguments, such as workspace 2. Either way, never put outside
text, such as a window’s title or class or a workspace’s name, into
it: under Lua what it says would run. Switch workspaces with
focus_workspace, which quotes them.
Sourcepub fn on_event(&self, handler: impl Fn(&HyprlandEvent) + 'static)
pub fn on_event(&self, handler: impl Fn(&HyprlandEvent) + 'static)
Calls handler with every event Hyprland sends, as Quickshell’s
rawEvent, until the context cx.hyprland() was called on goes.
The lists follow once Hyprland answers the reads an event starts,
after handler runs.
It runs on the main thread. If it panics, that is logged with the
event and where on_event was called, and it isn’t called again.
Called on a handle whose context went, it logs that and does nothing.
Sourcepub fn workspaces(&self) -> ReadSignal<Vec<HyprlandWorkspace>>
pub fn workspaces(&self) -> ReadSignal<Vec<HyprlandWorkspace>>
Every workspace, numbered ones by number after the named ones. Empty while Hyprland isn’t connected.
Sourcepub fn monitors(&self) -> ReadSignal<Vec<HyprlandMonitor>>
pub fn monitors(&self) -> ReadSignal<Vec<HyprlandMonitor>>
Every monitor, in Hyprland’s order.
Sourcepub fn toplevels(&self) -> ReadSignal<Vec<HyprlandToplevel>>
pub fn toplevels(&self) -> ReadSignal<Vec<HyprlandToplevel>>
Every mapped window, in Hyprland’s order.