Module: Moodswings::Platform::OSX

Defined in:
lib/moodswings/platform/osx.rb

Instance Method Summary collapse

Instance Method Details

#close_app(app_name) ⇒ Object



26
27
28
29
30
31
32
33
# File 'lib/moodswings/platform/osx.rb', line 26

def close_app(app_name)
  system(
    "osascript " \
    "-e \'tell application \"#{app_name}\"\' " \
    "-e \'quit\' " \
    "-e \'end tell\'"
  )
end

#desktop_background(filepath) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/moodswings/platform/osx.rb', line 7

def desktop_background(filepath)
  path = File.expand_path(filepath)
  system(
    "osascript " \
    "-e \'tell application \"Finder\"\' " \
    "-e \'set the desktop picture to POSIX file \"#{path}\"\' " \
    "-e \'end tell \'"
  )
end

#open_app(app_name) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/moodswings/platform/osx.rb', line 17

def open_app(app_name)
  system(
    "osascript " \
    "-e \'tell application \"#{app_name}\"\' " \
    "-e \'activate\' " \
    "-e \'end tell\'"
  )
end