Skip to content

Instantly share code, notes, and snippets.

@wallacesilva
Created January 25, 2018 18:04
Show Gist options
  • Save wallacesilva/07b7e13e59433fd1cbf832bd6849e7cf to your computer and use it in GitHub Desktop.
Save wallacesilva/07b7e13e59433fd1cbf832bd6849e7cf to your computer and use it in GitHub Desktop.
Shell Script to play/pause multiple media players
#!/bin/bash
is_started()
{
qtd=$(ps aux | grep $1 | wc -l)
if test "$qtd" = 1
then
return 0
else
$2
fi
}
# Audacious
is_started audacious 'audacious --play-pause'
# Guayadeque
is_started guayadeque 'dbus-send --print-reply --type=method_call --dest=org.mpris.guayadeque /Player org.freedesktop.MediaPlayer.Pause'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment