class TouchscreenTaps::Libinput
libinput wrapper makes debug_events available in ruby
Public Class Methods
devices()
click to toggle source
# File lib/touchscreen_taps/libinput.rb, line 18 def devices Open3.popen3(list_devices_cmd) do |_in, out, _err, _wait_thr| out.read.split("\n\n").map { |d| d.split("\n") } end end
events(device = nil) { |chomp| ... }
click to toggle source
# File lib/touchscreen_taps/libinput.rb, line 10 def events(device = nil) Open3.popen3(debug_events_cmd(device)) do |_in, out, _err, _wait_thr| out.each do |event| yield(event.chomp) end end end
Private Class Methods
debug_events_cmd(device)
click to toggle source
# File lib/touchscreen_taps/libinput.rb, line 26 def debug_events_cmd(device) 'stdbuf -oL -- libinput debug-events' \ "#{' --device=' + device.kernel unless device.nil?}" end
list_devices_cmd()
click to toggle source
# File lib/touchscreen_taps/libinput.rb, line 31 def list_devices_cmd 'libinput list-devices' end