Class: Rkremap
- Inherits:
-
Object
- Object
- Rkremap
- Includes:
- KeyCode
- Defined in:
- lib/rkremap.rb,
lib/rkremap/evdev.rb,
lib/rkremap/event.rb,
lib/rkremap/remap.rb,
lib/rkremap/uinput.rb,
lib/rkremap/keycode.rb,
lib/rkremap/version.rb,
lib/rkremap/winattr.rb,
lib/rkremap/evdev_list.rb,
lib/rkremap/winattr_kde.rb,
lib/rkremap/winattr_x11.rb
Defined Under Namespace
Modules: KeyCode, X11 Classes: App, Evdev, EvdevList, Event, Remap, Uinput, WinAttr, WinAttrKDE, WinAttrX11
Constant Summary collapse
- EV_SYN =
/usr/include/linux/input-event-codes.h
0- EV_KEY =
1- EV_REL =
2- EV_ABS =
3- EV_MSC =
4- SYN_REPORT =
0- EVENT_TYPE_VALUE =
{ release: 0, press: 1, repeat: 2, }
- CODE_KEY =
{}
- VERSION =
"0.6.0"
Constants included from KeyCode
KeyCode::BTN_0, KeyCode::BTN_1, KeyCode::BTN_2, KeyCode::BTN_3, KeyCode::BTN_4, KeyCode::BTN_5, KeyCode::BTN_6, KeyCode::BTN_7, KeyCode::BTN_8, KeyCode::BTN_9, KeyCode::BTN_A, KeyCode::BTN_B, KeyCode::BTN_BACK, KeyCode::BTN_BASE, KeyCode::BTN_BASE2, KeyCode::BTN_BASE3, KeyCode::BTN_BASE4, KeyCode::BTN_BASE5, KeyCode::BTN_BASE6, KeyCode::BTN_C, KeyCode::BTN_DEAD, KeyCode::BTN_DIGI, KeyCode::BTN_EAST, KeyCode::BTN_EXTRA, KeyCode::BTN_FORWARD, KeyCode::BTN_GAMEPAD, KeyCode::BTN_GEAR_DOWN, KeyCode::BTN_GEAR_UP, KeyCode::BTN_JOYSTICK, KeyCode::BTN_LEFT, KeyCode::BTN_MIDDLE, KeyCode::BTN_MISC, KeyCode::BTN_MODE, KeyCode::BTN_MOUSE, KeyCode::BTN_NORTH, KeyCode::BTN_PINKIE, KeyCode::BTN_RIGHT, KeyCode::BTN_SELECT, KeyCode::BTN_SIDE, KeyCode::BTN_SOUTH, KeyCode::BTN_START, KeyCode::BTN_STYLUS, KeyCode::BTN_STYLUS2, KeyCode::BTN_STYLUS3, KeyCode::BTN_TASK, KeyCode::BTN_THUMB, KeyCode::BTN_THUMB2, KeyCode::BTN_THUMBL, KeyCode::BTN_THUMBR, KeyCode::BTN_TL, KeyCode::BTN_TL2, KeyCode::BTN_TOOL_AIRBRUSH, KeyCode::BTN_TOOL_BRUSH, KeyCode::BTN_TOOL_DOUBLETAP, KeyCode::BTN_TOOL_FINGER, KeyCode::BTN_TOOL_LENS, KeyCode::BTN_TOOL_MOUSE, KeyCode::BTN_TOOL_PEN, KeyCode::BTN_TOOL_PENCIL, KeyCode::BTN_TOOL_QUADTAP, KeyCode::BTN_TOOL_QUINTTAP, KeyCode::BTN_TOOL_RUBBER, KeyCode::BTN_TOOL_TRIPLETAP, KeyCode::BTN_TOP, KeyCode::BTN_TOP2, KeyCode::BTN_TOUCH, KeyCode::BTN_TR, KeyCode::BTN_TR2, KeyCode::BTN_TRIGGER, KeyCode::BTN_WEST, KeyCode::BTN_WHEEL, KeyCode::BTN_X, KeyCode::BTN_Y, KeyCode::BTN_Z, KeyCode::KEY_0, KeyCode::KEY_1, KeyCode::KEY_102ND, KeyCode::KEY_10CHANNELSDOWN, KeyCode::KEY_10CHANNELSUP, KeyCode::KEY_2, KeyCode::KEY_3, KeyCode::KEY_3D_MODE, KeyCode::KEY_4, KeyCode::KEY_5, KeyCode::KEY_6, KeyCode::KEY_7, KeyCode::KEY_8, KeyCode::KEY_9, KeyCode::KEY_A, KeyCode::KEY_AB, KeyCode::KEY_ADDRESSBOOK, KeyCode::KEY_AGAIN, KeyCode::KEY_ALS_TOGGLE, KeyCode::KEY_ALTERASE, KeyCode::KEY_ANGLE, KeyCode::KEY_APOSTROPHE, KeyCode::KEY_APPSELECT, KeyCode::KEY_ARCHIVE, KeyCode::KEY_ASPECT_RATIO, KeyCode::KEY_ASSISTANT, KeyCode::KEY_ATTENDANT_OFF, KeyCode::KEY_ATTENDANT_ON, KeyCode::KEY_ATTENDANT_TOGGLE, KeyCode::KEY_AUDIO, KeyCode::KEY_AUDIO_DESC, KeyCode::KEY_AUX, KeyCode::KEY_B, KeyCode::KEY_BACK, KeyCode::KEY_BACKSLASH, KeyCode::KEY_BACKSPACE, KeyCode::KEY_BASSBOOST, KeyCode::KEY_BATTERY, KeyCode::KEY_BLUE, KeyCode::KEY_BLUETOOTH, KeyCode::KEY_BOOKMARKS, KeyCode::KEY_BREAK, KeyCode::KEY_BRIGHTNESSDOWN, KeyCode::KEY_BRIGHTNESSUP, KeyCode::KEY_BRIGHTNESS_AUTO, KeyCode::KEY_BRIGHTNESS_CYCLE, KeyCode::KEY_BRIGHTNESS_MAX, KeyCode::KEY_BRIGHTNESS_MIN, KeyCode::KEY_BRIGHTNESS_TOGGLE, KeyCode::KEY_BRIGHTNESS_ZERO, KeyCode::KEY_BRL_DOT1, KeyCode::KEY_BRL_DOT10, KeyCode::KEY_BRL_DOT2, KeyCode::KEY_BRL_DOT3, KeyCode::KEY_BRL_DOT4, KeyCode::KEY_BRL_DOT5, KeyCode::KEY_BRL_DOT6, KeyCode::KEY_BRL_DOT7, KeyCode::KEY_BRL_DOT8, KeyCode::KEY_BRL_DOT9, KeyCode::KEY_BUTTONCONFIG, KeyCode::KEY_C, KeyCode::KEY_CALC, KeyCode::KEY_CALENDAR, KeyCode::KEY_CAMERA, KeyCode::KEY_CAMERA_DOWN, KeyCode::KEY_CAMERA_FOCUS, KeyCode::KEY_CAMERA_LEFT, KeyCode::KEY_CAMERA_RIGHT, KeyCode::KEY_CAMERA_UP, KeyCode::KEY_CAMERA_ZOOMIN, KeyCode::KEY_CAMERA_ZOOMOUT, KeyCode::KEY_CANCEL, KeyCode::KEY_CAPSLOCK, KeyCode::KEY_CD, KeyCode::KEY_CHANNEL, KeyCode::KEY_CHANNELDOWN, KeyCode::KEY_CHANNELUP, KeyCode::KEY_CHAT, KeyCode::KEY_CLEAR, KeyCode::KEY_CLOSE, KeyCode::KEY_CLOSECD, KeyCode::KEY_CNT, KeyCode::KEY_COFFEE, KeyCode::KEY_COMMA, KeyCode::KEY_COMPOSE, KeyCode::KEY_COMPUTER, KeyCode::KEY_CONFIG, KeyCode::KEY_CONNECT, KeyCode::KEY_CONTEXT_MENU, KeyCode::KEY_CONTROLPANEL, KeyCode::KEY_COPY, KeyCode::KEY_CUT, KeyCode::KEY_CYCLEWINDOWS, KeyCode::KEY_D, KeyCode::KEY_DASHBOARD, KeyCode::KEY_DATA, KeyCode::KEY_DATABASE, KeyCode::KEY_DELETE, KeyCode::KEY_DELETEFILE, KeyCode::KEY_DEL_EOL, KeyCode::KEY_DEL_EOS, KeyCode::KEY_DEL_LINE, KeyCode::KEY_DIGITS, KeyCode::KEY_DIRECTION, KeyCode::KEY_DIRECTORY, KeyCode::KEY_DISPLAYTOGGLE, KeyCode::KEY_DISPLAY_OFF, KeyCode::KEY_DOCUMENTS, KeyCode::KEY_DOLLAR, KeyCode::KEY_DOT, KeyCode::KEY_DOWN, KeyCode::KEY_DVD, KeyCode::KEY_E, KeyCode::KEY_EDIT, KeyCode::KEY_EDITOR, KeyCode::KEY_EJECTCD, KeyCode::KEY_EJECTCLOSECD, KeyCode::KEY_EMAIL, KeyCode::KEY_EMOJI_PICKER, KeyCode::KEY_END, KeyCode::KEY_ENTER, KeyCode::KEY_EPG, KeyCode::KEY_EQUAL, KeyCode::KEY_ESC, KeyCode::KEY_EURO, KeyCode::KEY_EXIT, KeyCode::KEY_F, KeyCode::KEY_F1, KeyCode::KEY_F10, KeyCode::KEY_F11, KeyCode::KEY_F12, KeyCode::KEY_F13, KeyCode::KEY_F14, KeyCode::KEY_F15, KeyCode::KEY_F16, KeyCode::KEY_F17, KeyCode::KEY_F18, KeyCode::KEY_F19, KeyCode::KEY_F2, KeyCode::KEY_F20, KeyCode::KEY_F21, KeyCode::KEY_F22, KeyCode::KEY_F23, KeyCode::KEY_F24, KeyCode::KEY_F3, KeyCode::KEY_F4, KeyCode::KEY_F5, KeyCode::KEY_F6, KeyCode::KEY_F7, KeyCode::KEY_F8, KeyCode::KEY_F9, KeyCode::KEY_FASTFORWARD, KeyCode::KEY_FASTREVERSE, KeyCode::KEY_FAVORITES, KeyCode::KEY_FILE, KeyCode::KEY_FINANCE, KeyCode::KEY_FIND, KeyCode::KEY_FIRST, KeyCode::KEY_FN, KeyCode::KEY_FN_1, KeyCode::KEY_FN_2, KeyCode::KEY_FN_B, KeyCode::KEY_FN_D, KeyCode::KEY_FN_E, KeyCode::KEY_FN_ESC, KeyCode::KEY_FN_F, KeyCode::KEY_FN_F1, KeyCode::KEY_FN_F10, KeyCode::KEY_FN_F11, KeyCode::KEY_FN_F12, KeyCode::KEY_FN_F2, KeyCode::KEY_FN_F3, KeyCode::KEY_FN_F4, KeyCode::KEY_FN_F5, KeyCode::KEY_FN_F6, KeyCode::KEY_FN_F7, KeyCode::KEY_FN_F8, KeyCode::KEY_FN_F9, KeyCode::KEY_FN_RIGHT_SHIFT, KeyCode::KEY_FN_S, KeyCode::KEY_FORWARD, KeyCode::KEY_FORWARDMAIL, KeyCode::KEY_FRAMEBACK, KeyCode::KEY_FRAMEFORWARD, KeyCode::KEY_FRONT, KeyCode::KEY_FULL_SCREEN, KeyCode::KEY_G, KeyCode::KEY_GAMES, KeyCode::KEY_GOTO, KeyCode::KEY_GRAPHICSEDITOR, KeyCode::KEY_GRAVE, KeyCode::KEY_GREEN, KeyCode::KEY_H, KeyCode::KEY_HANGEUL, KeyCode::KEY_HANGUEL, KeyCode::KEY_HANGUP_PHONE, KeyCode::KEY_HANJA, KeyCode::KEY_HELP, KeyCode::KEY_HENKAN, KeyCode::KEY_HIRAGANA, KeyCode::KEY_HOME, KeyCode::KEY_HOMEPAGE, KeyCode::KEY_HP, KeyCode::KEY_I, KeyCode::KEY_IMAGES, KeyCode::KEY_INFO, KeyCode::KEY_INSERT, KeyCode::KEY_INS_LINE, KeyCode::KEY_ISO, KeyCode::KEY_J, KeyCode::KEY_JOURNAL, KeyCode::KEY_K, KeyCode::KEY_KATAKANA, KeyCode::KEY_KATAKANAHIRAGANA, KeyCode::KEY_KBDILLUMDOWN, KeyCode::KEY_KBDILLUMTOGGLE, KeyCode::KEY_KBDILLUMUP, KeyCode::KEY_KBDINPUTASSIST_ACCEPT, KeyCode::KEY_KBDINPUTASSIST_CANCEL, KeyCode::KEY_KBDINPUTASSIST_NEXT, KeyCode::KEY_KBDINPUTASSIST_NEXTGROUP, KeyCode::KEY_KBDINPUTASSIST_PREV, KeyCode::KEY_KBDINPUTASSIST_PREVGROUP, KeyCode::KEY_KBD_LAYOUT_NEXT, KeyCode::KEY_KBD_LCD_MENU1, KeyCode::KEY_KBD_LCD_MENU2, KeyCode::KEY_KBD_LCD_MENU3, KeyCode::KEY_KBD_LCD_MENU4, KeyCode::KEY_KBD_LCD_MENU5, KeyCode::KEY_KEYBOARD, KeyCode::KEY_KP0, KeyCode::KEY_KP1, KeyCode::KEY_KP2, KeyCode::KEY_KP3, KeyCode::KEY_KP4, KeyCode::KEY_KP5, KeyCode::KEY_KP6, KeyCode::KEY_KP7, KeyCode::KEY_KP8, KeyCode::KEY_KP9, KeyCode::KEY_KPASTERISK, KeyCode::KEY_KPCOMMA, KeyCode::KEY_KPDOT, KeyCode::KEY_KPENTER, KeyCode::KEY_KPEQUAL, KeyCode::KEY_KPJPCOMMA, KeyCode::KEY_KPLEFTPAREN, KeyCode::KEY_KPMINUS, KeyCode::KEY_KPPLUS, KeyCode::KEY_KPPLUSMINUS, KeyCode::KEY_KPRIGHTPAREN, KeyCode::KEY_KPSLASH, KeyCode::KEY_L, KeyCode::KEY_LANGUAGE, KeyCode::KEY_LAST, KeyCode::KEY_LEFT, KeyCode::KEY_LEFTALT, KeyCode::KEY_LEFTBRACE, KeyCode::KEY_LEFTCTRL, KeyCode::KEY_LEFTMETA, KeyCode::KEY_LEFTSHIFT, KeyCode::KEY_LEFT_DOWN, KeyCode::KEY_LEFT_UP, KeyCode::KEY_LIGHTS_TOGGLE, KeyCode::KEY_LINEFEED, KeyCode::KEY_LIST, KeyCode::KEY_LOGOFF, KeyCode::KEY_M, KeyCode::KEY_MACRO, KeyCode::KEY_MACRO1, KeyCode::KEY_MACRO10, KeyCode::KEY_MACRO11, KeyCode::KEY_MACRO12, KeyCode::KEY_MACRO13, KeyCode::KEY_MACRO14, KeyCode::KEY_MACRO15, KeyCode::KEY_MACRO16, KeyCode::KEY_MACRO17, KeyCode::KEY_MACRO18, KeyCode::KEY_MACRO19, KeyCode::KEY_MACRO2, KeyCode::KEY_MACRO20, KeyCode::KEY_MACRO21, KeyCode::KEY_MACRO22, KeyCode::KEY_MACRO23, KeyCode::KEY_MACRO24, KeyCode::KEY_MACRO25, KeyCode::KEY_MACRO26, KeyCode::KEY_MACRO27, KeyCode::KEY_MACRO28, KeyCode::KEY_MACRO29, KeyCode::KEY_MACRO3, KeyCode::KEY_MACRO30, KeyCode::KEY_MACRO4, KeyCode::KEY_MACRO5, KeyCode::KEY_MACRO6, KeyCode::KEY_MACRO7, KeyCode::KEY_MACRO8, KeyCode::KEY_MACRO9, KeyCode::KEY_MACRO_PRESET1, KeyCode::KEY_MACRO_PRESET2, KeyCode::KEY_MACRO_PRESET3, KeyCode::KEY_MACRO_PRESET_CYCLE, KeyCode::KEY_MACRO_RECORD_START, KeyCode::KEY_MACRO_RECORD_STOP, KeyCode::KEY_MAIL, KeyCode::KEY_MAX, KeyCode::KEY_MEDIA, KeyCode::KEY_MEDIA_REPEAT, KeyCode::KEY_MEDIA_TOP_MENU, KeyCode::KEY_MEMO, KeyCode::KEY_MENU, KeyCode::KEY_MESSENGER, KeyCode::KEY_MHP, KeyCode::KEY_MICMUTE, KeyCode::KEY_MINUS, KeyCode::KEY_MIN_INTERESTING, KeyCode::KEY_MODE, KeyCode::KEY_MOVE, KeyCode::KEY_MP3, KeyCode::KEY_MSDOS, KeyCode::KEY_MUHENKAN, KeyCode::KEY_MUTE, KeyCode::KEY_N, KeyCode::KEY_NEW, KeyCode::KEY_NEWS, KeyCode::KEY_NEXT, KeyCode::KEY_NEXTSONG, KeyCode::KEY_NEXT_FAVORITE, KeyCode::KEY_NOTIFICATION_CENTER, KeyCode::KEY_NUMERIC_0, KeyCode::KEY_NUMERIC_1, KeyCode::KEY_NUMERIC_11, KeyCode::KEY_NUMERIC_12, KeyCode::KEY_NUMERIC_2, KeyCode::KEY_NUMERIC_3, KeyCode::KEY_NUMERIC_4, KeyCode::KEY_NUMERIC_5, KeyCode::KEY_NUMERIC_6, KeyCode::KEY_NUMERIC_7, KeyCode::KEY_NUMERIC_8, KeyCode::KEY_NUMERIC_9, KeyCode::KEY_NUMERIC_A, KeyCode::KEY_NUMERIC_B, KeyCode::KEY_NUMERIC_C, KeyCode::KEY_NUMERIC_D, KeyCode::KEY_NUMERIC_POUND, KeyCode::KEY_NUMERIC_STAR, KeyCode::KEY_NUMLOCK, KeyCode::KEY_O, KeyCode::KEY_OK, KeyCode::KEY_ONSCREEN_KEYBOARD, KeyCode::KEY_OPEN, KeyCode::KEY_OPTION, KeyCode::KEY_P, KeyCode::KEY_PAGEDOWN, KeyCode::KEY_PAGEUP, KeyCode::KEY_PASTE, KeyCode::KEY_PAUSE, KeyCode::KEY_PAUSECD, KeyCode::KEY_PAUSE_RECORD, KeyCode::KEY_PC, KeyCode::KEY_PHONE, KeyCode::KEY_PICKUP_PHONE, KeyCode::KEY_PLAY, KeyCode::KEY_PLAYCD, KeyCode::KEY_PLAYER, KeyCode::KEY_PLAYPAUSE, KeyCode::KEY_POWER, KeyCode::KEY_POWER2, KeyCode::KEY_PRESENTATION, KeyCode::KEY_PREVIOUS, KeyCode::KEY_PREVIOUSSONG, KeyCode::KEY_PRINT, KeyCode::KEY_PRIVACY_SCREEN_TOGGLE, KeyCode::KEY_PROG1, KeyCode::KEY_PROG2, KeyCode::KEY_PROG3, KeyCode::KEY_PROG4, KeyCode::KEY_PROGRAM, KeyCode::KEY_PROPS, KeyCode::KEY_PVR, KeyCode::KEY_Q, KeyCode::KEY_QUESTION, KeyCode::KEY_R, KeyCode::KEY_RADIO, KeyCode::KEY_RECORD, KeyCode::KEY_RED, KeyCode::KEY_REDO, KeyCode::KEY_REFRESH, KeyCode::KEY_REPLY, KeyCode::KEY_RESERVED, KeyCode::KEY_RESTART, KeyCode::KEY_REWIND, KeyCode::KEY_RFKILL, KeyCode::KEY_RIGHT, KeyCode::KEY_RIGHTALT, KeyCode::KEY_RIGHTBRACE, KeyCode::KEY_RIGHTCTRL, KeyCode::KEY_RIGHTMETA, KeyCode::KEY_RIGHTSHIFT, KeyCode::KEY_RIGHT_DOWN, KeyCode::KEY_RIGHT_UP, KeyCode::KEY_RO, KeyCode::KEY_ROOT_MENU, KeyCode::KEY_ROTATE_DISPLAY, KeyCode::KEY_ROTATE_LOCK_TOGGLE, KeyCode::KEY_S, KeyCode::KEY_SAT, KeyCode::KEY_SAT2, KeyCode::KEY_SAVE, KeyCode::KEY_SCALE, KeyCode::KEY_SCREEN, KeyCode::KEY_SCREENLOCK, KeyCode::KEY_SCREENSAVER, KeyCode::KEY_SCROLLDOWN, KeyCode::KEY_SCROLLLOCK, KeyCode::KEY_SCROLLUP, KeyCode::KEY_SEARCH, KeyCode::KEY_SELECT, KeyCode::KEY_SELECTIVE_SCREENSHOT, KeyCode::KEY_SEMICOLON, KeyCode::KEY_SEND, KeyCode::KEY_SENDFILE, KeyCode::KEY_SETUP, KeyCode::KEY_SHOP, KeyCode::KEY_SHUFFLE, KeyCode::KEY_SLASH, KeyCode::KEY_SLEEP, KeyCode::KEY_SLOW, KeyCode::KEY_SLOWREVERSE, KeyCode::KEY_SOUND, KeyCode::KEY_SPACE, KeyCode::KEY_SPELLCHECK, KeyCode::KEY_SPORT, KeyCode::KEY_SPREADSHEET, KeyCode::KEY_STOP, KeyCode::KEY_STOPCD, KeyCode::KEY_STOP_RECORD, KeyCode::KEY_SUBTITLE, KeyCode::KEY_SUSPEND, KeyCode::KEY_SWITCHVIDEOMODE, KeyCode::KEY_SYSRQ, KeyCode::KEY_T, KeyCode::KEY_TAB, KeyCode::KEY_TAPE, KeyCode::KEY_TASKMANAGER, KeyCode::KEY_TEEN, KeyCode::KEY_TEXT, KeyCode::KEY_TIME, KeyCode::KEY_TITLE, KeyCode::KEY_TOUCHPAD_OFF, KeyCode::KEY_TOUCHPAD_ON, KeyCode::KEY_TOUCHPAD_TOGGLE, KeyCode::KEY_TUNER, KeyCode::KEY_TV, KeyCode::KEY_TV2, KeyCode::KEY_TWEN, KeyCode::KEY_U, KeyCode::KEY_UNDO, KeyCode::KEY_UNKNOWN, KeyCode::KEY_UNMUTE, KeyCode::KEY_UP, KeyCode::KEY_UWB, KeyCode::KEY_V, KeyCode::KEY_VCR, KeyCode::KEY_VCR2, KeyCode::KEY_VENDOR, KeyCode::KEY_VIDEO, KeyCode::KEY_VIDEOPHONE, KeyCode::KEY_VIDEO_NEXT, KeyCode::KEY_VIDEO_PREV, KeyCode::KEY_VOD, KeyCode::KEY_VOICECOMMAND, KeyCode::KEY_VOICEMAIL, KeyCode::KEY_VOLUMEDOWN, KeyCode::KEY_VOLUMEUP, KeyCode::KEY_W, KeyCode::KEY_WAKEUP, KeyCode::KEY_WIMAX, KeyCode::KEY_WLAN, KeyCode::KEY_WORDPROCESSOR, KeyCode::KEY_WPS_BUTTON, KeyCode::KEY_WWAN, KeyCode::KEY_WWW, KeyCode::KEY_X, KeyCode::KEY_XFER, KeyCode::KEY_Y, KeyCode::KEY_YELLOW, KeyCode::KEY_YEN, KeyCode::KEY_Z, KeyCode::KEY_ZENKAKUHANKAKU, KeyCode::KEY_ZOOM, KeyCode::KEY_ZOOMIN, KeyCode::KEY_ZOOMOUT, KeyCode::KEY_ZOOMRESET
Instance Attribute Summary collapse
-
#auto_detect ⇒ Object
Returns the value of attribute auto_detect.
-
#exclude ⇒ Object
Returns the value of attribute exclude.
-
#grab ⇒ Object
Returns the value of attribute grab.
-
#modifiers ⇒ Object
Returns the value of attribute modifiers.
-
#mouse ⇒ Object
Returns the value of attribute mouse.
-
#window_system ⇒ Object
Returns the value of attribute window_system.
-
#x11 ⇒ Object
Returns the value of attribute x11.
Instance Method Summary collapse
- #append_event(event) ⇒ Object
- #event(code: nil, type: nil) ⇒ Object
-
#initialize(devices = [], exclude: nil, mouse: false) ⇒ Rkremap
constructor
A new instance of Rkremap.
- #key(code, mod = {}) ⇒ Object
- #match(device: nil, code: nil, type: nil, app: nil, &block) ⇒ Object
- #remap(**opts) ⇒ Object
- #start(&block) ⇒ Object
- #synchronize(&block) ⇒ Object
- #with_modifier(mod, &block) ⇒ Object
Constructor Details
#initialize(devices = [], exclude: nil, mouse: false) ⇒ Rkremap
Returns a new instance of Rkremap.
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/rkremap.rb', line 40 def initialize(devices=[], exclude: nil, mouse: false) if devices.empty? @auto_detect = true else devices = Array(devices) end @devices = devices @exclude = exclude @mouse = mouse @uinput = Uinput.new @grab = false @x11 = false @window_system = @x11 ? 'x11' : nil # 'x11' or 'kde' @modifiers = [ KEY_LEFTCTRL, KEY_RIGHTCTRL, KEY_LEFTSHIFT, KEY_RIGHTSHIFT, KEY_LEFTALT, KEY_RIGHTALT, KEY_LEFTMETA, KEY_RIGHTMETA, ] @event_procs = [] @mutex = Mutex.new end |
Instance Attribute Details
#auto_detect ⇒ Object
Returns the value of attribute auto_detect.
33 34 35 |
# File 'lib/rkremap.rb', line 33 def auto_detect @auto_detect end |
#exclude ⇒ Object
Returns the value of attribute exclude.
34 35 36 |
# File 'lib/rkremap.rb', line 34 def exclude @exclude end |
#grab ⇒ Object
Returns the value of attribute grab.
29 30 31 |
# File 'lib/rkremap.rb', line 29 def grab @grab end |
#modifiers ⇒ Object
Returns the value of attribute modifiers.
30 31 32 |
# File 'lib/rkremap.rb', line 30 def modifiers @modifiers end |
#mouse ⇒ Object
Returns the value of attribute mouse.
35 36 37 |
# File 'lib/rkremap.rb', line 35 def mouse @mouse end |
#window_system ⇒ Object
Returns the value of attribute window_system.
32 33 34 |
# File 'lib/rkremap.rb', line 32 def window_system @window_system end |
#x11 ⇒ Object
Returns the value of attribute x11.
31 32 33 |
# File 'lib/rkremap.rb', line 31 def x11 @x11 end |
Instance Method Details
#append_event(event) ⇒ Object
146 147 148 149 |
# File 'lib/rkremap.rb', line 146 def append_event(event) @events.push event @events.push Event.new(event.device, event.time, EV_SYN, SYN_REPORT, 0) end |
#event(code: nil, type: nil) ⇒ Object
119 120 121 122 123 |
# File 'lib/rkremap.rb', line 119 def event(code: nil, type: nil) value = EVENT_TYPE_VALUE[type] or raise "invalid type: #{type.inspect}" update_modifiers(code, value) write_event(code, value) end |
#key(code, mod = {}) ⇒ Object
127 128 129 130 131 132 |
# File 'lib/rkremap.rb', line 127 def key(code, mod={}) with_modifier(mod) do write_event(code, 1) write_event(code, 0) end end |
#match(device: nil, code: nil, type: nil, app: nil, &block) ⇒ Object
78 79 80 |
# File 'lib/rkremap.rb', line 78 def match(device: nil, code: nil, type: nil, app: nil, &block) @event_procs.push [{device: device, code: code, type: type, app: app}, block] end |
#remap(map) ⇒ Object #remap(map: , hold: nil) ⇒ Object
68 69 70 71 72 |
# File 'lib/rkremap.rb', line 68 def remap(**opts) map, hold = opts[:map], opts[:hold] map ||= opts Remap.new(self, map: map, hold: hold) end |
#start(&block) ⇒ Object
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/rkremap.rb', line 82 def start(&block) @evdev_list = EvdevList.new(@devices, auto_detect: @auto_detect, exclude: @exclude, detect_mouse: @mouse) @evdev_list.grab = @grab @evdev_list.detect_loop @mod_state = @modifiers.map.to_h{|m| [m, false]} @window_system = 'x11' if @x11 winattr = WinAttr.for(@window_system) if @window_system @events = [] while true @keys = [] event = @events.shift || @evdev_list.read_event if event.ev_type != EV_KEY if event.device.grab? @uinput.write_event(event.ev_type, event.code, event.value) end next end app = App.new(winattr) if winattr event.app = app @event_procs.each do |cond, b| synchronize{ b.call(event, @mod_state.dup, app) } if event.match?(**cond) break if event.skipped? end next if event.skipped? synchronize{ proc_event(event, app) } @keys.each do |c, mod, app_| synchronize{ block.call(c, mod, app_) } if block end end end |
#synchronize(&block) ⇒ Object
113 114 115 |
# File 'lib/rkremap.rb', line 113 def synchronize(&block) @mutex.synchronize(&block) end |
#with_modifier(mod, &block) ⇒ Object
135 136 137 138 139 140 141 142 143 |
# File 'lib/rkremap.rb', line 135 def with_modifier(mod, &block) mod_diff(mod).each do |mcode, state| write_event(mcode, state ? 1 : 0) end block.call mod_diff(mod).each_key do |mcode| write_event(mcode, @mod_state[mcode] ? 1 : 0) end end |