From b2ac299f058e86feeed3608c663a471e3209df04 Mon Sep 17 00:00:00 2001 From: matt1432 Date: Fri, 22 Sep 2023 12:24:20 -0400 Subject: [PATCH] feat(ags): open players by default if there's at least one at launch --- config/ags/js/quick-settings/main.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/config/ags/js/quick-settings/main.js b/config/ags/js/quick-settings/main.js index cef19033..1b7c5068 100644 --- a/config/ags/js/quick-settings/main.js +++ b/config/ags/js/quick-settings/main.js @@ -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);");