mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-27 23:12:49 -05:00
clipboard: add cl copy --download option for images/videos
- offers application/vnd.portal.filetransfer and text/uri-list
This commit is contained in:
@@ -65,6 +65,12 @@ Item {
|
||||
running: false
|
||||
}
|
||||
|
||||
Process {
|
||||
id: copyProcess
|
||||
running: false
|
||||
onExited: pasteTimer.start()
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: pasteTimer
|
||||
interval: 200
|
||||
@@ -83,12 +89,12 @@ Item {
|
||||
const pluginId = selectedItem.pluginId;
|
||||
if (!pluginId)
|
||||
return;
|
||||
const pasteText = AppSearchService.getPluginPasteText(pluginId, selectedItem.data);
|
||||
if (!pasteText)
|
||||
const pasteArgs = AppSearchService.getPluginPasteArgs(pluginId, selectedItem.data);
|
||||
if (!pasteArgs)
|
||||
return;
|
||||
Quickshell.execDetached(["dms", "cl", "copy", pasteText]);
|
||||
copyProcess.command = pasteArgs;
|
||||
copyProcess.running = true;
|
||||
itemExecuted();
|
||||
pasteTimer.start();
|
||||
}
|
||||
|
||||
readonly property var sectionDefinitions: [
|
||||
|
||||
@@ -82,6 +82,10 @@ signal itemsChanged()
|
||||
// Required functions
|
||||
function getItems(query): array
|
||||
function executeItem(item): void
|
||||
|
||||
// Optional functions (for Shift+Enter paste support)
|
||||
function getPasteText(item): string|null
|
||||
function getPasteArgs(item): array|null
|
||||
```
|
||||
|
||||
**Item Structure**:
|
||||
|
||||
@@ -870,6 +870,26 @@ Singleton {
|
||||
return null;
|
||||
}
|
||||
|
||||
function getPluginPasteArgs(pluginId, item) {
|
||||
if (typeof PluginService === "undefined")
|
||||
return null;
|
||||
|
||||
const instance = PluginService.pluginInstances[pluginId];
|
||||
if (!instance)
|
||||
return null;
|
||||
|
||||
if (typeof instance.getPasteArgs === "function")
|
||||
return instance.getPasteArgs(item);
|
||||
|
||||
if (typeof instance.getPasteText === "function") {
|
||||
const text = instance.getPasteText(item);
|
||||
if (text)
|
||||
return ["dms", "cl", "copy", text];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function searchPluginItems(query) {
|
||||
if (typeof PluginService === "undefined")
|
||||
return [];
|
||||
|
||||
Reference in New Issue
Block a user