Skip to content

Edge-Drop is a clipboard shelf on the edge of your screen. Hover to open it. Drag files and images into any app, click to copy text and links. Free and open-source for Windows.

fix(ui): make copy indicator instant and system-like

Deepender2551f2e30f1df8
diff --git a/electron/clipboard/ClipboardWatcher.ts b/electron/clipboard/ClipboardWatcher.ts
index 6e18ae7..94ebd16 100644
--- a/electron/clipboard/ClipboardWatcher.ts
+++ b/electron/clipboard/ClipboardWatcher.ts
@@ -28,67 +28,77 @@ export class ClipboardWatcher {
private lastSig = 'empty'
private paused = false
private readonly intervalMs: number
+ private readonly settleMs: number
+ private onNew: NewItemHandler | null = null
+ private onHint: (() => void) | null = null
- constructor(intervalMs = 300) {
+ constructor(intervalMs = 300, settleMs = 50) {
this.intervalMs = intervalMs
+ this.settleMs = settleMs
}
- /** Start watching. `onNew` fires for every genuinely new piece of content. */
- start(onNew: NewItemHandler): void {
+ /**
+ * Start watching. `onNew` fires once content is stable.
+ * `onHint` fires on the same tick the OS sequence number changes so the
+ * copy indicator can appear without waiting for settle + persist.
+ */
+ start(onNew: NewItemHandler, onHint?: () => void): void {
if (this.timer) return
+ this.onNew = onNew
+ this.onHint = onHint ?? null
// Seed the signature so we don't re-fire for whatever is already on the
// clipboard at startup (the user didn't "just" copy it).
this.lastSig = clipboardSignature()
- this.timer = setInterval(() => {
- if (this.paused) return
- const sig = clipboardSignature()
- // If the full signature (including sequence number) has not changed, do nothing.
- if (sig === this.lastSig) {
+ this.timer = setInterval(() => this.pollTick(), this.intervalMs)
+ }
+
+ /** Run one poll immediately (WM_CLIPBOARDUPDATE). Safe if not started. */
+ nudge(): void {
+ if (!this.onNew || this.paused) return
+ this.pollTick()
+ }
+
+ private pollTick(): void {
+ if (this.paused || !this.onNew) return
+ const sig = clipboardSignature()
+ if (sig === this.lastSig) return
+
+ this.lastSig = sig
+ try {
+ this.onHint?.()
+ } catch (err) {
+ console.error('[ClipboardWatcher] onHint failed:', err)
+ }
+
+ if (this.settleTimer) clearTimeout(this.settleTimer)
+
+ const capturedSig = sig
+ this.settleTimer = setTimeout(async () => {
+ this.settleTimer = null
+ if (this.paused || !this.onNew) return
+ const stableSig = clipboardSignature()
+
+ if (getContentSignature(stableSig) !== getContentSignature(capturedSig) && stableSig !== capturedSig) {
return
}
- // We detected a change (new content OR OS sequence number incremented from a re-copy of identical content).
- // Update lastSig immediately so subsequent poll intervals don't spawn duplicate settling timers.
- this.lastSig = sig
+ this.lastSig = stableSig
- if (this.settleTimer) {
- clearTimeout(this.settleTimer)
- }
+ const data = await readClipboard()
+ if (!data) return
- // Wait a short moment to ensure multi-format streams (e.g. text + html + bitmaps) have finished writing.
- this.settleTimer = setTimeout(async () => {
- this.settleTimer = null
- if (this.paused) return
- const stableSig = clipboardSignature()
-
- // Ensure content is stable (not transient injection by an app that immediately reverted)
- if (getContentSignature(stableSig) !== getContentSignature(sig) && stableSig !== sig) {
- return
- }
-
- this.lastSig = stableSig
-
- // readClipboard is async: on Windows it awaits a PowerShell
- // GetFileDropList() call to retrieve ALL selected files.
- const data = await readClipboard()
- if (!data) {
- return
- }
-
- // Images need their bytes persisted + an id assigned before publishing.
- if (data.kind === 'image') {
- const img = clipboard.readImage()
- const png = img.toPNG() // encode once — reuse for both bytes count and file write
- data.imageId = createId()
- data.bytes = png.length
- data.ext = 'png' // always set so cache key is 'id.png', never 'id.undefined'
- onNew(data, png)
- } else {
- onNew(data)
- }
- }, 150)
- }, this.intervalMs)
+ if (data.kind === 'image') {
+ const img = clipboard.readImage()
+ const png = img.toPNG()
+ data.imageId = createId()
+ data.bytes = png.length
+ data.ext = 'png'
+ this.onNew(data, png)
+ } else {
+ this.onNew(data)
+ }
+ }, this.settleMs)
}
/** Temporarily stop recording (incognito mode or self-copy) without tearing down the timer. */
diff --git a/electron/main/state.ts b/electron/main/state.ts
index 710de17..5e54590 100644
--- a/electron/main/state.ts
+++ b/electron/main/state.ts
@@ -15,7 +15,7 @@ import { isStagedTempPath } from '../store/paths'
import { prefetchFileIcons } from './drag'
import { forgetStagedItems, reconcileTempOnStartup } from './stagedTemp'
import { runtime } from './config'
-import { getMainWindow } from './window'
+import { getMainWindow, registerClipboardUpdateListener } from './window'
const store = new ItemStore((removed) => forgetStagedItems(removed))
const watcher = new ClipboardWatcher(600)
@@ -80,11 +80,14 @@ export function initState(): void {
}
store.add(data, loadSettings().historyLimit)
pushState.items()
+ }, () => {
+ if (loadSettings().incognito) return
const win = getMainWindow()
if (win && !win.isDestroyed()) {
win.webContents.send('ui:copy-flare')
}
})
+ registerClipboardUpdateListener(() => watcher.nudge())
watcher.setPaused(loadSettings().incognito)
powerMonitor.removeAllListeners('suspend')
diff --git a/electron/main/window.ts b/electron/main/window.ts
index 5f785f3..b7f45ab 100644
--- a/electron/main/window.ts
+++ b/electron/main/window.ts
@@ -28,10 +28,13 @@ import { isFullscreenAppActive, registerFullscreenActiveListener } from './fulls
type RegisterWindowMessageFn = (lpString: string) => number
type SetWindowLongPtrFn = (hWnd: number | bigint, nIndex: number, dwNewLong: number | bigint) => number | bigint
type GetWindowLongPtrFn = (hWnd: number | bigint, nIndex: number) => number | bigint
+type ClipboardListenerFn = (hWnd: number | bigint) => number
let registerWindowMessageFn: RegisterWindowMessageFn | null = null
let setWindowLongPtrFn: SetWindowLongPtrFn | null = null
let getWindowLongPtrFn: GetWindowLongPtrFn | null = null
+let addClipboardFormatListenerFn: ClipboardListenerFn | null = null
+let removeClipboardFormatListenerFn: ClipboardListenerFn | null = null
if (process.platform === 'win32') {
try {
@@ -47,6 +50,12 @@ if (process.platform === 'win32') {
} catch {
getWindowLongPtrFn = user32.func('intptr_t GetWindowLongW(uintptr_t hWnd, int nIndex)') as GetWindowLongPtrFn
}
+ try {
+ addClipboardFormatListenerFn = user32.func('bool AddClipboardFormatListener(uintptr_t hWnd)') as ClipboardListenerFn
+ removeClipboardFormatListenerFn = user32.func('bool RemoveClipboardFormatListener(uintptr_t hWnd)') as ClipboardListenerFn
+ } catch (err) {
+ console.error('[Window] Failed to load clipboard listener APIs:', err)
+ }
} catch (err) {
console.error('[Window] Failed to load user32 functions via koffi:', err)
}
@@ -87,6 +96,13 @@ export function registerTaskbarCreatedListener(fn: () => void): void {
onTaskbarCreatedListeners.push(fn)
}
+const onClipboardUpdateListeners: Array<() => void> = []
+export function registerClipboardUpdateListener(fn: () => void): void {
+ onClipboardUpdateListeners.push(fn)
+}
+
+const WM_CLIPBOARDUPDATE = 0x031D
+
export const PANEL_WIDTH = 384
/** Visual width of the blade when collapsed (only used by the renderer). */
export const COLLAPSED_WIDTH = 0
@@ -541,6 +557,27 @@ export function createWindow(): BrowserWindow {
// Apply WS_EX_NOACTIVATE so clicking the panel never steals OS focus from the active application.
applyNoActivateStyle(mainWindow, true)
+ if (process.platform === 'win32' && addClipboardFormatListenerFn) {
+ try {
+ const hwnd = getHwnd(mainWindow)
+ if (hwnd) {
+ addClipboardFormatListenerFn(hwnd)
+ mainWindow.hookWindowMessage(WM_CLIPBOARDUPDATE, () => {
+ for (const listener of onClipboardUpdateListeners) {
+ try { listener() } catch (err) {
+ console.error('[Main] Error in clipboard-update listener:', err)
+ }
+ }
+ })
+ mainWindow.on('closed', () => {
+ try { removeClipboardFormatListenerFn?.(hwnd) } catch { /* ignore */ }
+ })
+ }
+ } catch (err) {
+ console.error('[Main] Failed to register clipboard format listener:', err)
+ }
+ }
+
// Listen for Windows Explorer restart/crash to purge ghost taskbar icons and restore tray.
if (process.platform === 'win32' && registerWindowMessageFn) {
try {
diff --git a/src/App.tsx b/src/App.tsx
index 7849d29..1602821 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -80,6 +80,9 @@ export default function App() {
const offUpdateDownloaded = edge.onUpdateDownloaded((info) => {
useStore.getState().setUpdateDownloaded(info)
})
+ const offCopyFlare = edge.onCopyFlare(() => {
+ useStore.getState().triggerCopyFlare()
+ })
return () => {
offItems()
offSettings()
@@ -89,6 +92,7 @@ export default function App() {
offTutorialStep()
offUpdateAvailable()
offUpdateDownloaded()
+ offCopyFlare()
}
}, [hydrate, setItems, setSettings, pushToast])
diff --git a/src/components/CopyIndicatorCurve.tsx b/src/components/CopyIndicatorCurve.tsx
index 1c80978..5dc3be2 100644
--- a/src/components/CopyIndicatorCurve.tsx
+++ b/src/components/CopyIndicatorCurve.tsx
@@ -1,17 +1,20 @@
/**
- * CopyIndicatorCurve — Fluid Sine-Curve SVG Morph with customizable indicator icons (Logo / Tick).
+ * Copy confirmation at the stick edge.
*
- * Morphing SVG sine-wave arc (`sin(θ)`) that extends smoothly out from the screen
- * edge whenever content is copied to the clipboard, displaying the selected icon
- * animation (GSAP Liquid Octopus Logo or Animated Tick Icon) inside the curve peak.
+ * Apple-like: one purposeful enter, a still hold, a matching exit.
+ * No looping bob, no glow bloom. Reduce Motion fades only.
*/
import { motion, AnimatePresence } from 'framer-motion'
import { useStore } from '../store/appStore'
import { LiquidOctopusLoader } from './LiquidOctopusLoader'
+/** System confirmation ease — fast settle, no bounce. */
+const EASE_OUT: [number, number, number, number] = [0.22, 1, 0.36, 1]
+const ENTER_MS = 0.3
+const ICON_FILTER = 'drop-shadow(0 1px 1px rgba(0, 0, 0, 0.35))'
+
export function TickIndicatorIcon({
fillColor = '#ffffff',
- glowColor = 'rgba(255, 255, 255, 0.85)',
size = 36
}: {
color?: string
@@ -28,51 +31,35 @@ export function TickIndicatorIcon({
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
- filter: `drop-shadow(0 0 12px ${glowColor}) drop-shadow(0 0 4px ${glowColor})`
+ filter: ICON_FILTER
}}
>
- {/* Floating & Breathing Motion Wrapper */}
- <motion.div
- animate={{
- y: [-2, 2, -2],
- scale: [0.98, 1.03, 0.98]
- }}
- transition={{
- duration: 2.4,
- ease: 'easeInOut',
- repeat: Infinity,
- repeatType: 'mirror'
- }}
- style={{ display: 'flex', alignItems: 'center', justifyContent: 'center' }}
+ <svg
+ width={size}
+ height={size}
+ viewBox="0 0 24 24"
+ fill="none"
+ xmlns="http://www.w3.org/2000/svg"
+ shapeRendering="geometricPrecision"
+ style={{ display: 'block', overflow: 'visible' }}
>
- <svg
- width={size}
- height={size}
- viewBox="0 0 24 24"
- fill="none"
- xmlns="http://www.w3.org/2000/svg"
- shapeRendering="geometricPrecision"
- style={{ display: 'block', overflow: 'visible' }}
- >
- <motion.path
- d="M 5.0 12.5 L 9.5 17.0 L 22.8 2.8"
- stroke={fillColor}
- strokeWidth="3.2"
- strokeLinecap="round"
- strokeLinejoin="round"
- initial={{ pathLength: 0, opacity: 0 }}
- animate={{ pathLength: 1, opacity: 1 }}
- transition={{ duration: 0.35, ease: [0.16, 1, 0.3, 1] }}
- />
- </svg>
- </motion.div>
+ <motion.path
+ d="M 5.0 12.5 L 9.5 17.0 L 22.8 2.8"
+ stroke={fillColor}
+ strokeWidth="2.6"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ initial={{ pathLength: 0, opacity: 0 }}
+ animate={{ pathLength: 1, opacity: 1 }}
+ transition={{ duration: 0.28, ease: EASE_OUT }}
+ />
+ </svg>
</div>
)
}
export function CopyIndicatorIcon({
fillColor = '#ffffff',
- glowColor = 'rgba(255, 255, 255, 0.85)',
size = 36
}: {
fillColor?: string
@@ -90,76 +77,53 @@ export function CopyIndicatorIcon({
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
- filter: `drop-shadow(0 0 10px ${glowColor})`
+ filter: ICON_FILTER
}}
>
- {/* Floating & Breathing Motion Wrapper */}
- <motion.div
- animate={{
- y: [-2.5, 2.5, -2.5],
- rotate: [-4, 4, -4],
- scale: [0.98, 1.04, 0.98]
- }}
- transition={{
- duration: 2.4,
- ease: 'easeInOut',
- repeat: Infinity,
- repeatType: 'mirror'
- }}
- style={{ display: 'flex', alignItems: 'center', justifyContent: 'center' }}
+ <svg
+ width={size}
+ height={size}
+ viewBox="0 0 24 24"
+ fill="none"
+ shapeRendering="geometricPrecision"
+ style={{ display: 'block', overflow: 'visible' }}
>
- <svg
- width={size}
- height={size}
- viewBox="0 0 24 24"
- fill="none"
- shapeRendering="geometricPrecision"
- style={{ display: 'block', overflow: 'visible' }}
- >
- <defs>
- <mask id={maskId}>
- {/* Base mask: keep everything */}
- <rect x="0" y="0" width="24" height="24" fill="#ffffff" />
- {/* Cutout gap around top-right sheet */}
- <rect x="6.8" y="0.8" width="16.4" height="16.4" rx="5.8" fill="#000000" />
- </mask>
- </defs>
-
- {/* Back Sheet (Bottom-Left) — masked to cut out a clean gap behind front sheet */}
- <motion.rect
- x="2.5"
- y="8.5"
- width="13"
- height="13"
- rx="4.2"
- fill={fillColor}
- mask={`url(#${maskId})`}
- initial={{ scale: 0.4, opacity: 0 }}
- animate={{ scale: 1, opacity: 1 }}
- transition={{ type: 'spring', stiffness: 400, damping: 22 }}
- />
-
- {/* Front Sheet (Top-Right) — pure solid fill with ZERO top/right borders */}
- <motion.rect
- x="8.5"
- y="2.5"
- width="13"
- height="13"
- rx="4.2"
- fill={fillColor}
- initial={{ scale: 0.4, opacity: 0 }}
- animate={{ scale: 1, opacity: 1 }}
- transition={{ type: 'spring', stiffness: 450, damping: 24, delay: 0.05 }}
- />
- </svg>
- </motion.div>
+ <defs>
+ <mask id={maskId}>
+ <rect x="0" y="0" width="24" height="24" fill="#ffffff" />
+ <rect x="6.8" y="0.8" width="16.4" height="16.4" rx="5.8" fill="#000000" />
+ </mask>
+ </defs>
+ <motion.rect
+ x="2.5"
+ y="8.5"
+ width="13"
+ height="13"
+ rx="4.2"
+ fill={fillColor}
+ mask={`url(#${maskId})`}
+ initial={{ scale: 0.92, opacity: 0 }}
+ animate={{ scale: 1, opacity: 1 }}
+ transition={{ duration: 0.28, ease: EASE_OUT }}
+ />
+ <motion.rect
+ x="8.5"
+ y="2.5"
+ width="13"
+ height="13"
+ rx="4.2"
+ fill={fillColor}
+ initial={{ scale: 0.92, opacity: 0 }}
+ animate={{ scale: 1, opacity: 1 }}
+ transition={{ duration: 0.28, ease: EASE_OUT, delay: 0.04 }}
+ />
+ </svg>
</div>
)
}
export function SparkleIndicatorIcon({
fillColor = '#ffffff',
- glowColor = 'rgba(255, 255, 255, 0.85)',
size = 36
}: {
fillColor?: string
@@ -175,51 +139,32 @@ export function SparkleIndicatorIcon({
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
- filter: `drop-shadow(0 0 10px ${glowColor})`
+ filter: ICON_FILTER
}}
>
- {/* Floating & Breathing Motion Wrapper */}
- <motion.div
- animate={{
- y: [-2.5, 2.5, -2.5],
- rotate: [-4, 4, -4],
- scale: [0.98, 1.04, 0.98]
- }}
- transition={{
- duration: 2.4,
- ease: 'easeInOut',
- repeat: Infinity,
- repeatType: 'mirror'
- }}
- style={{ display: 'flex', alignItems: 'center', justifyContent: 'center' }}
+ <svg
+ width={size}
+ height={size}
+ viewBox="0 0 24 24"
+ fill="none"
+ shapeRendering="geometricPrecision"
+ style={{ display: 'block', overflow: 'visible' }}
>
- <svg
- width={size}
- height={size}
- viewBox="0 0 24 24"
- fill="none"
- shapeRendering="geometricPrecision"
- style={{ display: 'block', overflow: 'visible' }}
- >
- {/* Main Sparkle (Top-Left) */}
- <motion.path
- d="M 9.5 1.5 C 9.5 5.8 5.8 9.5 1.5 9.5 C 5.8 9.5 9.5 13.2 9.5 17.5 C 9.5 13.2 13.2 9.5 17.5 9.5 C 13.2 9.5 9.5 5.8 9.5 1.5 Z"
- fill={fillColor}
- initial={{ scale: 0.3, rotate: -20, opacity: 0 }}
- animate={{ scale: 1, rotate: 0, opacity: 1 }}
- transition={{ type: 'spring', stiffness: 420, damping: 24 }}
- />
-
- {/* Secondary Sparkle (Bottom-Right) */}
- <motion.path
- d="M 18.5 12.5 C 18.5 15.2 16.2 17.5 13.5 17.5 C 16.2 17.5 18.5 19.8 18.5 22.5 C 18.5 19.8 20.8 17.5 23.5 17.5 C 20.8 17.5 18.5 15.2 18.5 12.5 Z"
- fill={fillColor}
- initial={{ scale: 0, opacity: 0 }}
- animate={{ scale: 1, opacity: 1 }}
- transition={{ type: 'spring', stiffness: 450, damping: 22, delay: 0.08 }}
- />
- </svg>
- </motion.div>
+ <motion.path
+ d="M 9.5 1.5 C 9.5 5.8 5.8 9.5 1.5 9.5 C 5.8 9.5 9.5 13.2 9.5 17.5 C 9.5 13.2 13.2 9.5 17.5 9.5 C 13.2 9.5 9.5 5.8 9.5 1.5 Z"
+ fill={fillColor}
+ initial={{ scale: 0.86, opacity: 0 }}
+ animate={{ scale: 1, opacity: 1 }}
+ transition={{ duration: 0.28, ease: EASE_OUT }}
+ />
+ <motion.path
+ d="M 18.5 12.5 C 18.5 15.2 16.2 17.5 13.5 17.5 C 16.2 17.5 18.5 19.8 18.5 22.5 C 18.5 19.8 20.8 17.5 23.5 17.5 C 20.8 17.5 18.5 15.2 18.5 12.5 Z"
+ fill={fillColor}
+ initial={{ scale: 0.86, opacity: 0 }}
+ animate={{ scale: 1, opacity: 1 }}
+ transition={{ duration: 0.28, ease: EASE_OUT, delay: 0.05 }}
+ />
+ </svg>
</div>
)
}
@@ -231,6 +176,7 @@ export function CopyIndicatorCurve() {
const settings = useStore((s) => s.settings)
const isRight = settings.stickPosition === 'right'
const indicatorStyle = settings.copyIndicatorStyle || 'logo'
+ const reduceMotion = !!settings.reduceMotion
// Spans the full height of the hover bar trigger zone
const triggerHeightPx = window.innerHeight * (settings.hotZoneHeight || 0.25)
@@ -263,8 +209,10 @@ export function CopyIndicatorCurve() {
const topOffset = `${midY}px`
const yOffset = '-50%'
+ const fade = { duration: reduceMotion ? 0.12 : ENTER_MS, ease: reduceMotion ? 'linear' : EASE_OUT }
+
return (
- <AnimatePresence mode="popLayout">
+ <AnimatePresence>
{showCurve && (
<motion.div
key={`copy-sine-curve-${flareKey}`}
@@ -272,7 +220,7 @@ export function CopyIndicatorCurve() {
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
- transition={{ duration: 0.38, ease: [0.16, 1, 0.3, 1] }}
+ transition={fade}
style={{
position: 'absolute',
top: topOffset,
@@ -284,7 +232,6 @@ export function CopyIndicatorCurve() {
zIndex: 9999
}}
>
- {/* SVG Sine-Curve Morph with Subpixel Geometric Precision Antialiasing */}
<svg
width={boxW}
height={H}
@@ -292,39 +239,25 @@ export function CopyIndicatorCurve() {
fill="none"
xmlns="http://www.w3.org/2000/svg"
shapeRendering="geometricPrecision"
- style={{
- overflow: 'visible',
- shapeRendering: 'geometricPrecision',
- textRendering: 'geometricPrecision'
- }}
+ style={{ overflow: 'visible' }}
>
<motion.path
d={activePath}
fill="#000000"
stroke="none"
- strokeWidth="0"
shapeRendering="geometricPrecision"
- initial={{ d: flatPath }}
+ initial={{ d: reduceMotion ? activePath : flatPath }}
animate={{ d: activePath }}
- exit={{ d: flatPath }}
- transition={{
- duration: 0.38,
- ease: [0.16, 1, 0.3, 1]
- }}
+ exit={{ d: reduceMotion ? activePath : flatPath }}
+ transition={fade}
/>
</svg>
- {/* Selected Copy Indicator Icon (Logo / Tick / Copy) centered inside the Curve Bulge */}
<motion.div
- initial={{ scale: 0.3, opacity: 0, x: isRight ? 10 : -10 }}
- animate={{ scale: 1, opacity: 1, x: 0 }}
- exit={{ scale: 0.3, opacity: 0, x: isRight ? 10 : -10 }}
- transition={{
- type: 'spring',
- stiffness: 420,
- damping: 24,
- delay: 0.05
- }}
+ initial={reduceMotion ? { opacity: 0 } : { scale: 0.92, opacity: 0 }}
+ animate={reduceMotion ? { opacity: 1 } : { scale: 1, opacity: 1 }}
+ exit={reduceMotion ? { opacity: 0 } : { scale: 0.92, opacity: 0 }}
+ transition={{ ...fade, delay: reduceMotion ? 0 : 0.04 }}
style={{
position: 'absolute',
top: '50%',
@@ -339,13 +272,13 @@ export function CopyIndicatorCurve() {
}}
>
{indicatorStyle === 'check' ? (
- <TickIndicatorIcon fillColor="#ffffff" glowColor="rgba(255, 255, 255, 0.85)" />
+ <TickIndicatorIcon fillColor="#ffffff" />
) : indicatorStyle === 'copy' ? (
- <CopyIndicatorIcon fillColor="#ffffff" glowColor="rgba(255, 255, 255, 0.85)" />
+ <CopyIndicatorIcon fillColor="#ffffff" />
) : indicatorStyle === 'sparkle' ? (
- <SparkleIndicatorIcon fillColor="#ffffff" glowColor="rgba(255, 255, 255, 0.85)" />
+ <SparkleIndicatorIcon fillColor="#ffffff" />
) : (
- <LiquidOctopusLoader fillColor="#ffffff" glowColor="rgba(255, 255, 255, 0.85)" speed={1.2} />
+ <LiquidOctopusLoader fillColor="#ffffff" glowColor="transparent" active={false} />
)}
</motion.div>
</motion.div>
diff --git a/src/store/appStore.ts b/src/store/appStore.ts
index 3c1f1b1..88afbad 100644
--- a/src/store/appStore.ts
+++ b/src/store/appStore.ts
@@ -365,9 +365,13 @@ export const useStore = create<AppState>((set, get) => ({
triggerCopyFlare: () => {
if (get().settings.showCopyIndicator === false) return
if (flareTimer) clearTimeout(flareTimer)
- set({ copyFlareActive: true, flareKey: Date.now() })
- if (!get().open) {
- edge.setPreviewMode(true)
+ // Already showing: only extend the hold. Restarting flareKey mid-flight
+ // is what made the indicator look late (hint, then items-push retrigger).
+ if (!get().copyFlareActive) {
+ set({ copyFlareActive: true, flareKey: Date.now() })
+ if (!get().open) {
+ edge.setPreviewMode(true)
+ }
}
flareTimer = setTimeout(() => {
set({ copyFlareActive: false })
@@ -375,7 +379,7 @@ export const useStore = create<AppState>((set, get) => ({
edge.setPreviewMode(false)
}
flareTimer = null
- }, 1400)
+ }, 780)
},
pushToast: (toast) => {
diff --git a/tests/clipboardWatcher.test.ts b/tests/clipboardWatcher.test.ts
index 6326979..7dc9fee 100644
--- a/tests/clipboardWatcher.test.ts
+++ b/tests/clipboardWatcher.test.ts
@@ -74,6 +74,30 @@ describe('ClipboardWatcher Re-Copy Detection & Flare Flow', () => {
expect(onNew).toHaveBeenCalledWith({ kind: 'text', text: 'Second Item' })
})
+ it('fires onHint immediately when the sequence number changes, before settle', async () => {
+ let mockSeq = 400
+ let mockText = 'Hint First'
+
+ vi.spyOn(formats, 'clipboardSignature').mockImplementation(() => `seq:${mockSeq}:text:${mockText}`)
+ vi.spyOn(formats, 'readClipboard').mockImplementation(async () => ({ kind: 'text', text: mockText }))
+
+ const onNew = vi.fn()
+ const onHint = vi.fn()
+ watcher = new ClipboardWatcher(50, 150)
+ watcher.start(onNew, onHint)
+
+ await vi.advanceTimersByTimeAsync(60)
+ expect(onHint).not.toHaveBeenCalled()
+
+ mockSeq = 401
+ await vi.advanceTimersByTimeAsync(60)
+ expect(onHint).toHaveBeenCalledTimes(1)
+ expect(onNew).not.toHaveBeenCalled()
+
+ await vi.advanceTimersByTimeAsync(160)
+ expect(onNew).toHaveBeenCalledTimes(1)
+ })
+
it('respects paused state during self-copy and incognito mode', async () => {
let mockSeq = 300
let mockText = 'Initial'