Sha256: 1ae708c0f3f0ec6fadfd3c4f6083d9b64255ce9cbf94a10dacdd0aeb40ffdb1d
Contents?: true
Size: 852 Bytes
Versions: 1
Compression:
Stored size: 852 Bytes
Contents
# frozen_string_literal: true require 'evdev' module Fusuma module Plugin module Sendkey # handle Evdev device class Device def initialize(path: nil) return if path && (@evdev = Evdev.new(path)) (0..99).lazy.find do |i| evdev = Evdev.new("/dev/input/event#{i}") # NOTE: find keyboard device @evdev = evdev if evdev.supports_event?('KEY_LEFTALT') rescue Errno::ENOENT # No such file or directory false # TODO: rescue Errno::EACCES end end def path raise 'Keyboard is not found' if @evdev.nil? @path ||= @evdev.file.path end def support?(keycode) @evdev.supports_event?(keycode) rescue NameError false end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fusuma-plugin-sendkey-0.3.0 | lib/fusuma/plugin/sendkey/device.rb |