diff --git a/src/modules/backlight.ts b/src/modules/backlight.ts index fa81f9b..fac9e18 100644 --- a/src/modules/backlight.ts +++ b/src/modules/backlight.ts @@ -7,11 +7,17 @@ import Gio from "gi://Gio?version=2.0"; export namespace Backlights { + const BacklightsParamSpec = (name: string, flags: GObject.ParamFlags) => + GObject.ParamSpec.object(name, null, null, flags) as ParamSpec; + + const BacklightParamSpec = (name: string, flags: GObject.ParamFlags) => + GObject.ParamSpec.object(name, null, null, flags) as ParamSpec; + let instance: Backlights; export function getDefault(): Backlights { if(!instance) - instance = new Backlights; + instance = new Backlights(); return instance; } @@ -22,7 +28,6 @@ export namespace Backlights { GTypeName: "Backlights" }, this); } - public static $gtype: GObject.GType; #backlights: Array = []; @@ -33,8 +38,8 @@ export namespace Backlights { @getter(Array as unknown as ParamSpec>) get backlights() { return this.#backlights; } - @getter(GObject.Object as unknown as ParamSpec) - get default() { return this.#default; } + @getter(BacklightParamSpec) + get default() { return this.#default!; } /** true if there are any backlights available */ @getter(Boolean) @@ -102,7 +107,8 @@ export namespace Backlights { GTypeName: "Backlight" }, this); } - public static $gtype: GObject.GType; + + declare $signals: GObject.Object.SignalSignatures & { "brightness-changed": (value: number) => void };