Class: TimeBuffer::OsaScriptAppBrowser

Inherits:
OsaScriptApp show all
Defined in:
lib/time_buffer/osa_script_app_browser.rb

Constant Summary collapse

KNOWN_BROWSERS =
%w[com.google.Chrome]

Instance Attribute Summary

Attributes inherited from OsaScriptApp

#bundle_id

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from OsaScriptApp

#name

Constructor Details

#initialize(app_bundle_id) ⇒ OsaScriptAppBrowser

Returns a new instance of OsaScriptAppBrowser.



17
18
19
# File 'lib/time_buffer/osa_script_app_browser.rb', line 17

def initialize(app_bundle_id)
  @bundle_id = app_bundle_id
end

Class Method Details

.register_known_browsersObject



9
10
11
12
13
# File 'lib/time_buffer/osa_script_app_browser.rb', line 9

def self.register_known_browsers
  KNOWN_BROWSERS.each do |bundle_id|
    OsaScriptAppBuilder.register(app_bundle_id: bundle_id, app_class: self)
  end
end

Instance Method Details

#metadataObject



21
22
23
24
25
# File 'lib/time_buffer/osa_script_app_browser.rb', line 21

def 
  {
    tab_title: tab_title
  }
end

#tab_titleObject



27
28
29
# File 'lib/time_buffer/osa_script_app_browser.rb', line 27

def tab_title
  `osascript -e 'tell application "Google Chrome" to get title of active tab of front window'`.strip
end