Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions files/usr/share/cinnamon/applets/sound@cinnamon.org/applet.js
Original file line number Diff line number Diff line change
Expand Up @@ -650,10 +650,11 @@ class Player extends PopupMenu.PopupMenuSection {
this._name = props.Identity.unpack();
this._applet._updatePlayerMenuItems();
}
if (props.CanRaise) {
// The properties are GVariants, so check the unpacked value.
if (props.CanRaise && props.CanRaise.unpack()) {
this._showCanRaise();
}
if (props.CanQuit) {
if (props.CanQuit && props.CanQuit.unpack()) {
this._showCanQuit();
}
if (props.DesktopEntry) {
Expand All @@ -670,7 +671,11 @@ class Player extends PopupMenu.PopupMenuSection {
}

_showCanRaise() {
let btn = new ControlButton("xsi-go-up", _("Open Player"), () => {
// PropertiesChanged can carry CanRaise many times; add the button only once.
if (this._raiseButton)
return;

this._raiseButton = new ControlButton("xsi-go-up", _("Open Player"), () => {
if (this._name.toLowerCase() === "spotify") {
// Spotify isn't able to raise via Dbus once its main UI is closed
Util.spawn(['spotify']);
Expand All @@ -680,15 +685,18 @@ class Player extends PopupMenu.PopupMenuSection {
}
this._applet.menu.close();
}, true);
this._playerBox.add_actor(btn.actor);
this._playerBox.add_actor(this._raiseButton.actor);
}

_showCanQuit() {
let btn = new ControlButton("xsi-window-close", _("Quit Player"), () => {
if (this._quitButton)
return;

this._quitButton = new ControlButton("xsi-window-close", _("Quit Player"), () => {
this._mediaServer.QuitRemote();
this._applet.menu.close();
}, true);
this._playerBox.add_actor(btn.actor);
this._playerBox.add_actor(this._quitButton.actor);
}

_setName(status) {
Expand Down
Loading