Class: OSX

Inherits:
Object
  • Object
show all
Defined in:
lib/osx.rb

Class Method Summary collapse

Class Method Details

.[](app_name) ⇒ Object



15
16
17
# File 'lib/osx.rb', line 15

def [](app_name)
  system_events.application_processes[app_name]
end

.desktop_heightObject



31
32
33
# File 'lib/osx.rb', line 31

def desktop_height
  desktop_size[3]
end

.desktop_sizeObject



23
24
25
# File 'lib/osx.rb', line 23

def desktop_size
  @desktop_size ||= Finder.desktop.window.bounds.get
end

.desktop_widthObject



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

def desktop_width
  desktop_size[2]
end

.hide_everythingObject



3
4
5
# File 'lib/osx.rb', line 3

def hide_everything
  system_events.keystroke("h", :using => [ :command_down, :option_down ])
end

.open_location(*args) ⇒ Object



7
8
9
# File 'lib/osx.rb', line 7

def open_location(*args)
  args.each { |url| system_events.open_location(url) }
end

.running_applicationsObject



19
20
21
# File 'lib/osx.rb', line 19

def running_applications
  system_events.application_processes.get.collect { |a| a.name.get }
end

.system_eventsObject



11
12
13
# File 'lib/osx.rb', line 11

def system_events
  @system_events ||= Appscript.app("System Events")
end