Skip to main content

HyprCycle

Struct HyprCycle 

Source
pub struct HyprCycle { /* private fields */ }
Expand description

Represents the total functionality of the program. It can inspect the connected monitors, the extant workspaces, and can switch between workspaces.

Implementations§

Source§

impl HyprCycle

Source

pub fn parse_args() -> Args

Source

pub fn new(connection: Box<dyn HyprlandClient>) -> HyprCycle

The connection can be real or a mock object, as seen in the tests in src/service.rs.

Source

pub fn real() -> Result<HyprCycle>

This function builds a version of the service backed by a real HyprlandConnection. It’s just for convenience to keep main() clean.

Source

pub fn get_focused_monitor(&self) -> Result<OwnedMonitor>

In Hyprland, only one monitor can be in focus at a time. This function returns that monitor.

Source

pub fn get_workspaces_for_monitor( &self, monitor: &OwnedMonitor, ) -> Result<Vec<OwnedWorkspace>>

Returns a sorted list of the workspaces bound to the provided monitor. Throws an error if the provided monitor doesn’t have any workspaces bound to it.

Source

pub fn get_current_workspace(&self) -> Result<OwnedWorkspace>

Returns the workspace that’s active on the monitor that’s in focus

Source

pub fn get_target_workspace( &self, direction: Direction, ) -> Result<OwnedWorkspace>

The index of the sorted list of workspaces tells us where to target the upcoming workspace switch.

Source

pub fn switch_to_workspace(&self, target: &OwnedWorkspace) -> Result<()>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.