pub struct Hyprland { /* private fields */ }Expand description
Connection details for a running Hyprland instance.
Implementations§
Source§impl Hyprland
impl Hyprland
Sourcepub fn connect() -> Option<Self>
pub fn connect() -> Option<Self>
Locate the running instance’s sockets from the environment. Returns
None when not under Hyprland, or when the sockets are not present.
Sourcepub fn active_workspace(&self) -> Option<String>
pub fn active_workspace(&self) -> Option<String>
The name of the workspace currently on the focused monitor.
Sourcepub fn workspace_names(&self) -> Vec<String>
pub fn workspace_names(&self) -> Vec<String>
Existing workspace names, ordered by numeric id (so “previous”/“next” follow the compositor’s ordering, not creation order).
Sourcepub fn dispatch_workspace(&self, name: &str)
pub fn dispatch_workspace(&self, name: &str)
Ask the compositor to switch to name.
The portable form is dispatch workspace <name>, but a Lua-configured
Hyprland (Omarchy) routes dispatch through hl.dispatch and rejects
it; there the hl.dsp.focus dispatcher is required. Try the portable
form first and fall back when the compositor reports an error.
Sourcepub fn spawn_watcher(&self, on_change: impl Fn(String) + Send + 'static)
pub fn spawn_watcher(&self, on_change: impl Fn(String) + Send + 'static)
Spawn a thread that calls on_change with the newly focused workspace’s
name whenever it changes. The thread exits when the socket closes (e.g.
the compositor restarts).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Hyprland
impl RefUnwindSafe for Hyprland
impl Send for Hyprland
impl Sync for Hyprland
impl Unpin for Hyprland
impl UnsafeUnpin for Hyprland
impl UnwindSafe for Hyprland
Blanket Implementations§
Source§impl<C> AsyncPosition<()> for C
impl<C> AsyncPosition<()> for C
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more