From 1ab05f8c65fbd573f2f81314389c09388df8f928 Mon Sep 17 00:00:00 2001 From: Ly-sec Date: Fri, 8 Aug 2025 23:30:26 +0200 Subject: [PATCH] Revert "Fix applauncher clipboard copy" This reverts commit b0702cf2f2824dab43f7847e0a60246846e13fd1. --- Bar/Modules/Applauncher.qml | 43 +++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/Bar/Modules/Applauncher.qml b/Bar/Modules/Applauncher.qml index cf8bdc0..e3f15c9 100644 --- a/Bar/Modules/Applauncher.qml +++ b/Bar/Modules/Applauncher.qml @@ -68,9 +68,14 @@ PanelWithOverlay { }; - // Always create a new image entry, even if identical to an existing one - clipboardHistory = [entry].concat(clipboardHistory).slice(0, 20); - root.updateFilter(); + const exists = clipboardHistory.find(item => + item.type === 'image' && item.data === entry.data + ); + + if (!exists) { + clipboardHistory = [entry, ...clipboardHistory].slice(0, 20); + root.updateFilter(); + } } } @@ -98,19 +103,29 @@ PanelWithOverlay { }; - var newHistory = clipboardHistory.map(item => { - if (typeof item === 'string') { - return { - type: 'text', - content: item, - timestamp: 0 - }; + const exists = clipboardHistory.find(item => { + if (item.type === 'text') { + return item.content === content; } - return item; + + return item === content; }); - // Always add a new text entry, even if content matches an existing entry - clipboardHistory = [entry].concat(newHistory).slice(0, 20); + if (!exists) { + + const newHistory = clipboardHistory.map(item => { + if (typeof item === 'string') { + return { + type: 'text', + content: item, + timestamp: new Date().getTime() + }; + } + return item; + }); + + clipboardHistory = [entry, ...newHistory].slice(0, 20); + } } } else { @@ -772,7 +787,7 @@ PanelWithOverlay { anchors.left: parent.left anchors.right: parent.right anchors.bottom: parent.bottom - height: Math.max(1, 1 * Theme.scale(screen)) + height: 1 color: Theme.outline opacity: index === appList.count - 1 ? 0 : 0.10 }