diff --git a/config/ags/apps/settings/wallpapers.ts b/config/ags/apps/settings/wallpapers.ts index 8397e4b2..8ccc347b 100644 --- a/config/ags/apps/settings/wallpapers.ts +++ b/config/ags/apps/settings/wallpapers.ts @@ -112,6 +112,28 @@ const Wallpaper = (image: string, name: string) => Widget.Button({ }) }); +function CacheThumbnails() { + Utils.execAsync(`mkdir -p ${GLib.get_home_dir()}/.cache/thumbnails/wallpaper`) + .catch(print) + const link_directory = `${App.configDir}/wallpaper`; + const original_directory = `${GLib.get_home_dir()}/wallpaper`; + const extensions = [".jpg", ".jpeg", ".png"]; + const fileList = listFilesByExtensions(link_directory, extensions); + fileList.forEach((value, index) => { + const path = `${original_directory}/${value}` + const cache_file = `${GLib.get_home_dir()}/.cache/thumbnails/wallpaper/${value}`; + Utils.idle(() => { + Utils.readFileAsync(cache_file) + .catch(() => { + Utils.execAsync(`magick ${path} -resize x32 -gravity Center -extent 1:1 ${cache_file}`) + .catch(print) + }) + }) + }) +} + +CacheThumbnails() + const WallpaperList = () => { Utils.execAsync(`mkdir -p ${GLib.get_home_dir()}/.cache/thumbnails/wallpaper`) .then(); @@ -140,9 +162,7 @@ const WallpaperList = () => { ] }); - Utils.interval(30000, () => { - box.attribute.update(box); - }, box); + box.attribute.update(box) return box; }; diff --git a/config/ags/style-apps.css b/config/ags/style-apps.css index 90fae956..42a8da05 100644 --- a/config/ags/style-apps.css +++ b/config/ags/style-apps.css @@ -138,6 +138,18 @@ border-color: @outlineVariant; } +.settings entry, .settings combobox { + min-width: 30px; + min-height: 32px; + border-radius: 4px; + background-color: @surfaceContainerHighest; +} + +.settings entry label, .settings combobox label { + color: @onSurface; + font-weight: normal; +} + /* Wifi */ .settings .wifi_list .row image { diff --git a/config/ags/variables.ts b/config/ags/variables.ts index 25b84efc..30749eac 100644 --- a/config/ags/variables.ts +++ b/config/ags/variables.ts @@ -17,7 +17,8 @@ export const icons = { }; -const wallpaper_cache_file = `${GLib.get_home_dir()}/.cache/current_wallpaper` +export const wallpaper_cache_file = `${GLib.get_home_dir()}/.cache/current_wallpaper` + Utils.readFileAsync(wallpaper_cache_file) .then(out => { current_wallpaper.setValue(out.trim()); }) .catch(err => {