Class: Spty::Command::LaunchCommand

Inherits:
BaseCommand show all
Defined in:
lib/spty/commands/launch_command.rb

Constant Summary collapse

ASCRIPT_PLAYER_LAUNCH =
<<-EOL
  tell application "Spotify" to activate
EOL

Constants inherited from BaseCommand

BaseCommand::ASCRIPT_PLAYER_DETECT

Class Method Summary collapse

Methods inherited from BaseCommand

running?

Class Method Details

.call(_, _command = 'launch') ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/spty/commands/launch_command.rb', line 7

def self.call(_, _command = 'launch')
  if running?(show_mesg: false)
    puts 'Spotify player is running'
    return
  end

  Spty::AppleScriptRunner.(ASCRIPT_PLAYER_LAUNCH)
  puts 'launching Spotify player'
end