pub struct SwayIpcClient { /* private fields */ }Expand description
Sway IPC client for communicating with sway.
Implementations§
Source§impl SwayIpcClient
impl SwayIpcClient
Sourcepub fn new() -> Result<Self>
pub fn new() -> Result<Self>
Create a new sway IPC client. Uses the SWAYSOCK environment variable to find the socket.
Sourcepub fn subscribe(&self, events: &[&str]) -> Result<EventStream>
pub fn subscribe(&self, events: &[&str]) -> Result<EventStream>
Subscribe to sway events. Returns an EventStream that yields events. Events: “workspace”, “output”, “mode”, “window”, “barconfig_update”, “binding”, “shutdown”, “tick”
Sourcepub fn run_command(&self, command: &str) -> Result<Vec<CommandResult>>
pub fn run_command(&self, command: &str) -> Result<Vec<CommandResult>>
Send a command to sway and get the result.
Sourcepub fn get_workspaces(&self) -> Result<Vec<SwayWorkspace>>
pub fn get_workspaces(&self) -> Result<Vec<SwayWorkspace>>
Get all workspaces.
Sourcepub fn get_outputs(&self) -> Result<Vec<SwayOutput>>
pub fn get_outputs(&self) -> Result<Vec<SwayOutput>>
Get all outputs.
Sourcepub fn get_focused_workspace(&self) -> Result<SwayWorkspace>
pub fn get_focused_workspace(&self) -> Result<SwayWorkspace>
Get the focused workspace.
Sourcepub fn is_focused_workspace_empty(&self) -> Result<bool>
pub fn is_focused_workspace_empty(&self) -> Result<bool>
Check if the focused workspace is empty (no windows/containers).
Sourcepub fn rename_workspace(&self, old_name: &str, new_name: &str) -> Result<()>
pub fn rename_workspace(&self, old_name: &str, new_name: &str) -> Result<()>
Rename a workspace.
Sourcepub fn get_tree(&self) -> Result<Vec<u8>>
pub fn get_tree(&self) -> Result<Vec<u8>>
Get the sway tree (for introspecting containers, windows, etc.)
Sourcepub fn get_workspace_names(&self) -> Result<Vec<String>>
pub fn get_workspace_names(&self) -> Result<Vec<String>>
Get current workspace names.
Sourcepub fn get_primary_output(&self) -> Result<String>
pub fn get_primary_output(&self) -> Result<String>
Get the primary output (output of the currently focused workspace). Falls back to the first available output.
Trait Implementations§
Source§impl Clone for SwayIpcClient
impl Clone for SwayIpcClient
Source§fn clone(&self) -> SwayIpcClient
fn clone(&self) -> SwayIpcClient
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for SwayIpcClient
impl RefUnwindSafe for SwayIpcClient
impl Send for SwayIpcClient
impl Sync for SwayIpcClient
impl Unpin for SwayIpcClient
impl UnsafeUnpin for SwayIpcClient
impl UnwindSafe for SwayIpcClient
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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