very very small refractor

This commit is contained in:
end-4
2024-02-19 20:20:40 +07:00
parent 3cc8c3b7d8
commit f089d834c6
+3 -1
View File
@@ -3,6 +3,8 @@ import Service from 'resource:///com/github/Aylur/ags/service.js';
import * as Utils from 'resource:///com/github/Aylur/ags/utils.js';
const { exec, execAsync } = Utils;
const WALLPAPER_CONFIG_PATH = `${GLib.get_user_cache_dir()}/ags/user/wallpaper.json`;
const clamp = (num, min, max) => Math.min(Math.max(num, min), max);
function fileExists(filePath) {
let file = Gio.File.new_for_path(filePath);
@@ -53,7 +55,7 @@ class WallpaperService extends Service {
// How many screens?
this._monitorCount = Gdk.Display.get_default()?.get_n_monitors() || 1;
// Read config
this._wallPath = `${GLib.get_user_cache_dir()}/ags/user/wallpaper.json`;
this._wallPath = WALLPAPER_CONFIG_PATH;
try {
const fileContents = Utils.readFile(this._wallPath);
this._wallJson = JSON.parse(fileContents);