29 lines
615 B
PHP
Executable file
29 lines
615 B
PHP
Executable file
#!/usr/bin/env php
|
|
<?php
|
|
|
|
require __DIR__.'/base/block.php';
|
|
|
|
$status = trim(shell_exec('playerctl -p spotify status'));
|
|
|
|
if ($status === 'Playing') {
|
|
$fullText = pemoji(0xf04c);
|
|
} elseif ($status === 'Paused') {
|
|
$fullText = pemoji(0xf04b);
|
|
}
|
|
|
|
if (empty($fullText)) {
|
|
die(0);
|
|
}
|
|
|
|
if (getenv('BLOCK_BUTTON') === '1') {
|
|
shell_exec('dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause');
|
|
}
|
|
|
|
echo block(
|
|
'spotify_ctrl',
|
|
[
|
|
'full_text' => span($fullText, '#ccc', '#000'),
|
|
'color' => color('music'),
|
|
]
|
|
);
|