26 lines
827 B
QML
26 lines
827 B
QML
import Quickshell
|
|
import Quickshell.Io
|
|
import QtQuick
|
|
|
|
import qs.services
|
|
|
|
ShellRoot {
|
|
IpcHandler {
|
|
target: "settings-search-test"
|
|
|
|
function find(query: string): string {
|
|
const hits = SettingsSearch.search(query);
|
|
return JSON.stringify({
|
|
count: hits.length,
|
|
top: hits.length > 0 ? hits[0].label : "",
|
|
topPage: hits.length > 0 ? hits[0].page : "",
|
|
// "" for a result that names no tab, which is most of them.
|
|
// The sidebar routes those exactly as it always did.
|
|
topSection: hits.length > 0 ? String(hits[0].section ?? "") : "",
|
|
labels: hits.slice(0, 6).map(hit => hit.label),
|
|
pages: hits.slice(0, 6).map(hit => hit.page)
|
|
});
|
|
}
|
|
}
|
|
}
|