pub struct Connection(/* private fields */);

Implementations§

source§

impl Connection

source

pub async fn new() -> Fallible<Self>

Creates a new async Connection to sway-ipc.

source

pub async fn run_command<T: AsRef<str>>( &mut self, payload: T ) -> Fallible<Vec<Fallible<()>>>

Runs the payload as sway commands.

source

pub async fn get_workspaces(&mut self) -> Fallible<Vec<Workspace>>

Get the list of current workspaces.

source

pub async fn subscribe<T: AsRef<[EventType]>>( self, events: T ) -> Fallible<EventStream>

Subscribe the IPC connection to the events listed in the payload.

source

pub async fn get_outputs(&mut self) -> Fallible<Vec<Output>>

Get the list of current outputs.

source

pub async fn get_tree(&mut self) -> Fallible<Node>

Get the node layout tree.

source

pub async fn get_marks(&mut self) -> Fallible<Vec<String>>

Get the names of all the marks currently set.

source

pub async fn get_bar_ids(&mut self) -> Fallible<Vec<String>>

Get a list of bar config names.

source

pub async fn get_bar_config<T: AsRef<str>>( &mut self, id: T ) -> Fallible<BarConfig>

Get the specified bar config.

source

pub async fn get_version(&mut self) -> Fallible<Version>

Get the version of sway that owns the IPC socket.

source

pub async fn get_binding_modes(&mut self) -> Fallible<Vec<String>>

Get the list of binding mode names.

source

pub async fn get_config(&mut self) -> Fallible<Config>

Returns the config that was last loaded.

source

pub async fn send_tick<T: AsRef<str>>(&mut self, payload: T) -> Fallible<bool>

Sends a tick event with the specified payload.

source

pub async fn sync(&mut self) -> Fallible<bool>

Replies failure object for i3 compatibility.

source

pub async fn get_binding_state(&mut self) -> Fallible<String>

Request the current binding state, e.g. the currently active binding mode name.

source

pub async fn get_inputs(&mut self) -> Fallible<Vec<Input>>

Get the list of input devices.

source

pub async fn get_seats(&mut self) -> Fallible<Vec<Seat>>

Get the list of seats.

Trait Implementations§

source§

impl Debug for Connection

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<Async<UnixStream>> for Connection

source§

fn from(unix_stream: Async<UnixStream>) -> Self

Converts to this type from the input type.
source§

impl From<Connection> for Async<UnixStream>

source§

fn from(connection: Connection) -> Self

Converts to this type from the input type.

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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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>,

§

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>,

§

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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more