lib/fusuma/device.rb in fusuma-0.7.1 vs lib/fusuma/device.rb in fusuma-0.7.2
- old
+ new
@@ -15,22 +15,19 @@
exit 1
end
private
+ # @return [Array]
def fetch_device_names
- current_device = nil
- list_devices_logs.map do |line|
- current_device = extracted_input_device_from(line) || current_device
- next unless natural_scroll_is_available?(line)
- current_device
+ [].tap do |devices|
+ current_device = nil
+ LibinputCommands.new.list_devices do |line|
+ current_device = extracted_input_device_from(line) || current_device
+ next unless natural_scroll_is_available?(line)
+ devices << current_device
+ end
end.compact
- end
-
- def list_devices_logs
- Open3.popen3('libinput-list-devices') do |_i, o, _e, _w|
- return o.to_a
- end
end
def extracted_input_device_from(line)
return unless line =~ /^Kernel: /
line.match(/event[0-9]+/).to_s