Fix media status tracking
This commit is contained in:
@@ -10,6 +10,11 @@ const Media = () => {
|
|||||||
Stopped: 3,
|
Stopped: 3,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (value.players.length === 0) {
|
||||||
|
activePlayer.value = mpris.players[0];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const isPlaying = value.players.find(
|
const isPlaying = value.players.find(
|
||||||
(p) => p["play-back-status"] === "Playing",
|
(p) => p["play-back-status"] === "Playing",
|
||||||
);
|
);
|
||||||
@@ -44,20 +49,18 @@ const Media = () => {
|
|||||||
|
|
||||||
const songIcon = Variable("");
|
const songIcon = Variable("");
|
||||||
|
|
||||||
const label = Utils.watch(
|
const label = Utils.watch(" No media playing ", mpris, "changed", () => {
|
||||||
" No media playing ",
|
|
||||||
mpris,
|
|
||||||
"player-changed",
|
|
||||||
() => {
|
|
||||||
if (activePlayer.value) {
|
if (activePlayer.value) {
|
||||||
const { track_title, identity } = activePlayer.value;
|
const { track_title, identity } = activePlayer.value;
|
||||||
songIcon.value = getIconForPlayer(identity);
|
songIcon.value = getIconForPlayer(identity);
|
||||||
return track_title.length === 0 ? ` No media playing...` : ` ${track_title}`;
|
return track_title.length === 0
|
||||||
|
? ` No media playing...`
|
||||||
|
: ` ${track_title}`;
|
||||||
} else {
|
} else {
|
||||||
|
songIcon.value = "";
|
||||||
return " No media playing ";
|
return " No media playing ";
|
||||||
}
|
}
|
||||||
},
|
});
|
||||||
);
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
component: Widget.Box({
|
component: Widget.Box({
|
||||||
|
|||||||
Reference in New Issue
Block a user