diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2025-08-05 17:25:30 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2025-08-05 17:25:30 +0800 |
| commit | f9efa56caeeb5289d6b2314e50041a1b7055a3c8 (patch) | |
| tree | 8a9e5b59f8690555ba8ad51f653db02d9483e2a7 /launcher/components/IComponent.qml | |
| parent | f6b5ac3cfba03602fea9d8c30b13075514dbd131 (diff) | |
feat: add launcher support and image clipboard history utility
- Integrated a new Launcher component into the shell.qml for improved application launching.
- Implemented an IPC handler to toggle the launcher visibility.
- Added a new script (cliphist-img.sh) to manage image history from the clipboard.
- Removed the outdated fuzzysort.js utility to streamline the codebase.
- Refactored the Levenshtein distance algorithm for better performance and clarity.
Diffstat (limited to 'launcher/components/IComponent.qml')
| -rw-r--r-- | launcher/components/IComponent.qml | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/launcher/components/IComponent.qml b/launcher/components/IComponent.qml new file mode 100644 index 0000000..b8963d2 --- /dev/null +++ b/launcher/components/IComponent.qml @@ -0,0 +1,72 @@ +import Quickshell +import QtQuick + +import qs.components +import qs.config + +IRect { + id: root + // virtual properties + property string name // Component/File name + readonly property string input: SelectionState.input + readonly property string inputCleaned: input.toLowerCase().trim() + property string prefix + property bool valid: processed?.valid || false + property bool priority: valid && processed?.priority || false // please set priority to false if it's invalid + property string answer: processed?.answer || "" + property Component preview: Component { + IText { + animate: true + text: answer + } + } + property string predictiveCompletion: processed?.predictiveCompletion || "" // would technically work with just from answer, but stuff like calc's answer wouldnt have anything to do with the input + property var processed: input && input.startsWith(prefix) ? process() : {} // cached process, thought qml would do that automatically :/ + property var process: () => ({ + valid: valid, + priority: priority, + answer: answer, + preview: preview, + predictiveCompletion: predictiveCompletion + })// use the current IRect if valid is set + // actions + property var up: () => ({ + top: false + }) + property var down: () => ({ + bottom: false + }) + property var prev: () => {} + property var next: () => {} + property var exec: () => {} + + signal close + + function _exec() { + exec(); + close(); + } + + opacity: valid ? 1 : 0 + y: valid ? 0 : -Launcher.widgetHeight + + implicitWidth: valid ? Launcher.widgetWidth : 0 + implicitHeight: valid ? Launcher.widgetHeight : 0 + + // implicitWidth: Launcher.widgetWidth + // implicitHeight: Launcher.widgetHeight + + radius: Launcher.widgetRadius + color: Qt.rgba(Colors.background3.r, Colors.background3.g, Colors.background3.b, Launcher.widgetBgTransparency) // TODO when prioritized, highlight + + onPriorityChanged: { + SelectionState.priorities = [...[...SelectionState.priorities, root].reduce((s, x) => (s[(s.has(x) && 'delete') || 'add'](x), s), new Set())]; // sync with SelectionState.priorities + } + + Behavior on y { + NumberAnimation { + duration: General.animationDuration / 4 + easing.type: Easing.InOutQuad + } + } +} |
