From 70f196ff628aa2bea309085f0e45b5597cc722a5 Mon Sep 17 00:00:00 2001 From: crschnick Date: Tue, 22 Jul 2025 09:22:30 +0000 Subject: [PATCH] Small fixes [stage] --- .../java/io/xpipe/app/util/ClipboardHelper.java | 17 ++++++++++------- version | 2 +- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/io/xpipe/app/util/ClipboardHelper.java b/app/src/main/java/io/xpipe/app/util/ClipboardHelper.java index 678eef418..87f28d1ac 100644 --- a/app/src/main/java/io/xpipe/app/util/ClipboardHelper.java +++ b/app/src/main/java/io/xpipe/app/util/ClipboardHelper.java @@ -21,7 +21,7 @@ public class ClipboardHelper { new LabelGraphic.IconGraphic("mdi2c-clipboard-check-outline"), () -> {}); - private static void apply(Map map) { + private static void apply(Map map, boolean showNotification) { Clipboard clipboard = Clipboard.getSystemClipboard(); Map contents = Stream.of( DataFormat.PLAIN_TEXT, @@ -38,11 +38,14 @@ public class ClipboardHelper { return new AbstractMap.SimpleEntry<>(dataFormat, null); } }) - .filter(o -> o.getValue() != null) .collect(HashMap::new, (m, v) -> m.put(v.getKey(), v.getValue()), HashMap::putAll); contents.putAll(map); + contents.entrySet().removeIf(e -> e.getValue() == null); clipboard.setContent(contents); - AppLayoutModel.get().showQueueEntry(COPY_QUEUE_ENTRY, java.time.Duration.ofSeconds(10), true); + + if (showNotification) { + AppLayoutModel.get().showQueueEntry(COPY_QUEUE_ENTRY, java.time.Duration.ofSeconds(15), true); + } } public static void copyPassword(SecretValue pass) { @@ -54,7 +57,7 @@ public class ClipboardHelper { Clipboard clipboard = Clipboard.getSystemClipboard(); var text = clipboard.getString(); - apply(Map.of(DataFormat.PLAIN_TEXT, pass.getSecretValue())); + apply(Map.of(DataFormat.PLAIN_TEXT, pass.getSecretValue()), true); var transition = new PauseTransition(Duration.millis(15000)); transition.setOnFinished(e -> { @@ -62,7 +65,7 @@ public class ClipboardHelper { if (present != null && present.equals(pass.getSecretValue())) { var map = new HashMap(); map.put(DataFormat.PLAIN_TEXT, text); - apply(map); + apply(map, false); } }); transition.play(); @@ -71,13 +74,13 @@ public class ClipboardHelper { public static void copyText(String s) { PlatformThread.runLaterIfNeeded(() -> { - apply(Map.of(DataFormat.PLAIN_TEXT, s)); + apply(Map.of(DataFormat.PLAIN_TEXT, s), true); }); } public static void copyUrl(String s) { PlatformThread.runLaterIfNeeded(() -> { - apply(Map.of(DataFormat.URL, s, DataFormat.PLAIN_TEXT, s)); + apply(Map.of(DataFormat.URL, s, DataFormat.PLAIN_TEXT, s), true); }); } } diff --git a/version b/version index a1e090295..e062a86b3 100644 --- a/version +++ b/version @@ -1 +1 @@ -17.3-1 +17.3-2