Class: Fusuma::Plugin::Inputs::RemapTouchpadInput::TouchpadSelector
- Inherits:
-
Object
- Object
- Fusuma::Plugin::Inputs::RemapTouchpadInput::TouchpadSelector
- Defined in:
- lib/fusuma/plugin/inputs/remap_touchpad_input.rb
Instance Method Summary collapse
-
#initialize(names = nil) ⇒ TouchpadSelector
constructor
A new instance of TouchpadSelector.
- #select ⇒ Array<Revdev::EventDevice>
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
#select ⇒ Array<Revdev::EventDevice>
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 |