瀏覽代碼

Add Firefox MPRIS Playback Status Script

Get the playback status from Firefox via the MPRIS D-Bus interface
master
Nate Bohman 4 年之前
父節點
當前提交
cb44f029e4
簽署人: Nate Bohman <natrinicle@gmail.com> GPG Key ID: C10546A54ABA1CE5
共有 1 個文件被更改,包括 11 次插入0 次删除
  1. +11
    -0
      mpris_firefox_playstatus.sh

+ 11
- 0
mpris_firefox_playstatus.sh 查看文件

@@ -0,0 +1,11 @@
#!/usr/bin/env bash

firefox_mpris_dbus=$(dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.ListNames | grep -Po "org.mpris.*firefox[^\"]+")

if [ -n $firefox_mpris_dbus ]; then
playback_string=$(dbus-send --print-reply --dest=${firefox_mpris_dbus} /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'PlaybackStatus' | grep -Po "(?<=string \")[^\"]+")

echo "Firefox MPRIS Instance ${firefox_mpris_dbus} has playback status ${playback_string}"
else
echo "Firefox MPRIS Instance not found!"
fi

Loading…
取消
儲存