💥 ags(bar/focused-client): fix focused client with null properties
This commit is contained in:
@@ -8,7 +8,8 @@ const hyprland = AstalHyprland.get_default();
|
|||||||
export function FocusedClient(): Gtk.Widget {
|
export function FocusedClient(): Gtk.Widget {
|
||||||
return new Widget.Box({
|
return new Widget.Box({
|
||||||
className: "focused-client",
|
className: "focused-client",
|
||||||
visible: bind(hyprland, "focusedClient").as(Boolean),
|
visible: bind(hyprland, "focusedClient").as(fClient =>
|
||||||
|
!fClient ? false : (fClient?.initialClass == null ? false : true)),
|
||||||
children: bind(hyprland, "focusedClient").as(focusedClient => focusedClient ? [
|
children: bind(hyprland, "focusedClient").as(focusedClient => focusedClient ? [
|
||||||
new Widget.Icon({
|
new Widget.Icon({
|
||||||
className: "icon",
|
className: "icon",
|
||||||
@@ -29,9 +30,10 @@ export function FocusedClient(): Gtk.Widget {
|
|||||||
visible: bind(focusedClient, "class").as(Boolean),
|
visible: bind(focusedClient, "class").as(Boolean),
|
||||||
maxWidthChars: 55,
|
maxWidthChars: 55,
|
||||||
truncate: true,
|
truncate: true,
|
||||||
tooltipText: bind(focusedClient, "class").as((clientClass: string) =>
|
tooltipText: bind(focusedClient, "class").as(clientClass =>
|
||||||
clientClass.length > 55 ? clientClass : ""),
|
clientClass ?? ""),
|
||||||
label: bind(focusedClient, "class")
|
label: bind(focusedClient, "class").as(clientClass =>
|
||||||
|
clientClass ?? "no_class")
|
||||||
} as Widget.LabelProps),
|
} as Widget.LabelProps),
|
||||||
new Widget.Label({
|
new Widget.Label({
|
||||||
className: "title",
|
className: "title",
|
||||||
@@ -40,8 +42,9 @@ export function FocusedClient(): Gtk.Widget {
|
|||||||
visible: bind(focusedClient, "title").as(Boolean),
|
visible: bind(focusedClient, "title").as(Boolean),
|
||||||
truncate: true,
|
truncate: true,
|
||||||
tooltipText: bind(focusedClient, "title").as((clientTitle: string) =>
|
tooltipText: bind(focusedClient, "title").as((clientTitle: string) =>
|
||||||
clientTitle.length > 55 ? clientTitle : ""),
|
clientTitle ?? ""),
|
||||||
label: bind(focusedClient, "title")
|
label: bind(focusedClient, "title").as(title =>
|
||||||
|
title ?? "")
|
||||||
} as Widget.LabelProps)
|
} as Widget.LabelProps)
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user