Class: Fusuma::Plugin::Inputs::RemapTouchpadInput::TouchpadSelector

Inherits:
Object
  • Object
show all
Defined in:
lib/fusuma/plugin/inputs/remap_touchpad_input.rb

Instance Method Summary collapse

Constructor Details

#initialize(names = nil) ⇒ TouchpadSelector

Returns a new instance of TouchpadSelector.



95
96
97
# File 'lib/fusuma/plugin/inputs/remap_touchpad_input.rb', line 95

def initialize(names = nil)
  @names = names
end

Instance Method Details

#selectArray<Revdev::EventDevice>

Returns:



100
101
102
103
104
105
106
107
108
109
# File 'lib/fusuma/plugin/inputs/remap_touchpad_input.rb', line 100

def select
  devices = if @names
    Fusuma::Device.all.select { |d| Array(@names).any? { |name| d.name =~ /#{name}/ } }
  else
    # available returns only touchpad devices
    Fusuma::Device.available
  end

  devices.map { |d| Revdev::EventDevice.new("/dev/input/#{d.id}") }
end