feat(ags): open players by default if there's at least one at launch
This commit is contained in:
parent
d82b3cb765
commit
b2ac299f05
1 changed files with 8 additions and 2 deletions
|
@ -1,5 +1,5 @@
|
|||
const { Window, CenterBox, Box, Label, Revealer, Icon } = ags.Widget;
|
||||
const { closeWindow } = ags.App;
|
||||
const { Window, Box, Label, Revealer, Icon } = ags.Widget;
|
||||
const { Mpris } = ags.Service;
|
||||
const { ToggleButton } = imports.gi.Gtk;
|
||||
|
||||
import { ButtonGrid } from './button-grid.js';
|
||||
|
@ -32,6 +32,12 @@ const QuickSettingsWidget = Box({
|
|||
EventBox({
|
||||
child: ags.Widget({
|
||||
type: ToggleButton,
|
||||
setup: btn => {
|
||||
const id = Mpris.instance.connect('changed', () => {
|
||||
btn.set_active(Mpris.players.length > 0);
|
||||
Mpris.instance.disconnect(id);
|
||||
});
|
||||
},
|
||||
connections: [['toggled', button => {
|
||||
if (button.get_active()) {
|
||||
button.child.setStyle("-gtk-icon-transform: rotate(0deg);");
|
||||
|
|
Loading…
Reference in a new issue