Class: XInputWrapperPlus

Inherits:
XInputWrapper
  • Object
show all
Defined in:
lib/xinput_wrapperplus.rb

Instance Method Summary collapse

Constructor Details

#initialize(device: '3', host: 'sps', port: '59000', topic: 'input', verbose: true, lookup: {}, debug: false, capture_all: false, keys: []) ⇒ XInputWrapperPlus

Returns a new instance of XInputWrapperPlus.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/xinput_wrapperplus.rb', line 12

def initialize(device: '3', host: 'sps', port: '59000', 
               topic: 'input', verbose: true, lookup: {}, 
               debug: false, capture_all: false, keys: [])

  super(device: device, verbose: verbose, lookup: lookup, 
        debug: debug, keys: keys)
  
  @topic, @capture_all = topic, capture_all
  @sps = SPSPub.new host: host, port: port
  @sk = SecretKnock.new short_delay: 0.25, long_delay: 0.5, 
                            external: self, verbose: verbose, debug: debug
  @sk.detect timeout: 0.7

  @a = [] # Used to store mouse gestures
  @timer = nil

end

Instance Method Details

#knockObject



30
31
32
# File 'lib/xinput_wrapperplus.rb', line 30

def knock()
  puts 'knock' if @verbose
end

#message(msg, subtopic = :keyboard) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
# File 'lib/xinput_wrapperplus.rb', line 34

def message(msg, subtopic=:keyboard)
  
  puts ':: ' + msg.inspect if @verbose        
  
  return if msg.strip.empty?
  
  topic = [@topic, subtopic].join('/')
  
  @sps.notice "%s: %s" % [topic, msg]
  
end