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.

feat(audio): added Edge Location Hint pulse, playDeleteSound synthesizer, and global Sound Effects toggle

Deepender252092c4cc6671
diff --git a/shared/types.ts b/shared/types.ts
index 3cc75d2..3d62174 100644
--- a/shared/types.ts
+++ b/shared/types.ts
@@ -154,6 +154,10 @@ export interface Settings {
verticalOffset: number
/** Vertical alignment of the hover trigger strip relative to shelf ('top' | 'center' | 'bottom'). Default: 'center'. */
triggerAlignment?: 'top' | 'center' | 'bottom'
+ /** When true, subtly illuminates a beacon hint on the screen edge when touching the edge at a different position. Default: true. */
+ showEdgeLocationHint?: boolean
+ /** When true, plays tactile audio sound effects for sliders, buttons, and switches. Default: true. */
+ soundEffects?: boolean
/** Last version for which the user opened/viewed the What's New changelog panel. */
lastSeenChangelogVersion?: string
}
@@ -180,6 +184,8 @@ export const DEFAULT_SETTINGS: Settings = {
copyIndicatorStyle: 'logo',
verticalOffset: 0.5,
triggerAlignment: 'center',
+ showEdgeLocationHint: true,
+ soundEffects: true,
lastSeenChangelogVersion: undefined
}
diff --git a/src/components/ClipboardItem.tsx b/src/components/ClipboardItem.tsx
index 430e262..da502d9 100644
--- a/src/components/ClipboardItem.tsx
+++ b/src/components/ClipboardItem.tsx
@@ -23,7 +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 { playButtonClickSound, playToggleSound, playDeleteSound } from '../lib/soundEffects'
import { CopyIcon, FileKindIcon, ImageIcon, LinkIcon, PinIcon, PinFillIcon, TrashIcon, MinusIcon, ChevronUpIcon, ExpandIcon, ContractIcon, ExternalLinkIcon } from './icons'
import '../styles/item.css'
@@ -256,7 +256,7 @@ function ClipboardItemBase({ item }: Props) {
title="Delete"
onClick={(e) => {
e.currentTarget.blur()
- playButtonClickSound()
+ playDeleteSound()
remove(item.id)
}}
>
diff --git a/src/components/Panel.tsx b/src/components/Panel.tsx
index c0083d5..6d41078 100644
--- a/src/components/Panel.tsx
+++ b/src/components/Panel.tsx
@@ -29,6 +29,7 @@ export function Panel() {
const setSettingsOpen = useStore((s) => s.setSettingsOpen)
const setQuery = useStore((s) => s.setQuery)
const bounceAnimation = settings.bounceAnimation
+ const edgeHintActive = useStore((s) => s.edgeHintActive)
useEffect(() => {
if (!open) {
@@ -259,6 +260,31 @@ export function Panel() {
opacity: { duration: open ? 0.12 : 0.08, ease: 'easeOut' }
}}
>
+ {/* Edge Location Hint Beacon (Ultra-subtle fast hairline pulse when touching edge at wrong position) */}
+ <AnimatePresence>
+ {!open && edgeHintActive && (settings.showEdgeLocationHint ?? true) && (
+ <motion.div
+ key="edge-location-beacon"
+ initial={{ opacity: 0 }}
+ animate={{ opacity: 0.28 }}
+ exit={{ opacity: 0 }}
+ transition={{ duration: 0.15, ease: 'easeInOut' }}
+ style={{
+ position: 'absolute',
+ top: insetTop,
+ bottom: insetBottom,
+ [isRight ? 'right' : 'left']: 0,
+ width: 1.5,
+ boxSizing: 'border-box',
+ background: 'linear-gradient(to bottom, transparent, rgba(255, 255, 255, 0.45) 35%, rgba(255, 255, 255, 0.45) 65%, transparent)',
+ boxShadow: '0 0 4px rgba(255, 255, 255, 0.2)',
+ borderRadius: isRight ? '999px 0 0 999px' : '0 999px 999px 0',
+ pointerEvents: 'none',
+ zIndex: 99
+ }}
+ />
+ )}
+ </AnimatePresence>
{isRight ? (
<>
<div className="flare-top flare-right">
diff --git a/src/components/Settings.tsx b/src/components/Settings.tsx
index fbf5dcc..4c34799 100644
--- a/src/components/Settings.tsx
+++ b/src/components/Settings.tsx
@@ -341,6 +341,19 @@ export function Settings({ inlineIndicatorStyle }: { inlineIndicatorStyle?: bool
{/* ══ GROUP: Trigger zone ═════════════════════════════════════════ */}
<div className="setting-group-label" style={{ marginTop: 20 }}>Trigger Zone</div>
+ <div className="setting-row">
+ <div className="setting-info">
+ <div className="setting-title">Edge location hint</div>
+ <div className="setting-desc">Subtly illuminate beacon on screen edge when touching edge at wrong position</div>
+ </div>
+ <Toggle
+ checked={settings.showEdgeLocationHint ?? true}
+ onChange={(v) => patch({ showEdgeLocationHint: v })}
+ />
+ </div>
+
+ <div className="setting-divider" />
+
<div className="setting-row vertical">
<div className="setting-info">
<div className="setting-title">Edge trigger position</div>
@@ -619,6 +632,23 @@ export function Settings({ inlineIndicatorStyle }: { inlineIndicatorStyle?: bool
</>
)}
+ {/* ══ GROUP: AUDIO & FEEDBACK ═════════════════════════════════════ */}
+ <div className="setting-group-label" style={{ marginTop: 20 }}>AUDIO & FEEDBACK</div>
+
+ <div className="setting-row">
+ <div className="setting-info">
+ <div className="setting-title">Sound effects</div>
+ <div className="setting-desc">Tactile audio feedback for sliders, buttons, and switches</div>
+ </div>
+ <Toggle
+ checked={settings.soundEffects ?? true}
+ onChange={(v) => {
+ if (v) playToggleSound(true)
+ patch({ soundEffects: v })
+ }}
+ />
+ </div>
+
{/* ══ GROUP: ANIMATIONS ═══════════════════════════════════════════ */}
<div className="setting-group-label" style={{ marginTop: 20 }}>ANIMATIONS</div>
diff --git a/src/hooks/useEdgeHover.ts b/src/hooks/useEdgeHover.ts
index c1c89b2..9be80e9 100644
--- a/src/hooks/useEdgeHover.ts
+++ b/src/hooks/useEdgeHover.ts
@@ -277,6 +277,21 @@ export function useEdgeHover(): void {
cancelClose()
}
+ let edgeHintTimer: number | undefined
+ let edgeHintFired = false
+
+ const triggerEdgeHint = () => {
+ if (edgeHintFired) return
+ edgeHintFired = true
+ const s = useStore.getState()
+ s.setEdgeHintActive(true)
+ if (edgeHintTimer !== undefined) window.clearTimeout(edgeHintTimer)
+ edgeHintTimer = window.setTimeout(() => {
+ edgeHintTimer = undefined
+ useStore.getState().setEdgeHintActive(false)
+ }, 300)
+ }
+
// ── main-process cursor poll (replaces broken pointermove forwarding) ──
// The main process polls screen.getCursorScreenPoint() every 16ms and
// sends window:cursor-edge with raw x/y coords. We check the hot zone
@@ -293,10 +308,19 @@ export function useEdgeHover(): void {
switch (stickPosition) {
case 'right': {
const distFromRight = displayWidth - data.x
- const inEdge = distFromRight >= -BUFFER_PX && distFromRight <= TRIGGER_PX
+ const inEdgeNear = distFromRight >= -BUFFER_PX && distFromRight <= (TRIGGER_PX + 25)
const inZone = data.y >= top && data.y <= bottom
- if (inEdge && inZone && !state.open) {
+ if (!inEdgeNear) {
+ edgeHintFired = false
+ }
+
+ if (inEdgeNear && !inZone && !state.open && (state.settings.showEdgeLocationHint ?? true)) {
+ triggerEdgeHint()
+ }
+
+ if (distFromRight >= -BUFFER_PX && distFromRight <= TRIGGER_PX && inZone && !state.open) {
+ if (state.edgeHintActive) state.setEdgeHintActive(false)
cancelClose()
if (dwellTimer === undefined) {
dwellTimer = window.setTimeout(() => {
@@ -314,6 +338,8 @@ export function useEdgeHover(): void {
if (!state.open) return
+ if (state.edgeHintActive) state.setEdgeHintActive(false)
+
const now = Date.now()
if (now - lastSetInteractiveRef.current > 2000) {
lastSetInteractiveRef.current = now
@@ -342,10 +368,19 @@ export function useEdgeHover(): void {
// left
default: {
- const inEdge = data.x >= -BUFFER_PX && data.x <= TRIGGER_PX
+ const inEdgeNear = data.x >= -BUFFER_PX && data.x <= (TRIGGER_PX + 25)
const inZone = data.y >= top && data.y <= bottom
- if (inEdge && inZone && !state.open) {
+ if (!inEdgeNear) {
+ edgeHintFired = false
+ }
+
+ if (inEdgeNear && !inZone && !state.open && (state.settings.showEdgeLocationHint ?? true)) {
+ triggerEdgeHint()
+ }
+
+ if (data.x >= -BUFFER_PX && data.x <= TRIGGER_PX && inZone && !state.open) {
+ if (state.edgeHintActive) state.setEdgeHintActive(false)
cancelClose()
if (dwellTimer === undefined) {
dwellTimer = window.setTimeout(() => {
@@ -363,6 +398,8 @@ export function useEdgeHover(): void {
if (!state.open) return
+ if (state.edgeHintActive) state.setEdgeHintActive(false)
+
const now = Date.now()
if (now - lastSetInteractiveRef.current > 2000) {
lastSetInteractiveRef.current = now
diff --git a/src/lib/soundEffects.ts b/src/lib/soundEffects.ts
index ce4da66..bf72c99 100644
--- a/src/lib/soundEffects.ts
+++ b/src/lib/soundEffects.ts
@@ -3,9 +3,21 @@
* Provides zero-latency, tactile mechanical audio effects for sliders, toggles, and buttons.
*/
+import { useStore } from '../store/appStore'
+
let audioCtx: AudioContext | null = null
+function isSoundEnabled(): boolean {
+ if (typeof window === 'undefined') return false
+ try {
+ return useStore.getState().settings.soundEffects !== false
+ } catch {
+ return true
+ }
+}
+
function getAudioContext(): AudioContext | null {
+ if (!isSoundEnabled()) return null
if (typeof window === 'undefined') return null
if (!audioCtx) {
const AudioContextClass = window.AudioContext || (window as any).webkitAudioContext
@@ -19,6 +31,25 @@ function getAudioContext(): AudioContext | null {
return audioCtx
}
+// Global auto-unlock listener: resumes AudioContext on first pointerdown/mouseenter/keydown
+if (typeof window !== 'undefined') {
+ const unlockAudio = () => {
+ const ctx = getAudioContext()
+ if (ctx && ctx.state === 'suspended') {
+ ctx.resume().then(() => {
+ if (ctx.state === 'running') {
+ window.removeEventListener('pointerdown', unlockAudio, true)
+ window.removeEventListener('mouseenter', unlockAudio, true)
+ window.removeEventListener('keydown', unlockAudio, true)
+ }
+ }).catch(() => {})
+ }
+ }
+ window.addEventListener('pointerdown', unlockAudio, true)
+ window.addEventListener('mouseenter', unlockAudio, true)
+ window.addEventListener('keydown', unlockAudio, true)
+}
+
/**
* Plays a satisfying mechanical rotary dial tick sound.
* Emulates a camera dial / Apple Watch Digital Crown detent click.
@@ -28,41 +59,49 @@ export function playDialTickSound(): void {
const ctx = getAudioContext()
if (!ctx) return
- const now = ctx.currentTime
+ const play = () => {
+ const now = ctx.currentTime
- // 1. High-frequency metallic ratchet sweep (2600Hz -> 700Hz in 10ms)
- const osc = ctx.createOscillator()
- const gain = ctx.createGain()
+ // 1. High-frequency metallic ratchet sweep (2600Hz -> 700Hz in 10ms)
+ const osc = ctx.createOscillator()
+ const gain = ctx.createGain()
- osc.type = 'sine'
- osc.frequency.setValueAtTime(2600, now)
- osc.frequency.exponentialRampToValueAtTime(700, now + 0.01)
+ osc.type = 'sine'
+ osc.frequency.setValueAtTime(2600, now)
+ osc.frequency.exponentialRampToValueAtTime(700, now + 0.01)
- gain.gain.setValueAtTime(0.18, now)
- gain.gain.exponentialRampToValueAtTime(0.001, now + 0.01)
+ gain.gain.setValueAtTime(0.18, now)
+ gain.gain.exponentialRampToValueAtTime(0.001, now + 0.01)
- osc.connect(gain)
- gain.connect(ctx.destination)
+ osc.connect(gain)
+ gain.connect(ctx.destination)
- osc.start(now)
- osc.stop(now + 0.01)
+ osc.start(now)
+ osc.stop(now + 0.01)
- // 2. Subtle low-end mechanical detent thud (180Hz -> 60Hz in 12ms)
- const bodyOsc = ctx.createOscillator()
- const bodyGain = ctx.createGain()
+ // 2. Subtle low-end mechanical detent thud (180Hz -> 60Hz in 12ms)
+ const bodyOsc = ctx.createOscillator()
+ const bodyGain = ctx.createGain()
- bodyOsc.type = 'triangle'
- bodyOsc.frequency.setValueAtTime(180, now)
- bodyOsc.frequency.exponentialRampToValueAtTime(60, now + 0.012)
+ bodyOsc.type = 'triangle'
+ bodyOsc.frequency.setValueAtTime(180, now)
+ bodyOsc.frequency.exponentialRampToValueAtTime(60, now + 0.012)
- bodyGain.gain.setValueAtTime(0.12, now)
- bodyGain.gain.exponentialRampToValueAtTime(0.001, now + 0.012)
+ bodyGain.gain.setValueAtTime(0.12, now)
+ bodyGain.gain.exponentialRampToValueAtTime(0.001, now + 0.012)
- bodyOsc.connect(bodyGain)
- bodyGain.connect(ctx.destination)
+ bodyOsc.connect(bodyGain)
+ bodyGain.connect(ctx.destination)
- bodyOsc.start(now)
- bodyOsc.stop(now + 0.012)
+ bodyOsc.start(now)
+ bodyOsc.stop(now + 0.012)
+ }
+
+ if (ctx.state === 'suspended') {
+ ctx.resume().then(() => play()).catch(() => {})
+ } else {
+ play()
+ }
} catch {
/* ignore Web Audio API restrictions */
}
@@ -77,44 +116,52 @@ export function playToggleSound(enabled: boolean): void {
const ctx = getAudioContext()
if (!ctx) return
- const now = ctx.currentTime
+ const play = () => {
+ const now = ctx.currentTime
- const osc = ctx.createOscillator()
- const gain = ctx.createGain()
+ 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
+ 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)
+ 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)
+ gain.gain.setValueAtTime(vol, now)
+ gain.gain.exponentialRampToValueAtTime(0.001, now + 0.014)
- osc.connect(gain)
- gain.connect(ctx.destination)
+ osc.connect(gain)
+ gain.connect(ctx.destination)
- osc.start(now)
- osc.stop(now + 0.014)
+ osc.start(now)
+ osc.stop(now + 0.014)
- // Mechanical click thud
- const bodyOsc = ctx.createOscillator()
- const bodyGain = ctx.createGain()
+ // 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)
+ 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)
+ bodyGain.gain.setValueAtTime(0.10, now)
+ bodyGain.gain.exponentialRampToValueAtTime(0.001, now + 0.016)
- bodyOsc.connect(bodyGain)
- bodyGain.connect(ctx.destination)
+ bodyOsc.connect(bodyGain)
+ bodyGain.connect(ctx.destination)
- bodyOsc.start(now)
- bodyOsc.stop(now + 0.016)
+ bodyOsc.start(now)
+ bodyOsc.stop(now + 0.016)
+ }
+
+ if (ctx.state === 'suspended') {
+ ctx.resume().then(() => play()).catch(() => {})
+ } else {
+ play()
+ }
} catch {
/* ignore Web Audio API restrictions */
}
@@ -129,23 +176,89 @@ export function playButtonClickSound(): void {
const ctx = getAudioContext()
if (!ctx) return
- const now = ctx.currentTime
+ const play = () => {
+ 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)
+ }
+
+ if (ctx.state === 'suspended') {
+ ctx.resume().then(() => play()).catch(() => {})
+ } else {
+ play()
+ }
+ } catch {
+ /* ignore Web Audio API restrictions */
+ }
+}
+
+/**
+ * Plays a satisfying downward popping delete sound.
+ * Pitch sweeps rapidly downward (1400Hz -> 250Hz) with a soft low-end thud (150Hz -> 40Hz)
+ * to instantly signify item removal/deletion.
+ */
+export function playDeleteSound(): void {
+ try {
+ const ctx = getAudioContext()
+ if (!ctx) return
+
+ const play = () => {
+ const now = ctx.currentTime
+
+ // 1. Downward popping pitch sweep (1400Hz -> 250Hz in 14ms)
+ const osc = ctx.createOscillator()
+ const gain = ctx.createGain()
+
+ osc.type = 'sine'
+ osc.frequency.setValueAtTime(1400, now)
+ osc.frequency.exponentialRampToValueAtTime(250, now + 0.014)
+
+ gain.gain.setValueAtTime(0.14, now)
+ gain.gain.exponentialRampToValueAtTime(0.001, now + 0.014)
- const osc = ctx.createOscillator()
- const gain = ctx.createGain()
+ osc.connect(gain)
+ gain.connect(ctx.destination)
- osc.type = 'sine'
- osc.frequency.setValueAtTime(2100, now)
- osc.frequency.exponentialRampToValueAtTime(900, now + 0.009)
+ osc.start(now)
+ osc.stop(now + 0.014)
- gain.gain.setValueAtTime(0.10, now)
- gain.gain.exponentialRampToValueAtTime(0.001, now + 0.009)
+ // 2. Soft mechanical release thud (150Hz -> 40Hz in 16ms)
+ const bodyOsc = ctx.createOscillator()
+ const bodyGain = ctx.createGain()
- osc.connect(gain)
- gain.connect(ctx.destination)
+ bodyOsc.type = 'triangle'
+ bodyOsc.frequency.setValueAtTime(150, now)
+ bodyOsc.frequency.exponentialRampToValueAtTime(40, now + 0.016)
- osc.start(now)
- osc.stop(now + 0.009)
+ bodyGain.gain.setValueAtTime(0.12, now)
+ bodyGain.gain.exponentialRampToValueAtTime(0.001, now + 0.016)
+
+ bodyOsc.connect(bodyGain)
+ bodyGain.connect(ctx.destination)
+
+ bodyOsc.start(now)
+ bodyOsc.stop(now + 0.016)
+ }
+
+ if (ctx.state === 'suspended') {
+ ctx.resume().then(() => play()).catch(() => {})
+ } else {
+ play()
+ }
} catch {
/* ignore Web Audio API restrictions */
}
diff --git a/src/store/appStore.ts b/src/store/appStore.ts
index 01bda0f..72d52c8 100644
--- a/src/store/appStore.ts
+++ b/src/store/appStore.ts
@@ -54,6 +54,8 @@ interface AppState {
setSliderActive: (active: boolean) => void
notifyPositionChanged: () => void
resetPositionChangedTime: () => void
+ edgeHintActive: boolean
+ setEdgeHintActive: (active: boolean) => void
/* hydration + sync */
hydrate: () => Promise<void>
@@ -120,6 +122,8 @@ export const useStore = create<AppState>((set, get) => ({
}),
notifyPositionChanged: () => set({ sliderReleasedTime: Date.now() }),
resetPositionChangedTime: () => set({ sliderReleasedTime: 0 }),
+ edgeHintActive: false,
+ setEdgeHintActive: (active) => set({ edgeHintActive: active }),
styleFlyoutOpen: false,
setStyleFlyoutOpen: (open) => {
set({ styleFlyoutOpen: open, ...(open ? {} : { previewFlyoutRect: null }) })