💥 fix(modules/wallpaper): add module-specific scope
This commit is contained in:
@@ -7,6 +7,7 @@ import GLib from "gi://GLib?version=2.0";
|
||||
import { createSubscription, encoder } from "./utils";
|
||||
import { Notifications } from "./notifications";
|
||||
import { generalConfig } from "../config";
|
||||
import { createRoot, getScope, Scope } from "ags";
|
||||
|
||||
|
||||
export { Wallpaper };
|
||||
@@ -50,6 +51,7 @@ export type WallpaperPositioning = "contain"|"tile"|"cover";
|
||||
class Wallpaper extends GObject.Object {
|
||||
private static instance: Wallpaper;
|
||||
#wallpaper: (string|undefined);
|
||||
#scope!: Scope;
|
||||
#splash: boolean = true;
|
||||
#hyprpaperFile: Gio.File;
|
||||
#wallpapersPath: string;
|
||||
@@ -70,8 +72,8 @@ class Wallpaper extends GObject.Object {
|
||||
|
||||
public get wallpapersPath() { return this.#wallpapersPath; }
|
||||
|
||||
@property(gtype<WallpaperMode>(String))
|
||||
positioning: WallpaperMode = "cover";
|
||||
@property(gtype<WallpaperPositioning>(String))
|
||||
positioning: WallpaperPositioning = "cover";
|
||||
|
||||
@property(gtype<WalMode>(String))
|
||||
colorMode: WalMode = "darken";
|
||||
@@ -89,6 +91,9 @@ class Wallpaper extends GObject.Object {
|
||||
if(wall?.trim()) this.#wallpaper = wall.trim();
|
||||
});
|
||||
|
||||
createRoot(() => {
|
||||
this.#scope = getScope();
|
||||
|
||||
createSubscription(
|
||||
generalConfig.bindProperty("wallpaper.color_mode", "string"),
|
||||
() => {
|
||||
@@ -135,6 +140,11 @@ class Wallpaper extends GObject.Object {
|
||||
);
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
vfunc_dispose(): void {
|
||||
this.#scope?.dispose();
|
||||
}
|
||||
|
||||
public static getDefault(): Wallpaper {
|
||||
|
||||
Reference in New Issue
Block a user