fix: crashing when no focused client is available

This commit is contained in:
tux
2025-09-25 13:27:51 +05:30
parent e09d781605
commit 7588a374e5

View File

@@ -1,4 +1,4 @@
import { createBinding, createComputed } from "ags"; import { createBinding, createComputed, With } from "ags";
import { Gdk, Gtk } from "ags/gtk4"; import { Gdk, Gtk } from "ags/gtk4";
import AstalHyprland from "gi://AstalHyprland"; import AstalHyprland from "gi://AstalHyprland";
@@ -48,8 +48,10 @@ export const FocusedClient = () => {
const focused = createBinding(hyprland, "focusedClient"); const focused = createBinding(hyprland, "focusedClient");
return ( return (
<box cssClasses={["focused-client"]} visible={focused.as(Boolean)}> <box cssClasses={["focused-client"]}>
<label label={focused((client) => client.title)} /> <With value={focused}>
{(client) => client && <label label={createBinding(client, "title")} />}
</With>
</box> </box>
); );
}; };