summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-03-16 17:23:19 +1100
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-03-16 17:23:19 +1100
commit8f3b369e862b0efb22c63824bb8f65b247aaa207 (patch)
tree0ca3401ae21f9563361599165aa681dca68dd77a /src
parentlauncher: remove window mode action (diff)
downloadcaelestia-shell-8f3b369e862b0efb22c63824bb8f65b247aaa207.tar.gz
caelestia-shell-8f3b369e862b0efb22c63824bb8f65b247aaa207.tar.bz2
caelestia-shell-8f3b369e862b0efb22c63824bb8f65b247aaa207.zip
launcher: fix wallpaper categories compact mode
Also fix undef errors for wallpapers and scheme
Diffstat (limited to 'src')
-rw-r--r--src/modules/launcher/actions.tsx25
1 files 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()}`}
>
- <box className="thumbnail">
- {wallpapers.slice(0, 3).map(w => (
- <box hexpand css={"background-image: url('" + (w.thumbnail ?? w.path) + "');"} />
- ))}
- </box>
+ {bind(config.wallpaper.style).as(s =>
+ s === "compact" ? (
+ <box
+ className="thumbnail"
+ css={"background-image: url('" + (wallpapers[0].thumbnail ?? wallpapers[0].path) + "');"}
+ />
+ ) : (
+ <box className="thumbnail">
+ {wallpapers.slice(0, 3).map(w => (
+ <box hexpand css={"background-image: url('" + (w.thumbnail ?? w.path) + "');"} />
+ ))}
+ </box>
+ )
+ )}
<label truncate label={basename(path)} />
</box>
</button>
@@ -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();