summaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-02-11 20:58:53 +1100
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-02-11 20:58:53 +1100
commit0274360617a23daf81fb2baf85a1bfebe2b395e8 (patch)
treedeb120fa844e7aef9a06238b9a2884c32797016a /src/utils
parenttooltip: position at cursor not widget (diff)
downloadcaelestia-shell-0274360617a23daf81fb2baf85a1bfebe2b395e8.tar.gz
caelestia-shell-0274360617a23daf81fb2baf85a1bfebe2b395e8.tar.bz2
caelestia-shell-0274360617a23daf81fb2baf85a1bfebe2b395e8.zip
refactor: astal widget type
There is no base type, but the return type of astalify works
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/types.ts3
-rw-r--r--src/utils/widgets.ts7
2 files changed, 7 insertions, 3 deletions
diff --git a/src/utils/types.ts b/src/utils/types.ts
index 9a44e51..d2c1943 100644
--- a/src/utils/types.ts
+++ b/src/utils/types.ts
@@ -1,5 +1,8 @@
+import type { astalify } from "astal/gtk3";
import type AstalHyprland from "gi://AstalHyprland";
+export type AstalWidget = InstanceType<ReturnType<typeof astalify>>;
+
export type Address = `0x${string}`;
export interface Client {
diff --git a/src/utils/widgets.ts b/src/utils/widgets.ts
index fe7ff3e..c6f0f19 100644
--- a/src/utils/widgets.ts
+++ b/src/utils/widgets.ts
@@ -1,8 +1,9 @@
import { Binding, register } from "astal";
import { Astal, astalify, Gtk, Widget, type ConstructProps } from "astal/gtk3";
import AstalHyprland from "gi://AstalHyprland";
+import type { AstalWidget } from "./types";
-export const setupCustomTooltip = (self: any, text: string | Binding<string>) => {
+export const setupCustomTooltip = (self: AstalWidget, text: string | Binding<string>) => {
if (!text) return null;
const window = new Widget.Window({
@@ -27,7 +28,7 @@ export const setupCustomTooltip = (self: any, text: string | Binding<string>) =>
window.marginLeft = marginLeft;
});
- if (text instanceof Binding) self.hook(text, (_: any, v: string) => !v && window.hide());
+ if (text instanceof Binding) self.hook(text, (_, v) => !v && window.hide());
self.connect("query-tooltip", () => {
if (text instanceof Binding && !text.get()) return false;
@@ -54,7 +55,7 @@ export const setupCustomTooltip = (self: any, text: string | Binding<string>) =>
return window;
};
-export const setupChildClickthrough = (self: any) =>
+export const setupChildClickthrough = (self: AstalWidget) =>
self.connect("size-allocate", () => self.get_window()?.set_child_input_shapes());
@register()