summaryrefslogtreecommitdiff
path: root/services/Wallpapers.qml
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-07-19 14:49:47 +1000
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-07-19 14:49:47 +1000
commit0097c56e09b8501cabdfac2e15d536f121446cc4 (patch)
tree8388d0b2bca7212c3ab4ba1f617b36bb6a05721f /services/Wallpapers.qml
parentfeat: fzf-like search instead of fuzzy (diff)
downloadcaelestia-shell-0097c56e09b8501cabdfac2e15d536f121446cc4.tar.gz
caelestia-shell-0097c56e09b8501cabdfac2e15d536f121446cc4.tar.bz2
caelestia-shell-0097c56e09b8501cabdfac2e15d536f121446cc4.zip
config: add config for using fzf/fuzzy search
Diffstat (limited to 'services/Wallpapers.qml')
-rw-r--r--services/Wallpapers.qml25
1 files changed, 8 insertions, 17 deletions
diff --git a/services/Wallpapers.qml b/services/Wallpapers.qml
index b81a891..b9c408a 100644
--- a/services/Wallpapers.qml
+++ b/services/Wallpapers.qml
@@ -1,39 +1,23 @@
pragma Singleton
-import "root:/utils/scripts/fuzzysort.js" as Fuzzy
import qs.config
import qs.utils
import Quickshell
import Quickshell.Io
import QtQuick
-Singleton {
+Searcher {
id: root
readonly property string currentNamePath: Paths.strip(`${Paths.state}/wallpaper/path.txt`)
readonly property list<string> extensions: ["jpg", "jpeg", "png", "webp", "tif", "tiff"]
- readonly property list<Wallpaper> list: wallpapers.instances
property bool showPreview: false
readonly property string current: showPreview ? previewPath : actualCurrent
property string previewPath
property string actualCurrent
property bool previewColourLock
- readonly property list<var> preppedWalls: list.map(w => ({
- name: Fuzzy.prepare(w.name),
- path: Fuzzy.prepare(w.path),
- wall: w
- }))
-
- function fuzzyQuery(search: string): var {
- return Fuzzy.go(search, preppedWalls, {
- all: true,
- keys: ["name", "path"],
- scoreFn: r => r[0].score * 0.9 + r[1].score * 0.1
- }).map(r => r.obj.wall);
- }
-
function setWallpaper(path: string): void {
actualCurrent = path;
Quickshell.execDetached(["caelestia", "wallpaper", "-f", path]);
@@ -55,6 +39,13 @@ Singleton {
reloadableId: "wallpapers"
+ list: wallpapers.instances
+ key: "path"
+ useFuzzy: Config.launcher.useFuzzy.wallpapers
+ extraOpts: useFuzzy ? ({}) : ({
+ forward: false
+ })
+
IpcHandler {
target: "wallpaper"