🔧 chore(modules/backlight): init default backlight on scan()
This commit is contained in:
@@ -57,16 +57,28 @@ export namespace Backlights {
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
if(backlights.length < 1 && this.#available === true) {
|
if(backlights.length < 1) {
|
||||||
|
if(this.#available) {
|
||||||
this.#available = false;
|
this.#available = false;
|
||||||
this.notify("available");
|
this.notify("available");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.#backlights.length < 1 && backlights.length > 0) {
|
this.#default = null;
|
||||||
|
this.notify("default");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(backlights.length > 0) {
|
||||||
|
if(this.#backlights.length < 1) {
|
||||||
this.#available = true;
|
this.#available = true;
|
||||||
this.notify("available");
|
this.notify("available");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!this.#default || !backlights.filter(bk => bk.path === this.#default?.path)[0]) {
|
||||||
|
this.#default = backlights[0];
|
||||||
|
this.notify("default");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.#backlights = backlights;
|
this.#backlights = backlights;
|
||||||
this.notify("backlights");
|
this.notify("backlights");
|
||||||
|
|
||||||
@@ -91,6 +103,9 @@ export namespace Backlights {
|
|||||||
}, this);
|
}, this);
|
||||||
}
|
}
|
||||||
public static $gtype: GObject.GType<Backlight>;
|
public static $gtype: GObject.GType<Backlight>;
|
||||||
|
declare $signals: GObject.Object.SignalSignatures & {
|
||||||
|
"brightness-changed": (value: number) => void
|
||||||
|
};
|
||||||
|
|
||||||
readonly #name: string;
|
readonly #name: string;
|
||||||
#path: string;
|
#path: string;
|
||||||
@@ -125,10 +140,6 @@ export namespace Backlights {
|
|||||||
get maxBrightness() { return this.#maxBrightness;};
|
get maxBrightness() { return this.#maxBrightness;};
|
||||||
|
|
||||||
|
|
||||||
declare $signals: GObject.Object.SignalSignatures & {
|
|
||||||
"brightness-changed": (value: number) => void
|
|
||||||
};
|
|
||||||
|
|
||||||
// intel_backlight is mostly the default on laptops
|
// intel_backlight is mostly the default on laptops
|
||||||
constructor(name: string = "intel_backlight") {
|
constructor(name: string = "intel_backlight") {
|
||||||
super();
|
super();
|
||||||
|
|||||||
Reference in New Issue
Block a user