summaryrefslogtreecommitdiff
path: root/raveos-hyprland-theme/theme-data/DankMaterialShell/quickshell/PLUGINS/QuickNotesExample/QuickNotesLauncher.qml
diff options
context:
space:
mode:
authorNippy <nippy@rp1.hu>2026-05-09 13:33:09 +0200
committerNippy <nippy@rp1.hu>2026-05-09 13:33:09 +0200
commita2b924d7e9492b978ad6dc33b6c1ffcb304b4bc5 (patch)
tree1a8769217f84bfe9d6216fafaadaf8cdd876d457 /raveos-hyprland-theme/theme-data/DankMaterialShell/quickshell/PLUGINS/QuickNotesExample/QuickNotesLauncher.qml
parent34b9c34f982b2596cfa9e368a2d7f74e9a17477c (diff)
downloadRaveOS-PKGBUILD-a2b924d7e9492b978ad6dc33b6c1ffcb304b4bc5.tar.gz
RaveOS-PKGBUILD-a2b924d7e9492b978ad6dc33b6c1ffcb304b4bc5.zip
raveos update
Diffstat (limited to 'raveos-hyprland-theme/theme-data/DankMaterialShell/quickshell/PLUGINS/QuickNotesExample/QuickNotesLauncher.qml')
-rw-r--r--raveos-hyprland-theme/theme-data/DankMaterialShell/quickshell/PLUGINS/QuickNotesExample/QuickNotesLauncher.qml174
1 files changed, 0 insertions, 174 deletions
diff --git a/raveos-hyprland-theme/theme-data/DankMaterialShell/quickshell/PLUGINS/QuickNotesExample/QuickNotesLauncher.qml b/raveos-hyprland-theme/theme-data/DankMaterialShell/quickshell/PLUGINS/QuickNotesExample/QuickNotesLauncher.qml
deleted file mode 100644
index 42e4001..0000000
--- a/raveos-hyprland-theme/theme-data/DankMaterialShell/quickshell/PLUGINS/QuickNotesExample/QuickNotesLauncher.qml
+++ /dev/null
@@ -1,174 +0,0 @@
-import QtQuick
-import Quickshell
-import qs.Services
-
-Item {
- id: root
-
- property var pluginService: null
- property string trigger: "n"
-
- signal itemsChanged
-
- property var notes: []
- property int maxNotes: 50
-
- Component.onCompleted: {
- if (!pluginService)
- return;
- trigger = pluginService.loadPluginData("quickNotesExample", "trigger", "n");
- maxNotes = pluginService.loadPluginData("quickNotesExample", "maxNotes", 50);
-
- // Load notes from plugin STATE (persistent across sessions, separate file)
- notes = pluginService.loadPluginState("quickNotesExample", "notes", []);
- }
-
- function getItems(query) {
- const items = [];
-
- if (query && query.trim().length > 0) {
- const text = query.trim();
- items.push({
- name: "Save note: " + text,
- icon: "material:note_add",
- comment: "Save as a new note",
- action: "add:" + text,
- categories: ["Quick Notes"]
- });
-
- items.push({
- name: "Copy: " + text,
- icon: "material:content_copy",
- comment: "Copy text to clipboard",
- action: "copy:" + text,
- categories: ["Quick Notes"]
- });
- }
-
- const filteredNotes = query ? notes.filter(n => n.text.toLowerCase().includes(query.toLowerCase())) : notes;
-
- for (let i = 0; i < Math.min(20, filteredNotes.length); i++) {
- const note = filteredNotes[i];
- const age = _formatAge(note.timestamp);
- items.push({
- name: note.text,
- icon: "material:sticky_note_2",
- comment: age + " — select to copy, hold for options",
- action: "copy:" + note.text,
- categories: ["Quick Notes"]
- });
- }
-
- if (notes.length > 0 && !query) {
- items.push({
- name: "Clear all notes (" + notes.length + ")",
- icon: "material:delete_sweep",
- comment: "Remove all saved notes",
- action: "clear:",
- categories: ["Quick Notes"]
- });
- }
-
- return items;
- }
-
- function executeItem(item) {
- if (!item?.action)
- return;
-
- const colonIdx = item.action.indexOf(":");
- const actionType = item.action.substring(0, colonIdx);
- const actionData = item.action.substring(colonIdx + 1);
-
- switch (actionType) {
- case "add":
- addNote(actionData);
- break;
- case "copy":
- copyToClipboard(actionData);
- break;
- case "remove":
- removeNote(actionData);
- break;
- case "clear":
- clearAllNotes();
- break;
- default:
- showToast("Unknown action: " + actionType);
- }
- }
-
- function addNote(text) {
- if (!text)
- return;
-
- const existing = notes.findIndex(n => n.text === text);
- if (existing !== -1)
- notes.splice(existing, 1);
-
- notes.unshift({
- text: text,
- timestamp: Date.now()
- });
-
- if (notes.length > maxNotes)
- notes = notes.slice(0, maxNotes);
-
- _saveNotes();
- showToast("Note saved");
- }
-
- function removeNote(text) {
- notes = notes.filter(n => n.text !== text);
- _saveNotes();
- showToast("Note removed");
- }
-
- function clearAllNotes() {
- notes = [];
- pluginService.clearPluginState("quickNotesExample");
- showToast("All notes cleared");
- itemsChanged();
- }
-
- function _saveNotes() {
- if (!pluginService)
- return;
- // Save to plugin STATE — writes to quickNotesExample_state.json
- // This is separate from plugin SETTINGS (plugin_settings.json)
- pluginService.savePluginState("quickNotesExample", "notes", notes);
- itemsChanged();
- }
-
- function copyToClipboard(text) {
- Quickshell.execDetached(["dms", "cl", "copy", text]);
- showToast("Copied to clipboard");
- }
-
- function showToast(message) {
- if (typeof ToastService !== "undefined")
- ToastService.showInfo("Quick Notes", message);
- }
-
- function _formatAge(timestamp) {
- if (!timestamp)
- return "";
- const seconds = Math.floor((Date.now() - timestamp) / 1000);
- if (seconds < 60)
- return "just now";
- const minutes = Math.floor(seconds / 60);
- if (minutes < 60)
- return minutes + "m ago";
- const hours = Math.floor(minutes / 60);
- if (hours < 24)
- return hours + "h ago";
- const days = Math.floor(hours / 24);
- return days + "d ago";
- }
-
- onTriggerChanged: {
- if (!pluginService)
- return;
- pluginService.savePluginData("quickNotesExample", "trigger", trigger);
- }
-}