Struct tokio_i3ipc::I3
source · pub struct I3 { /* private fields */ }
Expand description
Newtype wrapper for UnixStream
that implements i3’s IPC
Implementations§
source§impl I3
impl I3
pub async fn send_msg_body<P>(&mut self, msg: Msg, payload: P) -> Result<()>where
P: AsRef<str>,
pub async fn send_msg(&mut self, msg: Msg) -> Result<()>
sourcepub async fn read_msg<D>(&mut self) -> Result<MsgResponse<D>>where
D: DeserializeOwned,
pub async fn read_msg<D>(&mut self) -> Result<MsgResponse<D>>where
D: DeserializeOwned,
Receive some message from the socket. Holds a Msg
type and payload
sourcepub async fn read_event(&mut self) -> Result<Event>
pub async fn read_event(&mut self) -> Result<Event>
Like read_msg
but for event::Event
sourcepub async fn send_read<P, D>(
&mut self,
msg: Msg,
payload: P
) -> Result<MsgResponse<D>>where
P: AsRef<str>,
D: DeserializeOwned,
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
sourcepub async fn subscribe<E>(&mut self, events: E) -> Result<Success>where
E: AsRef<[Subscribe]>,
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.
sourcepub fn listen(self) -> FramedRead<UnixStream, EventCodec>
pub fn listen(self) -> FramedRead<UnixStream, EventCodec>
Provides a type that implements Stream
so you can await
events in a
loop
sourcepub async fn run_command<S: AsRef<str>>(
&mut self,
payload: S
) -> Result<Vec<Success>>
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.
sourcepub async fn get_workspaces(&mut self) -> Result<Workspaces>
pub async fn get_workspaces(&mut self) -> Result<Workspaces>
Future for getting the current Workspaces, sends Workspaces
sourcepub async fn get_outputs(&mut self) -> Result<Outputs>
pub async fn get_outputs(&mut self) -> Result<Outputs>
sourcepub async fn get_bar_ids(&mut self) -> Result<BarIds>
pub async fn get_bar_ids(&mut self) -> Result<BarIds>
sourcepub async fn get_version(&mut self) -> Result<Version>
pub async fn get_version(&mut self) -> Result<Version>
Get i3 version
sourcepub async fn get_binding_modes(&mut self) -> Result<BindingModes>
pub async fn get_binding_modes(&mut self) -> Result<BindingModes>
Future to get BindingModes, sends BindingModes
sourcepub async fn get_binding_state(&mut self) -> Result<BindingState>
pub async fn get_binding_state(&mut self) -> Result<BindingState>
Future to get BindingState, sends BindingState