fix(ags player): get rid of already disposed errors
This commit is contained in:
parent
b9807c29cf
commit
61fadfce61
1 changed files with 16 additions and 11 deletions
|
@ -1,4 +1,5 @@
|
|||
const { execAsync, lookUpIcon } = ags.Utils;
|
||||
const { Mpris } = ags.Service;
|
||||
const { Button, Icon, Label, Stack, Slider, CenterBox } = ags.Widget;
|
||||
const { Gdk } = imports.gi;
|
||||
const display = Gdk.Display.get_default();
|
||||
|
@ -34,7 +35,9 @@ export const CoverArt = (player, params) => CenterBox({
|
|||
[player, box => {
|
||||
execAsync(['bash', '-c', `[[ -f "${player.coverPath}" ]] && coloryou "${player.coverPath}"`])
|
||||
.then(out => {
|
||||
if (box) {
|
||||
if (!Mpris.players.find(p => player === p))
|
||||
return;
|
||||
|
||||
player.colors.value = JSON.parse(out);
|
||||
|
||||
box._bgStyle = `background: radial-gradient(circle,
|
||||
|
@ -45,7 +48,6 @@ export const CoverArt = (player, params) => CenterBox({
|
|||
background-position: center;`;
|
||||
if (!box.get_parent()._dragging)
|
||||
box.setStyle(box._bgStyle);
|
||||
}
|
||||
}).catch(err => { if (err !== "") print(err) });
|
||||
}],
|
||||
],
|
||||
|
@ -197,6 +199,9 @@ const PlayerButton = ({ player, items, onClick, prop }) => Button({
|
|||
}],
|
||||
|
||||
[player.colors, button => {
|
||||
if (!Mpris.players.find(p => player === p))
|
||||
return;
|
||||
|
||||
if (player.colors.value) {
|
||||
if (prop == 'playBackStatus') {
|
||||
if (button._hovered) {
|
||||
|
|
Loading…
Reference in a new issue