Class: Spty::Command::ToggleCommand

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

Constant Summary collapse

ASCRIPT_PLAYER_TOGGLE =

Toggle player play / pause

<<-EOL
  tell application "Spotify" to playpause
EOL

Constants inherited from BaseCommand

BaseCommand::ASCRIPT_PLAYER_DETECT

Class Method Summary collapse

Methods inherited from BaseCommand

running?

Class Method Details

.call(_, command = 'toggle') ⇒ Object



7
8
9
10
11
12
# File 'lib/spty/commands/toggle_command.rb', line 7

def self.call(_, command = 'toggle')
  return unless running?

  Spty::AppleScriptRunner.(ASCRIPT_PLAYER_TOGGLE)
  Spty::Command::StateCommand.(nil, command)
end