class Fusuma::Plugin::Inputs::LibinputCommandInput

libinput commands wrapper

def command

Returns:
  • (LibinputCommand) -
def command
  @command ||= LibinputCommand.new(
    libinput_options: libinput_options,
    commands: {
      debug_events_command: debug_events_command,
      list_devices_command: list_devices_command
    }
  )
end

def config_param_types

def config_param_types
  {
    device: [String],
    'enable-dwt': [TrueClass, FalseClass],
    'enable-tap': [TrueClass, FalseClass],
    'show-keycodes': [TrueClass, FalseClass],
    verbose: [TrueClass, FalseClass],
    'libinput-debug-events': [String],
    'libinput-list-devices': [String]
  }
end

def create_io

def create_io
  IO.pipe
end

def debug_events_command

def debug_events_command
  config_params(:'libinput-debug-events')
end

def io

Returns:
  • (IO) -
def io
  @io ||= begin
    reader, writer = create_io
    @pid = command.debug_events(writer)
    reader
  end
end

def libinput_options

Returns:
  • (Array) -
def libinput_options
  device = ("--device='#{config_params(:device)}'" if config_params(:device))
  enable_tap = '--enable-tap' if config_params(:'enable-tap')
  enable_dwt = '--enable-dwt' if config_params(:'enable-dwt')
  show_keycodes = '--show-keycodes' if config_params(:'show-keycodes')
  verbose = '--verbose' if config_params(:verbose)
  [
    device,
    enable_dwt,
    enable_tap,
    show_keycodes,
    verbose
  ].compact
end

def list_devices_command

def list_devices_command
  config_params(:'libinput-list-devices')
end