Module: Vigilem::Evdev::DOM::InputEventUtils
- Extended by:
- Support::Utils, InputEventUtils
- Includes:
- DOM::Utils
- Included in:
- InputEventConverter, InputEventUtils
- Defined in:
- lib/vigilem/evdev/dom/input_event_utils.rb
Instance Method Summary collapse
-
#event_code_to_keycode_str(event_code) ⇒ String
takes a InputEvent#code and returns a String representing the keycode value.
-
#location_str_from_keycode_name(keycode_name) ⇒ String || NilClass
takes a keycode_name and returns a common location string if available.
-
#modifier_keymap_name(keycode_name) ⇒ String
takes a keycode name and returns the keymap modifier name.
Instance Method Details
#event_code_to_keycode_str(event_code) ⇒ String
takes a InputEvent#code and returns a String representing the keycode value
13 14 15 |
# File 'lib/vigilem/evdev/dom/input_event_utils.rb', line 13 def event_code_to_keycode_str(event_code) "keycode#{event_code}" end |
#location_str_from_keycode_name(keycode_name) ⇒ String || NilClass
takes a keycode_name and returns a common location string if available
21 22 23 24 25 |
# File 'lib/vigilem/evdev/dom/input_event_utils.rb', line 21 def location_str_from_keycode_name(keycode_name) if loc = keycode_name.to_s.gsub('KP', 'NUMPAD').scan(/LEFT|RIGHT|NUMPAD/i).first loc.downcase.tap {|obj| obj[0] = obj[0].upcase } end end |
#modifier_keymap_name(keycode_name) ⇒ String
TODO:
meta
takes a keycode name and returns the keymap modifier name
31 32 33 34 35 36 37 38 39 |
# File 'lib/vigilem/evdev/dom/input_event_utils.rb', line 31 def modifier_keymap_name(keycode_name) if (keycode_name) =~ /caps|shift|alt|c(on)?tro?l/i if keycode_name == :KEY_CAPSLOCK 'capsshift' else keycode_name.to_s.gsub(/KEY_/, '').split(/ight|eft/i).reverse.join.downcase end end end |