Class: Xdotool::Adapter
- Inherits:
-
Object
- Object
- Xdotool::Adapter
- Defined in:
- lib/xdotool/adapter.rb
Overview
Xdotool adapter for mouse control
Instance Method Summary collapse
-
#initialize ⇒ Adapter
constructor
:nodoc: all.
- #left_click(position) ⇒ Object
- #position ⇒ Object
- #right_click(position) ⇒ Object
Constructor Details
#initialize ⇒ Adapter
:nodoc: all
9 10 11 12 |
# File 'lib/xdotool/adapter.rb', line 9 def initialize result = Kernel.system('xdotool version') raise BaseError if result.nil? end |
Instance Method Details
#left_click(position) ⇒ Object
20 21 22 |
# File 'lib/xdotool/adapter.rb', line 20 def left_click(position) Kernel.system("xdotool mousemove #{position[:x]} #{position[:y]} click 1") end |
#position ⇒ Object
14 15 16 17 18 |
# File 'lib/xdotool/adapter.rb', line 14 def position output = IO.popen('xdotool getmouselocation', &:read) PositionParser.parse(output) end |
#right_click(position) ⇒ Object
24 25 26 |
# File 'lib/xdotool/adapter.rb', line 24 def right_click(position) Kernel.system("xdotool mousemove #{position[:x]} #{position[:y]} click 3") end |