summaryrefslogtreecommitdiff
path: root/raveos-theme/hyprland/theme-data/DankMaterialShell/quickshell/Services/DSearchService.qml
diff options
context:
space:
mode:
authorAlexanderCurl <alexc@alexc.hu>2026-04-18 17:46:06 +0100
committerAlexanderCurl <alexc@alexc.hu>2026-04-18 17:46:06 +0100
commit70ca3fef77ee8bdc6e3ac28589a6fa08c024cc69 (patch)
treeab1123d4067c1b086dd6faa7ee4ea643236b565a /raveos-theme/hyprland/theme-data/DankMaterialShell/quickshell/Services/DSearchService.qml
parent5d94c0a7d44a2255b81815a52a7056a94a39842d (diff)
downloadRaveOS-PKGBUILD-70ca3fef77ee8bdc6e3ac28589a6fa08c024cc69.tar.gz
RaveOS-PKGBUILD-70ca3fef77ee8bdc6e3ac28589a6fa08c024cc69.zip
Replaced file structures for themes in the correct format
Diffstat (limited to 'raveos-theme/hyprland/theme-data/DankMaterialShell/quickshell/Services/DSearchService.qml')
-rw-r--r--raveos-theme/hyprland/theme-data/DankMaterialShell/quickshell/Services/DSearchService.qml184
1 files changed, 0 insertions, 184 deletions
diff --git a/raveos-theme/hyprland/theme-data/DankMaterialShell/quickshell/Services/DSearchService.qml b/raveos-theme/hyprland/theme-data/DankMaterialShell/quickshell/Services/DSearchService.qml
deleted file mode 100644
index 63efcb0..0000000
--- a/raveos-theme/hyprland/theme-data/DankMaterialShell/quickshell/Services/DSearchService.qml
+++ /dev/null
@@ -1,184 +0,0 @@
-pragma Singleton
-pragma ComponentBehavior: Bound
-
-import QtQuick
-import Quickshell
-import Quickshell.Io
-import qs.Common
-
-Singleton {
- id: root
-
- property bool dsearchAvailable: false
- property int searchIdCounter: 0
- property int indexVersion: 0
- property bool supportsTypeFilter: false
- property bool versionChecked: false
-
- signal searchResultsReceived(var results)
- signal statsReceived(var stats)
- signal errorOccurred(string error)
-
- Process {
- id: checkProcess
- command: ["sh", "-c", "command -v dsearch"]
- running: true
-
- stdout: SplitParser {
- onRead: line => {
- if (line && line.trim().length > 0) {
- root.dsearchAvailable = true;
- }
- }
- }
-
- onExited: exitCode => {
- if (exitCode !== 0) {
- root.dsearchAvailable = false;
- } else {
- root._checkVersion();
- }
- }
- }
-
- function _checkVersion() {
- Proc.runCommand("dsearch-version", ["dsearch", "version", "--json"], (stdout, exitCode) => {
- root.versionChecked = true;
- if (exitCode !== 0)
- return;
- const response = JSON.parse(stdout);
- root.indexVersion = response.index_schema || 0;
- root.supportsTypeFilter = root.indexVersion >= 2;
- });
- }
-
- function ping(callback) {
- if (!dsearchAvailable) {
- if (callback) {
- callback({
- "error": "dsearch not available"
- });
- }
- return;
- }
-
- Proc.runCommand("dsearch-ping", ["dsearch", "ping", "--json"], (stdout, exitCode) => {
- if (callback) {
- if (exitCode === 0) {
- try {
- const response = JSON.parse(stdout);
- callback({
- "result": response
- });
- } catch (e) {
- callback({
- "error": "failed to parse ping response"
- });
- }
- } else {
- callback({
- "error": "ping failed"
- });
- }
- }
- });
- }
-
- function search(query, params, callback) {
- if (!query || query.length === 0) {
- if (callback) {
- callback({
- "error": "query is required"
- });
- }
- return;
- }
-
- if (!dsearchAvailable) {
- if (callback) {
- callback({
- "error": "dsearch not available"
- });
- }
- return;
- }
-
- const args = ["dsearch", "search", query, "--json"];
-
- if (params) {
- if (params.limit !== undefined) {
- args.push("-n", String(params.limit));
- }
- if (params.type) {
- args.push("-t", params.type);
- }
- if (params.ext) {
- args.push("-e", params.ext);
- }
- if (params.folder) {
- args.push("--folder", params.folder);
- }
- if (params.field) {
- args.push("-f", params.field);
- }
- if (params.fuzzy) {
- args.push("--fuzzy");
- }
- if (params.sort) {
- args.push("--sort", params.sort);
- }
- if (params.desc !== undefined) {
- args.push("--desc=" + (params.desc ? "true" : "false"));
- }
- if (params.minSize !== undefined) {
- args.push("--min-size", String(params.minSize));
- }
- if (params.maxSize !== undefined) {
- args.push("--max-size", String(params.maxSize));
- }
- }
-
- const procId = "dsearch-search-" + (params?.type || "all");
- Proc.runCommand(procId, args, (stdout, exitCode) => {
- if (exitCode === 0) {
- try {
- const response = JSON.parse(stdout);
- searchResultsReceived(response);
- if (callback) {
- callback({
- "result": response
- });
- }
- } catch (e) {
- const error = "failed to parse search response";
- errorOccurred(error);
- if (callback) {
- callback({
- "error": error
- });
- }
- }
- } else if (exitCode === 124) {
- const error = "search timed out";
- errorOccurred(error);
- if (callback) {
- callback({
- "error": error
- });
- }
- } else {
- const error = "search failed";
- errorOccurred(error);
- if (callback) {
- callback({
- "error": error
- });
- }
- }
- }, 100, 5000);
- }
-
- function rediscover() {
- checkProcess.running = true;
- }
-}