diff --git a/ags/window/CenterWindow.ts b/ags/window/CenterWindow.ts index 46d6954..aa74f5b 100644 --- a/ags/window/CenterWindow.ts +++ b/ags/window/CenterWindow.ts @@ -1,10 +1,11 @@ import { Gtk, Widget } from "astal/gtk3"; -import { GLib } from "astal"; +import { bind, GLib } from "astal"; import { getDateTime } from "../scripts/time"; import { Separator, SeparatorProps } from "../widget/Separator"; import { PopupWindow, PopupWindowProps } from "../widget/PopupWindow"; import { BigMedia } from "../widget/center-window/BigMedia"; +import AstalMpris from "gi://AstalMpris?version=0.1"; export const CenterWindow = (mon: number) => PopupWindow({ className: "center-window-container", @@ -49,18 +50,28 @@ export const CenterWindow = (mon: number) => PopupWindow({ } as Widget.BoxProps) ] } as Widget.BoxProps), - Separator({ - orientation: Gtk.Orientation.HORIZONTAL, - alpha: .5, - cssColor: "gray", - size: 1 - } as SeparatorProps), - new Widget.Box({ - className: "vertical right", - orientation: Gtk.Orientation.VERTICAL, - children: [ - BigMedia() - ] - } as Widget.BoxProps) + new Widget.Revealer({ + revealChild: bind(AstalMpris.get_default(), "players").as(players => + players.filter(player => player.available).length > 0), + transitionDuration: 220, + transitionType: Gtk.RevealerTransitionType.SLIDE_RIGHT, + child: new Widget.Box({ + children: [ + Separator({ + orientation: Gtk.Orientation.HORIZONTAL, + alpha: .5, + cssColor: "gray", + size: 1 + } as SeparatorProps), + new Widget.Box({ + className: "vertical right", + orientation: Gtk.Orientation.VERTICAL, + children: [ + BigMedia() + ] + } as Widget.BoxProps) + ] + } as Widget.BoxProps) + } as Widget.RevealerProps) ] } as PopupWindowProps);