diff --git a/ags/widget/control-center/QuickActions.ts b/ags/widget/control-center/QuickActions.ts index 502a388..88b5e22 100644 --- a/ags/widget/control-center/QuickActions.ts +++ b/ags/widget/control-center/QuickActions.ts @@ -4,9 +4,6 @@ import AstalHyprland from "gi://AstalHyprland"; import { Windows } from "../../windows"; import { Wallpaper } from "../../scripts/wallpaper"; -const uptime = new Variable("Just turned on").poll(1000, - () => exec("uptime -p").replace(/^up /, "") -); function LockButton(): Widget.Button { return new Widget.Button({ @@ -60,41 +57,47 @@ function LogoutButton(): Widget.Button { } as Widget.ButtonProps); } -export const QuickActions = () => new Widget.Box({ - className: "quickactions", - children: [ - new Widget.Box({ - orientation: Gtk.Orientation.VERTICAL, - halign: Gtk.Align.START, - hexpand: true, - className: "left", - children: [ - new Widget.Label({ - className: "hostname", - xalign: 0, - tooltipText: "Host name", - label: GLib.get_host_name() - } as Widget.LabelProps), - new Widget.Label({ - className: "uptime", - xalign: 0, - tooltipText: "Uptime", - label: uptime().as((uptime: string) => `󰥔 ${uptime}`) - } as Widget.LabelProps) - ] - } as Widget.BoxProps), - new Widget.Box({ - orientation: Gtk.Orientation.HORIZONTAL, - className: "right button-row", - halign: Gtk.Align.END, - hexpand: true, - children: [ - LockButton(), - ColorPickerButton(), - ScreenshotButton(), - SelectWallpaperButton(), - LogoutButton() - ] - } as Widget.BoxProps) - ] -} as Widget.BoxProps); +export const QuickActions = () => { + const uptime = new Variable("Just turned on").poll(1000, + () => exec("uptime -p").replace(/^up /, "")); + + return new Widget.Box({ + className: "quickactions", + children: [ + new Widget.Box({ + orientation: Gtk.Orientation.VERTICAL, + halign: Gtk.Align.START, + hexpand: true, + className: "left", + children: [ + new Widget.Label({ + className: "hostname", + xalign: 0, + tooltipText: "Host name", + label: GLib.get_host_name() + } as Widget.LabelProps), + new Widget.Label({ + className: "uptime", + xalign: 0, + tooltipText: "Uptime", + onDestroy: () => uptime.drop(), + label: uptime().as((uptime: string) => `󰥔 ${uptime}`) + } as Widget.LabelProps) + ] + } as Widget.BoxProps), + new Widget.Box({ + orientation: Gtk.Orientation.HORIZONTAL, + className: "right button-row", + halign: Gtk.Align.END, + hexpand: true, + children: [ + LockButton(), + ColorPickerButton(), + ScreenshotButton(), + SelectWallpaperButton(), + LogoutButton() + ] + } as Widget.BoxProps) + ] + } as Widget.BoxProps); +} diff --git a/ags/widget/control-center/pages/Sound.ts b/ags/widget/control-center/pages/Sound.ts index 0bf6712..dc4aa84 100644 --- a/ags/widget/control-center/pages/Sound.ts +++ b/ags/widget/control-center/pages/Sound.ts @@ -33,6 +33,8 @@ export function PageSound(): Page { new Widget.Label({ className: "sub-header", label: tr("apps"), + visible: endpoints.filter((ep) => ep.mediaClass === AstalWp.MediaClass.AUDIO_STREAM || + ep.mediaClass === AstalWp.MediaClass.VIDEO_STREAM).length > 0, setup: (self) => self.set_alignment(0, .5) } as Widget.LabelProps), ...endpoints.filter((ep) => ep.mediaClass === AstalWp.MediaClass.AUDIO_STREAM || diff --git a/ags/widget/control-center/tiles/Tile.ts b/ags/widget/control-center/tiles/Tile.ts index c84e8c0..9ea2371 100644 --- a/ags/widget/control-center/tiles/Tile.ts +++ b/ags/widget/control-center/tiles/Tile.ts @@ -53,7 +53,6 @@ export function Tile(props: TileProps): (() => Gtk.Widget) { onClick: () => { if(toggled.get()) { toggled.set(false); - console.log(toggled.get()); props.onToggledOff && props.onToggledOff(); return; }