Method: I3::Runner#subscribe

Defined in:
lib/i3-ipc/runner.rb

#subscribe(path, output) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/i3-ipc/runner.rb', line 21

def subscribe(path, output)
  trap('SIGINT') { EM.stop; puts }
  I3::IPC.subscribe([:workspace], path) do |em, type, data|
    case type
    when I3::IPC.message_type_get_workspaces
      format_output data, output, false
    when I3::IPC::EVENT_WORKSPACE
      em.send_data I3::IPC.format(I3::IPC.message_type_get_workspaces)
    end
  end
end