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.
TypeScript clipboardclipboard-managerdesktop-appdrag-and-dropelectronopen-sourceproductivityproductivity-toolwindows
feat(audio): Web Audio API haptic sound suite for toggles and buttons; 1.75s edge and display switch preview window
Deepender254782304b3a38
diff --git a/src/components/ClipboardItem.tsx b/src/components/ClipboardItem.tsxindex 6881a30..430e262 100644--- a/src/components/ClipboardItem.tsx+++ b/src/components/ClipboardItem.tsx@@ -23,6 +23,7 @@ import { useStore } from '../store/appStore'import { useDragOut } from '../hooks/useDragOut'import { basename, formatBytes, previewText, relativeTime } from '../lib/format'import { getFileKind } from '../lib/fileType'+import { playButtonClickSound, playToggleSound } from '../lib/soundEffects'import { CopyIcon, FileKindIcon, ImageIcon, LinkIcon, PinIcon, PinFillIcon, TrashIcon, MinusIcon, ChevronUpIcon, ExpandIcon, ContractIcon, ExternalLinkIcon } from './icons'import '../styles/item.css'@@ -61,6 +62,7 @@ function ClipboardItemBase({ item }: Props) {const onCopy = useCallback((e: React.MouseEvent) => {e.stopPropagation()+ playButtonClickSound()copy(item.id)setCopied(true)window.setTimeout(() => setCopied(false), 900)@@ -208,6 +210,7 @@ function ClipboardItemBase({ item }: Props) {title={item.pinned ? 'Unpin' : 'Pin'}onClick={(e) => {e.currentTarget.blur()+ playToggleSound(!item.pinned)togglePin(item.id, !item.pinned)}}>@@ -219,6 +222,7 @@ function ClipboardItemBase({ item }: Props) {onClick={(e) => {e.stopPropagation()e.currentTarget.blur()+ playButtonClickSound()const rect = e.currentTarget.closest('.item-main')?.getBoundingClientRect()const rectData = rect ? { y: rect.y, height: rect.height } : undefineduseStore.getState().setPreviewItemId(isPreviewing ? null : item.id, rectData)@@ -239,6 +243,7 @@ function ClipboardItemBase({ item }: Props) {onClick={(e) => {e.stopPropagation()e.currentTarget.blur()+ playButtonClickSound()window.open((item.data as any).text, '_blank')}}>@@ -251,6 +256,7 @@ function ClipboardItemBase({ item }: Props) {title="Delete"onClick={(e) => {e.currentTarget.blur()+ playButtonClickSound()remove(item.id)}}>diff --git a/src/components/Header.tsx b/src/components/Header.tsxindex 86241cd..1baf480 100644--- a/src/components/Header.tsx+++ b/src/components/Header.tsx@@ -2,6 +2,7 @@import { motion } from 'framer-motion'import { useStore } from '../store/appStore'import { GearIcon, CloseIcon, InfoIcon } from './icons'+import { playButtonClickSound } from '../lib/soundEffects'export function Header() {const setSettingsOpen = useStore((s) => s.setSettingsOpen)@@ -92,7 +93,10 @@ export function Header() {key={f.id}type="button"className={`filter-chip${active ? ' active' : ''}`}- onClick={() => setTypeFilter(f.id)}+ onClick={() => {+ playButtonClickSound()+ setTypeFilter(f.id)+ }}style={{position: 'relative',display: 'inline-flex',@@ -127,7 +131,10 @@ export function Header() {type="button"className={`icon-btn${settingsSubView === 'changelog' ? ' active' : ''}`}title={settingsSubView === 'changelog' ? "Back to Settings" : "What's New"}- onClick={handleOpenChangelog}+ onClick={() => {+ playButtonClickSound()+ handleOpenChangelog()+ }}style={{color: settingsSubView === 'changelog' ? '#ffffff' : 'rgba(255, 255, 255, 0.75)',background: settingsSubView === 'changelog' ? 'rgba(255, 255, 255, 0.12)' : 'transparent',@@ -169,6 +176,7 @@ export function Header() {className={`icon-btn${settingsOpen ? ' active' : ''}`}title={settingsOpen ? 'Close Settings' : 'Settings'}onClick={() => {+ playButtonClickSound()setSettingsOpen(!settingsOpen)if (settingsOpen) {setSettingsSubView('main')diff --git a/src/components/IndicatorStyleFlyout.tsx b/src/components/IndicatorStyleFlyout.tsxindex e7b58e3..271ebee 100644--- a/src/components/IndicatorStyleFlyout.tsx+++ b/src/components/IndicatorStyleFlyout.tsx@@ -12,6 +12,7 @@ import { useStore } from '../store/appStore'import { LiquidOctopusLoader } from './LiquidOctopusLoader'import { TickIndicatorIcon, CopyIndicatorIcon, SparkleIndicatorIcon } from './CopyIndicatorCurve'import { CloseIcon } from './icons'+import { playButtonClickSound } from '../lib/soundEffects'import { createPortal } from 'react-dom'import { useAdaptiveSpring } from '../hooks/useAdaptiveSpring'@@ -125,7 +126,10 @@ export function IndicatorStyleFlyout({ isRight }: { isRight: boolean }) {flexShrink: 0,transition: 'background 0.15s ease, color 0.15s ease'}}- onClick={() => setStyleFlyoutOpen(false)}+ onClick={() => {+ playButtonClickSound()+ setStyleFlyoutOpen(false)+ }}title="Close Style Panel"><CloseIcon width={12} height={12} />@@ -138,6 +142,7 @@ export function IndicatorStyleFlyout({ isRight }: { isRight: boolean }) {<StyleCardactive={(settings.copyIndicatorStyle || 'logo') === 'logo'}onClick={() => {+ playButtonClickSound()patch({ copyIndicatorStyle: 'logo' })useStore.getState().triggerCopyFlare()}}@@ -149,6 +154,7 @@ export function IndicatorStyleFlyout({ isRight }: { isRight: boolean }) {<StyleCardactive={(settings.copyIndicatorStyle || 'logo') === 'check'}onClick={() => {+ playButtonClickSound()patch({ copyIndicatorStyle: 'check' })useStore.getState().triggerCopyFlare()}}@@ -160,6 +166,7 @@ export function IndicatorStyleFlyout({ isRight }: { isRight: boolean }) {<StyleCardactive={(settings.copyIndicatorStyle || 'logo') === 'copy'}onClick={() => {+ playButtonClickSound()patch({ copyIndicatorStyle: 'copy' })useStore.getState().triggerCopyFlare()}}@@ -171,6 +178,7 @@ export function IndicatorStyleFlyout({ isRight }: { isRight: boolean }) {<StyleCardactive={(settings.copyIndicatorStyle || 'logo') === 'sparkle'}onClick={() => {+ playButtonClickSound()patch({ copyIndicatorStyle: 'sparkle' })useStore.getState().triggerCopyFlare()}}diff --git a/src/components/Settings.tsx b/src/components/Settings.tsxindex 7371a58..fbe39a1 100644--- a/src/components/Settings.tsx+++ b/src/components/Settings.tsx@@ -6,7 +6,7 @@ import { LiquidOctopusLoader } from './LiquidOctopusLoader'import { TickIndicatorIcon, CopyIndicatorIcon, SparkleIndicatorIcon } from './CopyIndicatorCurve'import { ChevronRightIcon, CloseIcon, LogOutIcon } from './icons'import { ChangelogView } from './ChangelogView'-import { playDialTickSound } from '../lib/soundEffects'+import { playDialTickSound, playToggleSound, playButtonClickSound } from '../lib/soundEffects'import '../styles/settings.css'export function Settings({ inlineIndicatorStyle }: { inlineIndicatorStyle?: boolean }) {@@ -165,7 +165,7 @@ export function Settings({ inlineIndicatorStyle }: { inlineIndicatorStyle?: bool<buttonkey={opt.val}className={`pill ${settings.autoDeleteHours === opt.val ? 'active' : ''}`}- onClick={() => patch({ autoDeleteHours: opt.val })}+ onClick={() => { playButtonClickSound(); patch({ autoDeleteHours: opt.val }) }}>{opt.label}</button>@@ -190,7 +190,7 @@ export function Settings({ inlineIndicatorStyle }: { inlineIndicatorStyle?: bool<buttonkey={opt.val}className={`pill ${settings.historyLimit === opt.val ? 'active' : ''}`}- onClick={() => patch({ historyLimit: opt.val })}+ onClick={() => { playButtonClickSound(); patch({ historyLimit: opt.val }) }}>{opt.label}</button>@@ -214,7 +214,11 @@ export function Settings({ inlineIndicatorStyle }: { inlineIndicatorStyle?: bool<buttonkey={opt.label}className={`pill ${settings.stickPosition === opt.val ? 'active' : ''}`}- onClick={() => patch({ stickPosition: opt.val })}+ onClick={() => {+ playButtonClickSound()+ patch({ stickPosition: opt.val })+ useStore.getState().notifyPositionChanged()+ }}>{opt.label}</button>@@ -320,7 +324,11 @@ export function Settings({ inlineIndicatorStyle }: { inlineIndicatorStyle?: bool<buttonkey={d.id}className={`pill display-pill ${isActive ? 'active' : ''}`}- onClick={() => patch({ stickDisplayId: d.id })}+ onClick={() => {+ playButtonClickSound()+ patch({ stickDisplayId: d.id })+ useStore.getState().notifyPositionChanged()+ }}><div className="pill-name">{d.name}</div><div className="pill-res">{d.resolution}</div>@@ -347,7 +355,10 @@ export function Settings({ inlineIndicatorStyle }: { inlineIndicatorStyle?: bool<buttonkey={opt.label}className={`pill ${Math.abs(settings.hotZoneHeight - opt.val) < 0.08 ? 'active' : ''}`}- onClick={() => patch({ hotZoneHeight: opt.val })}+ onClick={() => {+ playButtonClickSound()+ patch({ hotZoneHeight: opt.val })+ }}>{opt.label}</button>@@ -371,7 +382,10 @@ export function Settings({ inlineIndicatorStyle }: { inlineIndicatorStyle?: bool<buttonkey={opt.label}className={`pill ${settings.hotZoneWidth === opt.val ? 'active' : ''}`}- onClick={() => patch({ hotZoneWidth: opt.val })}+ onClick={() => {+ playButtonClickSound()+ patch({ hotZoneWidth: opt.val })+ }}>{opt.label}</button>@@ -395,7 +409,10 @@ export function Settings({ inlineIndicatorStyle }: { inlineIndicatorStyle?: bool<buttonkey={opt.label}className={`pill ${Math.abs((settings.panelHeight || 0.6) - opt.val) < 0.08 ? 'active' : ''}`}- onClick={() => patch({ panelHeight: opt.val })}+ onClick={() => {+ playButtonClickSound()+ patch({ panelHeight: opt.val })+ }}>{opt.label}</button>@@ -439,7 +456,10 @@ export function Settings({ inlineIndicatorStyle }: { inlineIndicatorStyle?: booltype="button"className={`icon-btn style-preview-toggle-btn ${isFlyoutActive ? 'active' : ''}`}title={isFlyoutActive ? 'Close Style Selector' : 'Open Indicator Style Selector'}- onClick={handleToggleFlyout}+ onClick={() => {+ playButtonClickSound()+ handleToggleFlyout()+ }}>{isFlyoutActive ? <CloseIcon /> : <ChevronRightIcon />}</button>@@ -464,7 +484,10 @@ export function Settings({ inlineIndicatorStyle }: { inlineIndicatorStyle?: bool}}>{/* Logo Card */}<div- onClick={() => patch({ copyIndicatorStyle: 'logo' })}+ onClick={() => {+ playButtonClickSound()+ patch({ copyIndicatorStyle: 'logo' })+ }}style={{background: (settings.copyIndicatorStyle || 'logo') === 'logo' ? 'rgba(255, 255, 255, 0.12)' : 'rgba(255, 255, 255, 0.04)',border: (settings.copyIndicatorStyle || 'logo') === 'logo' ? '1px solid rgba(255, 255, 255, 0.3)' : '1px solid rgba(255, 255, 255, 0.06)',@@ -487,7 +510,10 @@ export function Settings({ inlineIndicatorStyle }: { inlineIndicatorStyle?: bool{/* Tick Card */}<div- onClick={() => patch({ copyIndicatorStyle: 'check' })}+ onClick={() => {+ playButtonClickSound()+ patch({ copyIndicatorStyle: 'check' })+ }}style={{background: settings.copyIndicatorStyle === 'check' ? 'rgba(255, 255, 255, 0.12)' : 'rgba(255, 255, 255, 0.04)',border: settings.copyIndicatorStyle === 'check' ? '1px solid rgba(255, 255, 255, 0.3)' : '1px solid rgba(255, 255, 255, 0.06)',@@ -510,7 +536,10 @@ export function Settings({ inlineIndicatorStyle }: { inlineIndicatorStyle?: bool{/* Copy Card */}<div- onClick={() => patch({ copyIndicatorStyle: 'copy' })}+ onClick={() => {+ playButtonClickSound()+ patch({ copyIndicatorStyle: 'copy' })+ }}style={{background: settings.copyIndicatorStyle === 'copy' ? 'rgba(255, 255, 255, 0.12)' : 'rgba(255, 255, 255, 0.04)',border: settings.copyIndicatorStyle === 'copy' ? '1px solid rgba(255, 255, 255, 0.3)' : '1px solid rgba(255, 255, 255, 0.06)',@@ -533,7 +562,10 @@ export function Settings({ inlineIndicatorStyle }: { inlineIndicatorStyle?: bool{/* Sparkle Card */}<div- onClick={() => patch({ copyIndicatorStyle: 'sparkle' })}+ onClick={() => {+ playButtonClickSound()+ patch({ copyIndicatorStyle: 'sparkle' })+ }}style={{background: settings.copyIndicatorStyle === 'sparkle' ? 'rgba(255, 255, 255, 0.12)' : 'rgba(255, 255, 255, 0.04)',border: settings.copyIndicatorStyle === 'sparkle' ? '1px solid rgba(255, 255, 255, 0.3)' : '1px solid rgba(255, 255, 255, 0.06)',@@ -585,7 +617,10 @@ export function Settings({ inlineIndicatorStyle }: { inlineIndicatorStyle?: bool<buttonclassName="pill display-pill"style={{ width: '100%', justifyContent: 'center', padding: '7px 14px', cursor: 'pointer', whiteSpace: 'nowrap', fontSize: '12.5px' }}- onClick={() => window.open('https://github.com/Deepender25/Edge-Drop/issues/new/choose', '_blank')}+ onClick={() => {+ playButtonClickSound()+ window.open('https://github.com/Deepender25/Edge-Drop/issues/new/choose', '_blank')+ }}>Submit Feedback ↗</button>@@ -601,7 +636,10 @@ export function Settings({ inlineIndicatorStyle }: { inlineIndicatorStyle?: bool</div><buttonclassName="quit-app-btn"- onClick={() => void window.edge.quitApp()}+ onClick={() => {+ playButtonClickSound()+ void window.edge.quitApp()+ }}><LogOutIcon width={14} height={14} />Quit Edge-Drop@@ -617,7 +655,10 @@ export function Settings({ inlineIndicatorStyle }: { inlineIndicatorStyle?: bool</div><buttonclassName="github-promo-btn"- onClick={() => window.open('https://github.com/Deepender25/Edge-Drop', '_blank')}+ onClick={() => {+ playButtonClickSound()+ window.open('https://github.com/Deepender25/Edge-Drop', '_blank')+ }}><svgclassName="star-icon"@@ -655,7 +696,10 @@ function Toggle({className={`setting-toggle${checked ? ' checked' : ''}`}role="switch"aria-checked={checked}- onClick={() => onChange(!checked)}+ onClick={() => {+ playToggleSound(!checked)+ onChange(!checked)+ }}style={{flexShrink: 0,width: 38,diff --git a/src/hooks/useEdgeHover.ts b/src/hooks/useEdgeHover.tsindex 9a14d03..623322e 100644--- a/src/hooks/useEdgeHover.ts+++ b/src/hooks/useEdgeHover.ts@@ -162,12 +162,12 @@ export function useEdgeHover(): void {if (state.dragActive && !state.internalDragReq) returnif (graceTimer !== undefined) return // already closing- // If the user recently released the slider (< 1.5s ago), wait out the remaining 1.5s window- const timeSinceSliderRelease = state.sliderReleasedTime > 0 ? Date.now() - state.sliderReleasedTime : Infinity+ // If position/display/slider was recently changed (< 1.75s ago), wait out remaining preview stay window+ const timeSincePositionChange = state.sliderReleasedTime > 0 ? Date.now() - state.sliderReleasedTime : Infinitylet effectiveDelay = delay- if (timeSinceSliderRelease < 1500) {- effectiveDelay = Math.max(delay, 1500 - timeSinceSliderRelease)+ if (timeSincePositionChange < 1750) {+ effectiveDelay = Math.max(delay, 1750 - timeSincePositionChange)} else if (_previewClosedByUser) {effectiveDelay = PREVIEW_CLOSE_STAY_MS}@@ -184,9 +184,9 @@ export function useEdgeHover(): void {window.clearTimeout(interactiveTimer)interactiveTimer = undefined}- // User re-entered the clipboard — clear the grace period flag so the- // next time they leave, the panel retracts at normal speed instead of- // waiting the full 2.5s safety net.+ // User re-entered the clipboard — clear the preview grace period flags so the+ // next time they leave, the panel retracts at normal speed (250ms)+ useStore.getState().resetPositionChangedTime()if (_previewClosedByUser) {_previewClosedByUser = falseif (_previewClosedTimer !== undefined) {@@ -219,8 +219,8 @@ export function useEdgeHover(): void {const isInsideBlade = () => {const state = useStore.getState()if (state.sliderActive) return true- const timeSinceSliderRelease = state.sliderReleasedTime > 0 ? Date.now() - state.sliderReleasedTime : Infinity- if (timeSinceSliderRelease < 1500) return true+ const timeSincePositionChange = state.sliderReleasedTime > 0 ? Date.now() - state.sliderReleasedTime : Infinity+ if (timeSincePositionChange < 1750) return trueconst { x, y } = lastClient.currentif (x < -BUFFER_PX || y < 0) return true // unknown — be conservative, don't closediff --git a/src/lib/soundEffects.ts b/src/lib/soundEffects.tsindex 68bf740..ce4da66 100644--- a/src/lib/soundEffects.ts+++ b/src/lib/soundEffects.ts@@ -1,6 +1,6 @@/*** Web Audio API Haptic Sound Synthesizer for Edge-Drop.- * Provides zero-latency, crisp mechanical rotary dial tick sounds.+ * Provides zero-latency, tactile mechanical audio effects for sliders, toggles, and buttons.*/let audioCtx: AudioContext | null = null@@ -21,7 +21,7 @@ function getAudioContext(): AudioContext | null {/*** Plays a satisfying mechanical rotary dial tick sound.- * Designed to emulate a high-end camera dial / Apple Watch digital crown detent click.+ * Emulates a camera dial / Apple Watch Digital Crown detent click.*/export function playDialTickSound(): void {try {@@ -64,6 +64,89 @@ export function playDialTickSound(): void {bodyOsc.start(now)bodyOsc.stop(now + 0.012)} catch {- /* ignore Web Audio API restrictions/errors */+ /* ignore Web Audio API restrictions */+ }+}++/**+ * Plays a mechanical toggle switch sound (ON / OFF).+ * Emulates a tactile hardware toggle switch snap.+ */+export function playToggleSound(enabled: boolean): void {+ try {+ const ctx = getAudioContext()+ if (!ctx) return++ const now = ctx.currentTime++ const osc = ctx.createOscillator()+ const gain = ctx.createGain()++ const startFreq = enabled ? 2200 : 1300+ const endFreq = enabled ? 950 : 450+ const vol = enabled ? 0.15 : 0.11++ osc.type = 'sine'+ osc.frequency.setValueAtTime(startFreq, now)+ osc.frequency.exponentialRampToValueAtTime(endFreq, now + 0.014)++ gain.gain.setValueAtTime(vol, now)+ gain.gain.exponentialRampToValueAtTime(0.001, now + 0.014)++ osc.connect(gain)+ gain.connect(ctx.destination)++ osc.start(now)+ osc.stop(now + 0.014)++ // Mechanical click thud+ const bodyOsc = ctx.createOscillator()+ const bodyGain = ctx.createGain()++ bodyOsc.type = 'triangle'+ bodyOsc.frequency.setValueAtTime(enabled ? 220 : 150, now)+ bodyOsc.frequency.exponentialRampToValueAtTime(enabled ? 70 : 40, now + 0.016)++ bodyGain.gain.setValueAtTime(0.10, now)+ bodyGain.gain.exponentialRampToValueAtTime(0.001, now + 0.016)++ bodyOsc.connect(bodyGain)+ bodyGain.connect(ctx.destination)++ bodyOsc.start(now)+ bodyOsc.stop(now + 0.016)+ } catch {+ /* ignore Web Audio API restrictions */+ }+}++/**+ * Plays a subtle, tactile keycap button click sound.+ * Ideal for filter chips, action buttons, pills, and icons.+ */+export function playButtonClickSound(): void {+ try {+ const ctx = getAudioContext()+ if (!ctx) return++ const now = ctx.currentTime++ const osc = ctx.createOscillator()+ const gain = ctx.createGain()++ osc.type = 'sine'+ osc.frequency.setValueAtTime(2100, now)+ osc.frequency.exponentialRampToValueAtTime(900, now + 0.009)++ gain.gain.setValueAtTime(0.10, now)+ gain.gain.exponentialRampToValueAtTime(0.001, now + 0.009)++ osc.connect(gain)+ gain.connect(ctx.destination)++ osc.start(now)+ osc.stop(now + 0.009)+ } catch {+ /* ignore Web Audio API restrictions */}}diff --git a/src/store/appStore.ts b/src/store/appStore.tsindex c11dcb8..01bda0f 100644--- a/src/store/appStore.ts+++ b/src/store/appStore.ts@@ -52,6 +52,8 @@ interface AppState {sliderActive: booleansliderReleasedTime: numbersetSliderActive: (active: boolean) => void+ notifyPositionChanged: () => void+ resetPositionChangedTime: () => void/* hydration + sync */hydrate: () => Promise<void>@@ -116,6 +118,8 @@ export const useStore = create<AppState>((set, get) => ({sliderActive: active,sliderReleasedTime: active ? 0 : Date.now()}),+ notifyPositionChanged: () => set({ sliderReleasedTime: Date.now() }),+ resetPositionChangedTime: () => set({ sliderReleasedTime: 0 }),styleFlyoutOpen: false,setStyleFlyoutOpen: (open) => {set({ styleFlyoutOpen: open, ...(open ? {} : { previewFlyoutRect: null }) })