Class: Fusuma::Plugin::Sendkey::Device

Inherits:
Object
  • Object
show all
Defined in:
lib/fusuma/plugin/sendkey/device.rb

Overview

handle Evdev device

Instance Method Summary collapse

Constructor Details

#initialize(path:) ⇒ Device

Returns a new instance of Device.



8
9
10
# File 'lib/fusuma/plugin/sendkey/device.rb', line 8

def initialize(path:)
  @evdev = Revdev::EventDevice.new(path)
end

Instance Method Details

#pathObject



12
13
14
15
16
# File 'lib/fusuma/plugin/sendkey/device.rb', line 12

def path
  raise "Device path is not found" if @evdev.nil?

  @path ||= @evdev.file.path
end

#write_event(event) ⇒ Object



18
19
20
# File 'lib/fusuma/plugin/sendkey/device.rb', line 18

def write_event(event)
  @evdev.write_input_event(event)
end