Class: I3Ipc::Connection
- Inherits:
-
Object
- Object
- I3Ipc::Connection
- Defined in:
- lib/i3ipc/connection.rb
Overview
Entry point for communication with i3-ipc. Able to send/receive messages and convert responses.
Usage example: con = Connection.new p con.version.human_readable # => 4.10.2 (2015-0... p con.command('focus left').success? # => true p con.workspaces[0].name # => 0 Term # ... con.close
Instance Method Summary collapse
- #bar_config ⇒ Object
- #command(cmds) ⇒ Object
- #connect ⇒ Object
- #disconnect ⇒ Object
-
#initialize(connect = true) ⇒ Connection
constructor
A new instance of Connection.
- #marks ⇒ Object
- #outputs ⇒ Object
- #tree ⇒ Object
- #version ⇒ Object
- #workspaces ⇒ Object
Constructor Details
#initialize(connect = true) ⇒ Connection
Returns a new instance of Connection.
18 19 20 21 |
# File 'lib/i3ipc/connection.rb', line 18 def initialize(connect = true) @protocol = Protocol.new connect && @protocol.connect end |
Instance Method Details
#bar_config ⇒ Object
51 52 53 |
# File 'lib/i3ipc/connection.rb', line 51 def reply_for(6) end |
#command(cmds) ⇒ Object
31 32 33 |
# File 'lib/i3ipc/connection.rb', line 31 def command(cmds) reply_for(0, cmds) end |
#connect ⇒ Object
23 24 25 |
# File 'lib/i3ipc/connection.rb', line 23 def connect @protocol.connect end |
#disconnect ⇒ Object
27 28 29 |
# File 'lib/i3ipc/connection.rb', line 27 def disconnect @protocol.disconnect end |
#marks ⇒ Object
47 48 49 |
# File 'lib/i3ipc/connection.rb', line 47 def marks reply_for(5) end |
#outputs ⇒ Object
39 40 41 |
# File 'lib/i3ipc/connection.rb', line 39 def outputs reply_for(3) end |
#tree ⇒ Object
43 44 45 |
# File 'lib/i3ipc/connection.rb', line 43 def tree reply_for(4) end |
#version ⇒ Object
55 56 57 |
# File 'lib/i3ipc/connection.rb', line 55 def version reply_for(7) end |
#workspaces ⇒ Object
35 36 37 |
# File 'lib/i3ipc/connection.rb', line 35 def workspaces reply_for(1) end |