Clipboard: added auto-paste option.

This commit is contained in:
Lemmy
2026-01-04 19:18:32 -05:00
parent dfc1c2739c
commit b637caaf20
20 changed files with 128 additions and 21 deletions
+4
View File
@@ -1827,6 +1827,10 @@
"label": "Annotationstool",
"placeholder": "gradia, satty -f -"
},
"auto-paste": {
"description": "Automatisches Einfügen des ausgewählten Zwischenablageinhalts. Benötigt wtype.",
"label": "Automatisches Einfügen"
},
"clip-preview": {
"description": "Zeige eine Vorschau des Inhalts der Zwischenablage an, wenn der Befehl >clip verwendet wird.",
"label": "Clip-Vorschau aktivieren"
+4
View File
@@ -1827,6 +1827,10 @@
"label": "Annotation tool",
"placeholder": "e.g. 'gradia', 'satty -f -'"
},
"auto-paste": {
"description": "Automatically paste the selected clipboard item. Requires wtype.",
"label": "Auto paste"
},
"clip-preview": {
"description": "Show a preview of the clipboard content when using the >clip command.",
"label": "Enable clip preview"
+4
View File
@@ -1827,6 +1827,10 @@
"label": "Herramienta de anotación",
"placeholder": "gradia, satty -f -"
},
"auto-paste": {
"description": "Pegar automáticamente el elemento seleccionado del portapapeles. Requiere wtype.",
"label": "Pegado automático"
},
"clip-preview": {
"description": "Muestra una vista previa del contenido del portapapeles al usar el comando >clip.",
"label": "Activar vista previa del portapapeles"
+4
View File
@@ -1827,6 +1827,10 @@
"label": "Outil d'annotation",
"placeholder": "gradia, satty -f -"
},
"auto-paste": {
"description": "Coller automatiquement l'élément sélectionné du presse-papiers. Nécessite wtype.",
"label": "Collage automatique"
},
"clip-preview": {
"description": "Afficher un aperçu du contenu du presse-papiers lors de l'utilisation de la commande >clip.",
"label": "Activer l'aperçu du presse-papiers"
+4
View File
@@ -1827,6 +1827,10 @@
"label": "Annotációs eszköz",
"placeholder": "gradia, satty -f -"
},
"auto-paste": {
"description": "Automatikusan beilleszti a kiválasztott vágólap elemet. Wtype szükséges hozzá.",
"label": "Automatikus beillesztés"
},
"clip-preview": {
"description": "Mutassa a vágólap tartalmának előnézetét a >clip parancs használatakor.",
"label": "Vágólap előnézet engedélyezése"
+4
View File
@@ -1827,6 +1827,10 @@
"label": "注釈ツール",
"placeholder": "グラディア、サッティ -f -"
},
"auto-paste": {
"description": "選択されたクリップボードの項目を自動的に貼り付けます。wtypeが必要です。",
"label": "自動貼り付け"
},
"clip-preview": {
"description": ">clip コマンド使用時に、クリップボードの内容をプレビュー表示します。",
"label": "クリップボードのプレビューを有効化"
+4
View File
@@ -1827,6 +1827,10 @@
"label": "Amûra şîrovekirinê",
"placeholder": "Ez ji te hez dikim."
},
"auto-paste": {
"description": "Bi otomatîkî tişta clipboardê ya hilbijartî bişîne. Wtype hewce dike.",
"label": "Otomatîkî bixwe ve zeliqandin"
},
"clip-preview": {
"description": "Dîmenek pêşdîtinê ya naveroka clipboardê nîşan bide dema ku emrê >clip tê bikaranîn.",
"label": "Pêşdîtina klîpê çalak bike"
+4
View File
@@ -1827,6 +1827,10 @@
"label": "Annotatietool",
"placeholder": "e.g. 'gradia', 'satty -f -'"
},
"auto-paste": {
"description": "Plak automatisch het geselecteerde klemborditem. Vereist wtype.",
"label": "Automatisch plakken"
},
"clip-preview": {
"description": "Toon een voorbeeld van de inhoud van het klembord bij gebruik van het >clip-commando.",
"label": "Klembordvoorbeeld inschakelen"
+4
View File
@@ -1827,6 +1827,10 @@
"label": "Narzędzie do adnotacji",
"placeholder": "Przepraszam, nie rozumiem. Proszę podać tekst do przetłumaczenia."
},
"auto-paste": {
"description": "Automatyczne wklejanie wybranego elementu ze schowka. Wymaga wtype.",
"label": "Automatyczne wklejanie"
},
"clip-preview": {
"description": "Pokaż podgląd zawartości schowka przy użyciu polecenia >clip.",
"label": "Włącz podgląd schowka"
+4
View File
@@ -1827,6 +1827,10 @@
"label": "Ferramenta de anotação",
"placeholder": "gradia, satty -f -"
},
"auto-paste": {
"description": "Colar automaticamente o item selecionado da área de transferência. Requer wtype.",
"label": "Colar automaticamente"
},
"clip-preview": {
"description": "Mostra uma pré-visualização do conteúdo da área de transferência ao usar o comando >clip.",
"label": "Ativar pré-visualização da área de transferência"
+4
View File
@@ -1827,6 +1827,10 @@
"label": "Инструмент аннотирования",
"placeholder": "градия, сатти -ф -"
},
"auto-paste": {
"description": "Автоматически вставить выбранный элемент из буфера обмена. Требуется wtype.",
"label": "Автоматическая вставка"
},
"clip-preview": {
"description": "Показывать предварительный просмотр содержимого буфера обмена при использовании команды >clip.",
"label": "Включить предварительный просмотр буфера обмена"
+4
View File
@@ -1827,6 +1827,10 @@
"label": "Açıklama aracı",
"placeholder": "gradia, satty -f -"
},
"auto-paste": {
"description": "Seçili panodaki öğeyi otomatik olarak yapıştır. Wtype gerektirir.",
"label": "Otomatik yapıştırma"
},
"clip-preview": {
"description": ">clip komutu kullanılırken panodaki içeriğin önizlemesini gösterir.",
"label": "Panoyu önizlemeyi etkinleştir"
+4
View File
@@ -1827,6 +1827,10 @@
"label": "Інструмент анотацій",
"placeholder": "градіа, сатті -ф -"
},
"auto-paste": {
"description": "Автоматично вставити вибраний елемент з буфера обміну. Потребує wtype.",
"label": "Автоматична вставка"
},
"clip-preview": {
"description": "Показувати попередній перегляд вмісту буфера обміну при використанні команди >clip.",
"label": "Попередній перегляд буфера обміну"
+4
View File
@@ -1827,6 +1827,10 @@
"label": "标注工具",
"placeholder": "格拉迪亚,萨蒂 -f -"
},
"auto-paste": {
"description": "自动粘贴选定的剪贴板项目。需要 wtype。",
"label": "自动粘贴"
},
"clip-preview": {
"description": "在使用 >clip 命令时显示剪贴板内容的预览。",
"label": "启用剪贴板预览"
+6 -1
View File
@@ -94,6 +94,10 @@
"panelBackgroundOpacity": 0.93,
"panelsAttachedToBar": true,
"settingsPanelMode": "attached",
"wifiDetailsViewMode": "grid",
"bluetoothDetailsViewMode": "grid",
"networkPanelView": "wifi",
"bluetoothHideUnnamedDevices": false,
"boxBorderEnabled": false
},
"location": {
@@ -174,6 +178,7 @@
},
"appLauncher": {
"enableClipboardHistory": false,
"autoPasteClipboard": false,
"enableClipPreview": true,
"position": "center",
"pinnedExecs": [],
@@ -195,7 +200,7 @@
"shortcuts": {
"left": [
{
"id": "WiFi"
"id": "Network"
},
{
"id": "Bluetooth"
+3
View File
@@ -152,6 +152,9 @@
"WiFi": {
"displayMode": "onhover"
},
"Network": {
"displayMode": "onhover"
},
"Workspace": {
"labelMode": "index",
"followFocusedScreen": false,
+1
View File
@@ -394,6 +394,7 @@ Singleton {
// applauncher
property JsonObject appLauncher: JsonObject {
property bool enableClipboardHistory: false
property bool autoPasteClipboard: false
property bool enableClipPreview: true
// Position: center, top_left, top_right, bottom_left, bottom_right, bottom_center, top_center
property string position: "center"
@@ -196,8 +196,15 @@ Item {
// Add activation handler
entry.onActivate = function () {
ClipboardService.copyToClipboard(item.id);
launcher.close();
if (Settings.data.appLauncher.autoPasteClipboard) {
launcher.closeImmediately();
Qt.callLater(() => {
ClipboardService.pasteFromClipboard(item.id);
});
} else {
ClipboardService.copyToClipboard(item.id);
launcher.close();
}
};
results.push(entry);
+38 -18
View File
@@ -79,24 +79,6 @@ ColumnLayout {
defaultValue: Settings.getDefaultValue("appLauncher.showCategories")
}
NToggle {
label: I18n.tr("settings.launcher.settings.clipboard-history.label")
description: I18n.tr("settings.launcher.settings.clipboard-history.description")
checked: Settings.data.appLauncher.enableClipboardHistory
onToggled: checked => Settings.data.appLauncher.enableClipboardHistory = checked
isSettings: true
defaultValue: Settings.getDefaultValue("appLauncher.enableClipboardHistory")
}
NToggle {
label: I18n.tr("settings.launcher.settings.clip-preview.label")
description: I18n.tr("settings.launcher.settings.clip-preview.description")
checked: Settings.data.appLauncher.enableClipPreview
onToggled: checked => Settings.data.appLauncher.enableClipPreview = checked
isSettings: true
defaultValue: Settings.getDefaultValue("appLauncher.enableClipPreview")
}
NToggle {
label: I18n.tr("settings.launcher.settings.sort-by-usage.label")
description: I18n.tr("settings.launcher.settings.sort-by-usage.description")
@@ -132,6 +114,44 @@ ColumnLayout {
isSettings: true
defaultValue: Settings.getDefaultValue("appLauncher.ignoreMouseInput")
}
NDivider {
Layout.fillWidth: true
}
NToggle {
label: I18n.tr("settings.launcher.settings.clipboard-history.label")
description: I18n.tr("settings.launcher.settings.clipboard-history.description")
checked: Settings.data.appLauncher.enableClipboardHistory
onToggled: checked => Settings.data.appLauncher.enableClipboardHistory = checked
isSettings: true
defaultValue: Settings.getDefaultValue("appLauncher.enableClipboardHistory")
}
NToggle {
label: I18n.tr("settings.launcher.settings.clip-preview.label")
description: I18n.tr("settings.launcher.settings.clip-preview.description")
checked: Settings.data.appLauncher.enableClipPreview
onToggled: checked => Settings.data.appLauncher.enableClipPreview = checked
isSettings: true
defaultValue: Settings.getDefaultValue("appLauncher.enableClipPreview")
visible: Settings.data.appLauncher.enableClipboardHistory
}
NToggle {
label: I18n.tr("settings.launcher.settings.auto-paste.label")
description: I18n.tr("settings.launcher.settings.auto-paste.description")
checked: Settings.data.appLauncher.autoPasteClipboard
onToggled: checked => Settings.data.appLauncher.autoPasteClipboard = checked
isSettings: true
defaultValue: Settings.getDefaultValue("appLauncher.autoPasteClipboard")
visible: Settings.data.appLauncher.enableClipboardHistory
}
NDivider {
Layout.fillWidth: true
}
NToggle {
label: I18n.tr("settings.launcher.settings.use-app2unit.label")
description: I18n.tr("settings.launcher.settings.use-app2unit.description")
+15
View File
@@ -171,6 +171,11 @@ Singleton {
stdout: StdioCollector {}
}
Process {
id: pasteProc
stdout: StdioCollector {}
}
Process {
id: deleteProc
stdout: StdioCollector {}
@@ -320,6 +325,16 @@ Singleton {
copyProc.running = true;
}
function pasteFromClipboard(id) {
if (!root.cliphistAvailable) {
return;
}
// Copy to clipboard and then simulate Ctrl+V paste using wtype
// Uses sleep to ensure clipboard is updated before paste
pasteProc.command = ["sh", "-lc", `cliphist decode ${id} | wl-copy && wtype -M ctrl -M shift v`];
pasteProc.running = true;
}
function deleteById(id) {
if (!root.cliphistAvailable) {
return;