class XDo::Keyboard
The keyboard state for a libxdo context.
Attributes
xdo[RW]
The XDo
context that produced the window.
Public Class Methods
new(xdo)
click to toggle source
Creates a keyboard state wrapper for an XDo
context.
This constructor is called internally by XDo#keyboard and client code should not need to call it directly.
Args:
xdo:: the XDo wrapping a libxdo context
# File lib/x_do/keyboard.rb, line 13 def initialize(xdo) @xdo = xdo @_xdo_pointer = xdo._pointer end
Public Instance Methods
press_keysequence(keysequence, delay = 0.012)
click to toggle source
Presses a keysequence in the active window.
Examples: “alt+Return”, “Alt_L+Tab”, “l”, “semicolon”
# File lib/x_do/keyboard.rb, line 37 def press_keysequence(keysequence, delay = 0.012) XDo::FFILib.xdo_send_keysequence_window_down @_xdo_pointer, 0, keysequence, (delay * 1_000_000).to_i end
release_keysequence(keysequence, delay = 0.012)
click to toggle source
Releases a keysequence in the active window.
Examples: “alt+Return”, “Alt_L+Tab”, “l”, “semicolon”
# File lib/x_do/keyboard.rb, line 45 def release_keysequence(keysequence, delay = 0.012) XDo::FFILib.xdo_send_keysequence_window_up @_xdo_pointer, 0, keysequence, (delay * 1_000_000).to_i end
type_keysequence(keysequence, delay = 0.012)
click to toggle source
Sends a keysequence to the active window.
Examples: “alt+Return”, “Alt_L+Tab”, “l”, “semicolon”
# File lib/x_do/keyboard.rb, line 29 def type_keysequence(keysequence, delay = 0.012) XDo::FFILib.xdo_send_keysequence_window @_xdo_pointer, 0, keysequence, (delay * 1_000_000).to_i end
type_string(string, delay = 0.012)
click to toggle source
Types a string into the current window.
# File lib/x_do/keyboard.rb, line 22 def type_string(string, delay = 0.012) XDo::FFILib.xdo_enter_text_window @_xdo_pointer, 0, string, (delay * 1_000_000).to_i end