I3::Connection
Inherits Reference < Object
Represents a connection to a local i3 IPC server.
Constructors
Instance methods
bar_config(bar)
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)
bar_ids
Returns an array of strings, each identifying an i3 bar.
Elements of this array can be fed into #bar_config.
binding_modes
Returns an array of strings, each signifying a currently configured binding mode.
command(cmd)
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"
on_event
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(event_names : Enumerable(String))
Subscribe to each event in event_names.
Events can be retrieved one-at-a-time via #on_event.
con.subscribe ["workspace", "output"]
subscribe(event_name : String)
Subscribe to a single event.
Events can be retrieved one-at-a-time via #on_event.
con.subscribe "workspace"