fix(ags player): make sure players are init correctly

This commit is contained in:
matt1432 2023-10-16 18:33:01 -04:00
parent d719d445be
commit 9c93e3dafd

View file

@ -93,9 +93,17 @@ export default () => Box({
], ],
connections: [ connections: [
[Mpris, (overlay, busName) => { [Mpris, (overlay, busName) => {
if (!busName || overlay._players.has(busName)) if (overlay._players.has(busName))
return; return;
if (!busName) {
let player = Mpris.players.find(p => !overlay._players.has(p.busName));
if (player)
busName = player.busName;
else
return;
}
const player = Mpris.getPlayer(busName); const player = Mpris.getPlayer(busName);
player.colors = Variable(); player.colors = Variable();
overlay._players.set(busName, PlayerBox(player)); overlay._players.set(busName, PlayerBox(player));