Class: Fusuma::Plugin::Remap::KeyboardRemapper::TouchpadSelector

Inherits:
Object
  • Object
show all
Defined in:
lib/fusuma/plugin/remap/keyboard_remapper.rb

Instance Method Summary collapse

Constructor Details

#initialize(names = nil) ⇒ TouchpadSelector

Returns a new instance of TouchpadSelector.



344
345
346
# File 'lib/fusuma/plugin/remap/keyboard_remapper.rb', line 344

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

Instance Method Details

#selectArray<Revdev::EventDevice>

Returns:



349
350
351
352
353
354
355
356
357
358
# File 'lib/fusuma/plugin/remap/keyboard_remapper.rb', line 349

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