class I3::Connection
- I3::Connection
- Reference
- Object
Overview
Represents a connection to a local i3 IPC server.
Defined in:
i3/connection.crConstructors
-
.new
Creates a new
Connection
.
Instance Method Summary
-
#bar_config(bar)
Returns a
Message::Bar
corresponding to the given bar ID. -
#bar_ids
Returns an array of strings, each identifying an i3 bar.
-
#binding_modes
Returns an array of strings, each signifying a currently configured binding mode.
-
#close
Close this instance's connection to the IPC server.
-
#command(cmd)
Send an (i3) command to i3.
-
#config
Returns a
Message::Config
corresponding to the running i3's most recent configuration. -
#marks
Returns an array of strings for each container that has a mark.
-
#on_event(&)
Yields the last unconsumed event (see classes in
Message::Event
). -
#outputs
Returns an array of all
Message::Output
s known to i3. -
#socket_path : String
The path to the socket being used for the connection.
-
#subscribe(event_names : Enumerable(String))
Subscribe to each event in event_names.
-
#subscribe(event_name : String)
Subscribe to a single event.
-
#tree
Returns a
Message::Tree
corresponding to the current i3 window tree. -
#version
Returns a
Message::Version
corresponding to i3's version information. -
#workspaces
Returns an array of all
Message::Workspace
s known to i3.
Constructor Detail
Instance Method Detail
Returns a Message::Bar
corresponding to the given bar ID.
Bar IDs can be retrieved via #bar_ids
.
# get the config for the first bar
con.bar_config(con.bar_ids.first)
Returns an array of strings, each identifying an i3 bar.
Elements of this array can be fed into #bar_config
.
Returns an array of strings, each signifying a currently configured binding mode.
Send an (i3) command to i3.
Returns an array of Message::Status
indicating the success of the commands.
# send a single command
con.command "sticky enable"
# send two commands
con.command "workspace 1; sticky enable"
Yields the last unconsumed event (see classes in Message::Event
).
Events are yielded in FIFO order.
con.on_event do |event|
# check the actual event type
end
Subscribe to each event in event_names.
Events can be retrieved one-at-a-time via #on_event
.
con.subscribe ["workspace", "output"]