Struct I3

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

Newtype wrapper for UnixStream that implements i3’s IPC

Implementations§

Source§

impl I3

Source

pub async fn connect() -> Result<Self>

Connects to I3 over UnixStream

Source

pub async fn send_msg_body<P>(&mut self, msg: Msg, payload: P) -> Result<()>
where P: AsRef<str>,

Source

pub async fn send_msg(&mut self, msg: Msg) -> Result<()>

Source

pub async fn read_msg<D>(&mut self) -> Result<MsgResponse<D>>

Receive some message from the socket. Holds a Msg type and payload

Source

pub async fn read_event(&mut self) -> Result<Event>

Like read_msg but for event::Event

Source

pub async fn send_read<P, D>( &mut self, msg: Msg, payload: P, ) -> Result<MsgResponse<D>>
where P: AsRef<str>, D: DeserializeOwned,

Send a Msg and payload and receive a response. Convenience function over send_msg and read_msg

Source

pub async fn subscribe<E>(&mut self, events: E) -> Result<Success>
where E: AsRef<[Subscribe]>,

Returns a Future that will send a Subscribe message to i3 along with a list of events to listen to.

Source

pub fn listen(self) -> EventStream

Provides a type that implements Stream so you can await events in a loop

Source

pub async fn run_command<S: AsRef<str>>( &mut self, payload: S, ) -> Result<Vec<Success>>

Run an arbitrary command on i3. Response is a Vec of success true/false.

Source

pub async fn get_workspaces(&mut self) -> Result<Workspaces>

Future for getting the current Workspaces, sends Workspaces

Source

pub async fn get_outputs(&mut self) -> Result<Outputs>

Future that gets all Outputs, sends Outputs

Source

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

Future to get complete Node, sends Tree

Source

pub async fn get_marks(&mut self) -> Result<Marks>

Get all Marks, sends Marks

Source

pub async fn get_bar_ids(&mut self) -> Result<BarIds>

Future to get all BarIds, sends BarConfig

Source

pub async fn get_bar_config<S: AsRef<str>>( &mut self, bar_id: S, ) -> Result<BarConfig>

Future to get configs associated with a bar id responds with BarConfig, sends BarConfig

Source

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

Get i3 version

Source

pub async fn get_binding_modes(&mut self) -> Result<BindingModes>

Future to get BindingModes, sends BindingModes

Source

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

Future for Config, sends Config

Source

pub async fn get_tick(&mut self) -> Result<Success>

Future sends Tick

Source

pub async fn get_sync(&mut self) -> Result<Success>

Future Sync

Source

pub async fn get_binding_state(&mut self) -> Result<BindingState>

Future to get BindingState, sends BindingState

Trait Implementations§

Source§

impl Debug for I3

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for I3

§

impl RefUnwindSafe for I3

§

impl Send for I3

§

impl Sync for I3

§

impl Unpin for I3

§

impl UnwindSafe for I3

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> Instrument for T

Source§

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

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

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

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

impl<T> WithSubscriber for T

Source§

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

fn with_current_subscriber(self) -> WithDispatch<Self>

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