#!/usr/bin/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'),
    ]
);
Insérer
<div%key%id="gist-5c87a60670ddf-0675700f70101c7c0c33765e49f37db05b81e2fa" class="gist-container"></div>
<script src="https://gist.deblan.org/fr/embedjs/5c87a60670ddf" async></script>