💥 ags: fix startup issues (and with that, errors with focusedClient bar widget)

This commit is contained in:
retrozinndev
2025-02-04 21:45:18 -03:00
parent 11f919ab1d
commit 80969071c4
21 changed files with 363 additions and 200 deletions
+44
View File
@@ -0,0 +1,44 @@
import { bind } from "astal";
import { Gtk, Widget } from "astal/gtk3";
import AstalHyprland from "gi://AstalHyprland";
import { getAppIcon } from "../../scripts/apps";
const hyprland = AstalHyprland.get_default();
export function FocusedWindow() {
return new Widget.Box({
className: "focused-window",
visible: bind(hyprland, "focusedClient").as(Boolean),
children: [
new Widget.Icon({
className: "icon",
icon: bind(hyprland, "focusedClient").as((client: AstalHyprland.Client) =>
client ?
(getAppIcon(client.initialClass) || client.initialClass)
:
"image-missing"
),
iconSize: Gtk.IconSize.SMALL_TOOLBAR
}),
new Widget.Box({
className: "text-content",
orientation: Gtk.Orientation.VERTICAL,
homogeneous: false,
children: [
new Widget.Label({
className: "class",
xalign: 0,
label: bind(hyprland, "focusedClient").as((client: AstalHyprland.Client) =>
client ? client.class : "")
} as Widget.LabelProps),
new Widget.Label({
className: "title",
xalign: 0,
label: bind(hyprland, "focusedClient").as((client: AstalHyprland.Client) =>
client ? client.title : "")
} as Widget.LabelProps)
]
})
]
} as Widget.BoxProps);
}