summaryrefslogtreecommitdiff
path: root/services
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
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')
-rw-r--r--services/Apps.qml2
-rw-r--r--services/Wallpapers.qml25
2 files changed, 10 insertions, 17 deletions
diff --git a/services/Apps.qml b/services/Apps.qml
index b8ec38e..e2addcd 100644
--- a/services/Apps.qml
+++ b/services/Apps.qml
@@ -1,5 +1,6 @@
pragma Singleton
+import qs.config
import qs.utils
import Quickshell
@@ -7,6 +8,7 @@ Searcher {
id: root
list: DesktopEntries.applications.values.filter(a => !a.noDisplay).sort((a, b) => a.name.localeCompare(b.name))
+ useFuzzy: Config.launcher.useFuzzy.apps
function launch(entry: DesktopEntry): void {
if (entry.runInTerminal)
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"