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: [
[Mpris, (overlay, busName) => {
if (!busName || overlay._players.has(busName))
if (overlay._players.has(busName))
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);
player.colors = Variable();
overlay._players.set(busName, PlayerBox(player));