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(settings): 5% magnetic tick slider, Web Audio mechanical dial sound, fixed Header CloseIcon layout drift, and smooth 1.5s post-release retraction
Deepender254cffbe22e5d5
diff --git a/electron/main/ipc.ts b/electron/main/ipc.tsindex d2a0566..2e64a0e 100644--- a/electron/main/ipc.ts+++ b/electron/main/ipc.ts@@ -485,9 +485,11 @@ export function registerIpc(): void {if (patch.hotZoneWidth !== undefined) {setHotZoneWidth(patch.hotZoneWidth)}- if (patch.stickPosition !== undefined || patch.stickDisplayId !== undefined) {+ if (patch.stickPosition !== undefined || patch.stickDisplayId !== undefined || patch.verticalOffset !== undefined) {repositionWindow()- popUpAndRetract(1500)+ if (patch.stickPosition !== undefined || patch.stickDisplayId !== undefined) {+ popUpAndRetract(1500)+ }}pushState.settings(next)rebuildTrayMenu()diff --git a/src/components/Header.tsx b/src/components/Header.tsxindex 3750e42..86241cd 100644--- a/src/components/Header.tsx+++ b/src/components/Header.tsx@@ -164,9 +164,8 @@ export function Header() {</button>)}- <motion.button+ <buttontype="button"- layoutclassName={`icon-btn${settingsOpen ? ' active' : ''}`}title={settingsOpen ? 'Close Settings' : 'Settings'}onClick={() => {@@ -205,7 +204,7 @@ export function Header() {}}/>)}- </motion.button>+ </button></div></div>)diff --git a/src/components/Settings.tsx b/src/components/Settings.tsxindex 0b49eaf..7371a58 100644--- a/src/components/Settings.tsx+++ b/src/components/Settings.tsx@@ -1,4 +1,4 @@-import { useEffect, useState } from 'react'+import { useEffect, useState, useRef } from 'react'import { motion, AnimatePresence } from 'framer-motion'import { useStore } from '../store/appStore'import type { DisplayInfo } from '../../shared/types'@@ -6,6 +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 '../styles/settings.css'export function Settings({ inlineIndicatorStyle }: { inlineIndicatorStyle?: boolean }) {@@ -17,6 +18,18 @@ export function Settings({ inlineIndicatorStyle }: { inlineIndicatorStyle?: boolconst styleFlyoutOpen = useStore((s) => s.styleFlyoutOpen)const setStyleFlyoutOpen = useStore((s) => s.setStyleFlyoutOpen)const settingsSubView = useStore((s) => s.settingsSubView)+ const setSliderActive = useStore((s) => s.setSliderActive)++ const lastTickVal = useRef<number>(settings.verticalOffset ?? 0.5)++ const handleSliderChange = (newVal: number) => {+ const clamped = Math.min(1.0, Math.max(0.0, newVal))+ if (Math.abs(clamped - lastTickVal.current) >= 0.04) {+ lastTickVal.current = clamped+ playDialTickSound()+ }+ patch({ verticalOffset: clamped })+ }const [localInlineOpen, setLocalInlineOpen] = useState(false)const isTutorial = inlineIndicatorStyle || (typeof window !== 'undefined' && window.location.hash.includes('onboarding'))@@ -211,26 +224,80 @@ export function Settings({ inlineIndicatorStyle }: { inlineIndicatorStyle?: bool<div className="setting-divider" />- {/* Vertical Position Presets */}- <div className="setting-row vertical">- <div className="setting-info">- <div className="setting-title">Vertical position</div>- <div className="setting-desc">Vertical alignment of the shelf along the screen edge</div>+ {/* Vertical Position Range Slider with 5% Tick Grid */}+ <div className="setting-row vertical" style={{ gap: 10 }}>+ <div className="setting-slider-header">+ <div className="setting-info">+ <div className="setting-title">Vertical position</div>+ <div className="setting-desc">Vertical alignment of the shelf along the screen edge</div>+ </div>+ <div className="setting-slider-val">+ {`${Math.round((settings.verticalOffset ?? 0.5) * 100)}%`}+ </div></div>- <div className="setting-pills">- {[- { label: 'Top', val: 0 },- { label: 'Center', val: 0.5 },- { label: 'Bottom', val: 1.0 }- ].map((opt) => (- <button- key={opt.label}- className={`pill ${Math.abs((settings.verticalOffset ?? 0.5) - opt.val) < 0.05 ? 'active' : ''}`}- onClick={() => patch({ verticalOffset: opt.val })}- >- {opt.label}- </button>- ))}++ <div className="setting-slider-wrap">+ <input+ type="range"+ min="0"+ max="1"+ step="0.05"+ className="setting-range-input"+ value={settings.verticalOffset ?? 0.5}+ style={{+ background: `linear-gradient(to right, #ffffff 0%, #ffffff ${(settings.verticalOffset ?? 0.5) * 100}%, rgba(255, 255, 255, 0.12) ${(settings.verticalOffset ?? 0.5) * 100}%, rgba(255, 255, 255, 0.12) 100%)`+ }}+ onPointerDown={() => {+ void window.edge.setInteractive(true)+ setSliderActive(true)+ }}+ onPointerUp={() => setSliderActive(false)}+ onPointerCancel={() => setSliderActive(false)}+ onLostPointerCapture={() => setSliderActive(false)}+ onChange={(e) => {+ const raw = parseFloat(e.target.value)+ const snapped = Math.round(raw / 0.05) * 0.05+ handleSliderChange(snapped)+ }}+ />++ {/* 21 Predefined Tick Mark Dashes (0%, 5%, 10%, ... 100%) */}+ <div className="setting-slider-ticks">+ {Array.from({ length: 21 }, (_, i) => {+ const tickVal = i * 0.05+ const currentVal = settings.verticalOffset ?? 0.5+ const isMajor = i === 0 || i === 10 || i === 20+ const isActive = Math.abs(currentVal - tickVal) < 0.025+ return (+ <span+ key={i}+ className={`slider-tick${isMajor ? ' major' : ''}${isActive ? ' active' : ''}`}+ />+ )+ })}+ </div>++ {/* 3 Main Percentage Labels (0%, 50%, 100%) */}+ <div className="setting-slider-labels">+ {[+ { label: '0%', val: 0 },+ { label: '50%', val: 0.5 },+ { label: '100%', val: 1.0 }+ ].map((pos) => {+ const currentVal = settings.verticalOffset ?? 0.5+ const active = Math.abs(currentVal - pos.val) < 0.04+ return (+ <button+ key={pos.val}+ type="button"+ className={`slider-label-btn${active ? ' active' : ''}`}+ onClick={() => handleSliderChange(pos.val)}+ >+ {pos.label}+ </button>+ )+ })}+ </div></div></div>diff --git a/src/hooks/useEdgeHover.ts b/src/hooks/useEdgeHover.tsindex c664f17..9a14d03 100644--- a/src/hooks/useEdgeHover.ts+++ b/src/hooks/useEdgeHover.ts@@ -126,6 +126,7 @@ export function useEdgeHover(): void {const closePanelNow = () => {const s = useStore.getState()if (s.styleFlyoutOpen) s.setStyleFlyoutOpen(false)+ if (s.settingsOpen) s.setSettingsOpen(false)s.setOpen(false)if (interactiveTimer !== undefined) window.clearTimeout(interactiveTimer)interactiveTimer = window.setTimeout(() => {@@ -137,6 +138,7 @@ export function useEdgeHover(): void {const closePanel = () => {const state = useStore.getState()if (!state.open) return+ if (state.sliderActive) returnif (state.dragActive && !state.internalDragReq) return// If the indicator style flyout is open, let it play its exit spring first.@@ -156,11 +158,20 @@ export function useEdgeHover(): void {const scheduleClose = (delay = GRACE_MS) => {const state = useStore.getState()+ if (state.sliderActive) returnif (state.dragActive && !state.internalDragReq) returnif (graceTimer !== undefined) return // already closing- // If the user just closed the preview via X, give them extra time before- // the clipboard collapses so they can keep using it.- const effectiveDelay = _previewClosedByUser ? PREVIEW_CLOSE_STAY_MS : delay++ // 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+ let effectiveDelay = delay++ if (timeSinceSliderRelease < 1500) {+ effectiveDelay = Math.max(delay, 1500 - timeSinceSliderRelease)+ } else if (_previewClosedByUser) {+ effectiveDelay = PREVIEW_CLOSE_STAY_MS+ }+graceTimer = window.setTimeout(closePanel, effectiveDelay)}@@ -206,9 +217,13 @@ export function useEdgeHover(): void {// expand). So we treat `panel:leave` as a *hint* and only actually close// if the last known pointer position is genuinely outside the blade.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 { x, y } = lastClient.currentif (x < -BUFFER_PX || y < 0) return true // unknown — be conservative, don't close- const state = useStore.getState()const s = state.settingsconst hasFlyout = !!(state.previewItemId || state.styleFlyoutOpen)const currentPanelWide = hasFlyout ? PREVIEW_WIDE : PANEL_WIDEdiff --git a/src/lib/soundEffects.ts b/src/lib/soundEffects.tsnew file mode 100644index 0000000..68bf740--- /dev/null+++ b/src/lib/soundEffects.ts@@ -0,0 +1,69 @@+/**+ * Web Audio API Haptic Sound Synthesizer for Edge-Drop.+ * Provides zero-latency, crisp mechanical rotary dial tick sounds.+ */++let audioCtx: AudioContext | null = null++function getAudioContext(): AudioContext | null {+ if (typeof window === 'undefined') return null+ if (!audioCtx) {+ const AudioContextClass = window.AudioContext || (window as any).webkitAudioContext+ if (AudioContextClass) {+ audioCtx = new AudioContextClass()+ }+ }+ if (audioCtx && audioCtx.state === 'suspended') {+ audioCtx.resume().catch(() => {})+ }+ return audioCtx+}++/**+ * Plays a satisfying mechanical rotary dial tick sound.+ * Designed to emulate a high-end camera dial / Apple Watch digital crown detent click.+ */+export function playDialTickSound(): void {+ try {+ const ctx = getAudioContext()+ if (!ctx) return++ const now = ctx.currentTime++ // 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)++ gain.gain.setValueAtTime(0.18, now)+ gain.gain.exponentialRampToValueAtTime(0.001, now + 0.01)++ osc.connect(gain)+ gain.connect(ctx.destination)++ 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()++ 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)++ bodyOsc.connect(bodyGain)+ bodyGain.connect(ctx.destination)++ bodyOsc.start(now)+ bodyOsc.stop(now + 0.012)+ } catch {+ /* ignore Web Audio API restrictions/errors */+ }+}diff --git a/src/store/appStore.ts b/src/store/appStore.tsindex 7c293cb..c11dcb8 100644--- a/src/store/appStore.ts+++ b/src/store/appStore.ts@@ -49,6 +49,10 @@ interface AppState {previewItemId: string | nullpreviewItemRect: { y: number; height: number } | null+ sliderActive: boolean+ sliderReleasedTime: number+ setSliderActive: (active: boolean) => void+/* hydration + sync */hydrate: () => Promise<void>setUpdateAvailable: (info: { version: string }) => void@@ -106,6 +110,12 @@ export const useStore = create<AppState>((set, get) => ({updateInfo: null,previewItemId: null,previewItemRect: null,+ sliderActive: false,+ sliderReleasedTime: 0,+ setSliderActive: (active) => set({+ sliderActive: active,+ sliderReleasedTime: active ? 0 : Date.now()+ }),styleFlyoutOpen: false,setStyleFlyoutOpen: (open) => {set({ styleFlyoutOpen: open, ...(open ? {} : { previewFlyoutRect: null }) })diff --git a/src/styles/settings.css b/src/styles/settings.cssindex 5468907..3b9a608 100644--- a/src/styles/settings.css+++ b/src/styles/settings.css@@ -98,6 +98,138 @@gap: 4px;}+/* Custom Range Slider Controls */+.setting-slider-wrap {+ display: flex;+ flex-direction: column;+ gap: 6px;+ width: 100%;+}++.setting-slider-header {+ display: flex;+ align-items: flex-start;+ justify-content: space-between;+ gap: 12px;+ width: 100%;+}++.setting-slider-val {+ font-size: 11px;+ font-weight: 600;+ font-family: 'JetBrains Mono', -apple-system, BlinkMacSystemFont, monospace;+ color: #ffffff;+ background: rgba(255, 255, 255, 0.1);+ border: 1px solid rgba(255, 255, 255, 0.18);+ padding: 3px 9px;+ border-radius: 999px;+ letter-spacing: 0.02em;+ white-space: nowrap;+ flex-shrink: 0;+}++.setting-range-input {+ -webkit-appearance: none;+ appearance: none;+ width: 100%;+ height: 6px;+ border-radius: 999px;+ outline: none;+ cursor: pointer;+ margin: 6px 0 2px 0;+ transition: background 0.15s ease;+ -webkit-backface-visibility: hidden;+ backface-visibility: hidden;+ transform: translateZ(0);+}++.setting-range-input::-webkit-slider-thumb {+ -webkit-appearance: none;+ appearance: none;+ width: 14px;+ height: 14px;+ border-radius: 50%;+ background: #ffffff;+ border: 1.5px solid #000000;+ box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);+ cursor: grab;+ transition: transform 0.15s ease;+}++.setting-range-input::-webkit-slider-thumb:hover {+ transform: scale(1.18);+ box-shadow: 0 1.5px 6px rgba(0, 0, 0, 0.6);+}++.setting-range-input::-webkit-slider-thumb:active {+ cursor: grabbing;+ transform: scale(1.24);+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);+}++/* Slider 5% Tick Marks Bar */+.setting-slider-ticks {+ position: relative;+ display: flex;+ justify-content: space-between;+ align-items: flex-end;+ width: 100%;+ height: 8px;+ padding: 0 6px;+ margin-top: 1px;+ pointer-events: none;+}++.slider-tick {+ width: 1px;+ height: 4px;+ background: rgba(255, 255, 255, 0.22);+ border-radius: 1px;+ transition: background 0.15s ease, height 0.15s ease;+}++.slider-tick.major {+ height: 7px;+ width: 1.5px;+ background: rgba(255, 255, 255, 0.55);+}++.slider-tick.active {+ background: #ffffff;+ box-shadow: 0 0 6px rgba(255, 255, 255, 0.4);+}++/* 3 Main Percentage Labels (0%, 50%, 100%) */+.setting-slider-labels {+ display: flex;+ justify-content: space-between;+ width: 100%;+ padding: 0 2px;+ margin-top: 3px;+}++.slider-label-btn {+ font-size: 10.5px;+ font-weight: 500;+ font-family: 'JetBrains Mono', -apple-system, BlinkMacSystemFont, monospace;+ color: rgba(255, 255, 255, 0.45);+ background: transparent;+ border: none;+ cursor: pointer;+ padding: 1px 4px;+ border-radius: 4px;+ transition: color 0.15s ease;+}++.slider-label-btn:hover {+ color: #ffffff;+}++.slider-label-btn.active {+ color: #ffffff;+ font-weight: 700;+}+.pill {flex: 1;padding: 7px 0;