Class: TouchscreenTaps::Libinput

Inherits:
Object
  • Object
show all
Defined in:
lib/touchscreen_taps/libinput.rb

Overview

libinput wrapper makes debug_events available in ruby

Class Method Summary collapse

Class Method Details

.devicesObject



18
19
20
21
22
# 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) ⇒ Object



10
11
12
13
14
15
16
# 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