From 8f3b369e862b0efb22c63824bb8f65b247aaa207 Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Sun, 16 Mar 2025 17:23:19 +1100 Subject: launcher: fix wallpaper categories compact mode Also fix undef errors for wallpapers and scheme --- src/modules/launcher/actions.tsx | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/modules/launcher/actions.tsx b/src/modules/launcher/actions.tsx index 446f411..053387c 100644 --- a/src/modules/launcher/actions.tsx +++ b/src/modules/launcher/actions.tsx @@ -5,7 +5,7 @@ import Wallpapers, { type ICategory, type IWallpaper } from "@/services/wallpape import { basename } from "@/utils/strings"; import { notify } from "@/utils/system"; import { setupCustomTooltip, type FlowBox } from "@/utils/widgets"; -import { execAsync, GLib, readFile, register, type Variable } from "astal"; +import { bind, execAsync, GLib, readFile, register, type Variable } from "astal"; import { Gtk, Widget } from "astal/gtk3"; import { launcher as config } from "config"; import fuzzysort from "fuzzysort"; @@ -313,11 +313,20 @@ const Category = ({ path, wallpapers }: ICategory) => ( vertical={config.wallpaper.style.get() !== "compact"} className={`wallpaper ${config.wallpaper.style.get()}`} > - - {wallpapers.slice(0, 3).map(w => ( - - ))} - + {bind(config.wallpaper.style).as(s => + s === "compact" ? ( + + ) : ( + + {wallpapers.slice(0, 3).map(w => ( + + ))} + + ) + )} @@ -365,7 +374,7 @@ export default class Actions extends Widget.Box implements LauncherContent { } } } else if (action === "wallpaper") { - const random = args[1].toLowerCase() === "random"; + const random = args[1]?.toLowerCase() === "random"; const term = (random ? args[2] : args[1]) ?? ""; const list = random ? Wallpapers.get_default().categories : Wallpapers.get_default().list; @@ -384,7 +393,7 @@ export default class Actions extends Widget.Box implements LauncherContent { const args = search.split(" "); const action = args[0].slice(1).toLowerCase(); - if (action === "scheme" && args[1].toLowerCase() === "random") { + if (action === "scheme" && args[1]?.toLowerCase() === "random") { execAsync(`caelestia scheme`).catch(console.error); close(); } else this.#content.get_child_at_index(0)?.get_child()?.activate(); -- cgit v1.2.3-freya