Module: OnlyofficeFileHelper::XdotoolHelper

Included in:
LinuxHelper
Defined in:
lib/onlyoffice_file_helper/linux_helper/xdotool_helper.rb

Overview

Class for working with Xdotool Performs actions with x-system

Instance Method Summary collapse

Instance Method Details

#find_window_id(window_title) ⇒ Fixnum

Get window id by it’s title

Returns:

  • (Fixnum)

    id of window



9
10
11
# File 'lib/onlyoffice_file_helper/linux_helper/xdotool_helper.rb', line 9

def find_window_id(window_title)
  `xdotool search '#{window_title}'`.to_i
end

#send_button_to_window(window_title, button) ⇒ Nothing

Send button to specific window

Parameters:

  • window_title (String)

    title of window to close

  • button (String)

    button to send

Returns:

  • (Nothing)


17
18
19
20
# File 'lib/onlyoffice_file_helper/linux_helper/xdotool_helper.rb', line 17

def send_button_to_window(window_title, button)
  window_id = find_window_id(window_title)
  `xdotool key --window #{window_id} #{button}`
end