class TouchscreenTaps::Config
Holds main configurations
Attributes
buffer[R]
touchscreen[R]
Public Class Methods
new(path = nil)
click to toggle source
# File lib/touchscreen_taps/config.rb, line 11 def initialize(path = nil) @buffer = fetch_buffer @touchscreen = fetch_touchscreen @config = fetch_config(path) end
Public Instance Methods
by_keys(keys)
click to toggle source
# File lib/touchscreen_taps/config.rb, line 17 def by_keys(keys) @config.dig(*keys) end
Private Instance Methods
default_config_path()
click to toggle source
# File lib/touchscreen_taps/config.rb, line 39 def default_config_path "#{__dir__}/default_config.yml" end
fetch_buffer()
click to toggle source
# File lib/touchscreen_taps/config.rb, line 23 def fetch_buffer GestureBuffer.new end
fetch_config(path)
click to toggle source
# File lib/touchscreen_taps/config.rb, line 35 def fetch_config(path) YAML.load_file(path || default_config_path) end
fetch_touchscreen()
click to toggle source
# File lib/touchscreen_taps/config.rb, line 27 def fetch_touchscreen devices = Libinput.devices touchscreens = TouchscreenDevice.select_from(devices) # touchscreen can be nil # in that case events from all touch-capable devices will be processed touchscreens.count == 1 ? touchscreens.first : nil end