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
impl HyprCycle
pub fn parse_args() -> Args
Sourcepub fn new(connection: Box<dyn HyprlandClient>) -> HyprCycle
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.
Sourcepub fn real() -> Result<HyprCycle>
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.
Sourcepub fn get_focused_monitor(&self) -> Result<OwnedMonitor>
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.
Sourcepub fn get_workspaces_for_monitor(
&self,
monitor: &OwnedMonitor,
) -> Result<Vec<OwnedWorkspace>>
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.
Sourcepub fn get_current_workspace(&self) -> Result<OwnedWorkspace>
pub fn get_current_workspace(&self) -> Result<OwnedWorkspace>
Returns the workspace that’s active on the monitor that’s in focus
Sourcepub fn get_target_workspace(
&self,
direction: Direction,
) -> Result<OwnedWorkspace>
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.