dbus-send replaced by playerctl

This commit is contained in:
Simon Vieille 2018-02-07 11:15:57 +01:00
parent ce05068e7c
commit 17a95daf45
No known key found for this signature in database
GPG key ID: 919533E2B946EA10
2 changed files with 5 additions and 5 deletions

View file

@ -6,7 +6,7 @@ This project is a POC for managing a GNU/Linux desktop (with i3-wm). It implemen
* `amixer`
* `i3-msg`
* `xdotool`
* `dbus-send`
* `playerctl`
It allows you to:

View file

@ -71,15 +71,15 @@ $server->addMessageHandler('media', function (ConnectionInterface $from, array $
$value = $data['value'] ?? null;
if ($value === 'playpause') {
$cmd = 'PlayPause';
$cmd = 'play-pause';
} elseif ($value === 'next') {
$cmd = 'Next';
$cmd = 'next';
} elseif ($value === 'prev') {
$cmd = 'Previous';
$cmd = 'previous';
}
if (!empty($cmd)) {
return shell_exec('dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.'.$cmd);
return shell_exec('playerctl -p spotify '.$cmd);
}
});