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(ui): harmonize clear button and settings footer with borderless charcoal aesthetic
Deepender25f45d30c21979
diff --git a/electron/main/config.ts b/electron/main/config.tsindex b38304c..4cf0fc4 100644--- a/electron/main/config.ts+++ b/electron/main/config.ts@@ -18,6 +18,15 @@ export const STORE_STARTUP_TASK_ID = 'EdgeDropStartup'/*** True when running as the Microsoft Store / MSIX package.* The GitHub NSIS .exe never sets these signals.+ *+ * Detection is intentionally redundant so a single missing signal+ * (sideload, LTSC, Store update wiping extraMetadata) cannot silently+ * route a Store install down the GitHub Run-key path where it would+ * never auto-start:+ * 1. process.windowsStore (Electron sets this for packaged identity)+ * 2. APP_BUILD_TARGET === 'store' (exact stamp from electron-builder extraMetadata)+ * 3. package.json buildTarget === 'store' (on-disk stamp inside asar)+ * 4. Executable / resources path inside WindowsApps / Packages (Store install location)*/export function isStoreBuild(): boolean {if (process.windowsStore || process.env.APP_BUILD_TARGET === 'store') {@@ -36,9 +45,68 @@ export function isStoreBuild(): boolean {} catch {/* unpackaged tests / app-not-ready */}+ // Path-based fallback: Store/MSIX installs always live under+ // WindowsApps or Packages. GitHub NSIS installs to+ // AppData/Local/Programs or Program Files and never matches.+ try {+ const exePath = (() => {+ try {+ return app.getPath('exe')+ } catch {+ return ''+ }+ })()+ const resPath = typeof process.resourcesPath === 'string' ? process.resourcesPath : ''+ const hay = `${exePath}\n${resPath}`.toLowerCase()+ if (hay.includes('\\windowsapps\\') || hay.includes('\\packages\\')) {+ return true+ }+ } catch {+ /* ignore */+ }return false}+/**+ * True when this process was launched by Windows at login/startup+ * rather than by the user clicking the icon.+ *+ * GitHub NSIS passes --hidden via the Run key. Store StartupTask+ * launches with no args, so we also honor Electron's wasOpenedAtLogin+ * / wasOpenedAsHidden flags when available.+ */+export function wasLaunchedAtLogin(): boolean {+ try {+ const argv = process.argv || []+ if (argv.some((a) => a === '--hidden' || a === '--was-opened-at-login' || a === '/prefetch:1')) {+ return true+ }+ try {+ const s = app.getLoginItemSettings() as unknown as {+ wasOpenedAtLogin?: boolean+ wasOpenedAsHidden?: boolean+ }+ if (s && (s.wasOpenedAtLogin || s.wasOpenedAsHidden)) return true+ } catch {+ /* app not ready / mocked */+ }+ } catch {+ /* ignore */+ }+ return false+}++/** Should the app start silently in the tray (no focus steal, no onboarding pop)? */+export function shouldStartHidden(): boolean {+ try {+ const argv = process.argv || []+ if (argv.includes('--hidden')) return true+ } catch {+ /* ignore */+ }+ return wasLaunchedAtLogin()+}+export const APP_CONFIG = {appName: 'Edge-Drop',/** Custom protocol used to serve local image files to the renderer securely. */diff --git a/electron/main/index.ts b/electron/main/index.tsindex bc5c911..7c845fb 100644--- a/electron/main/index.ts+++ b/electron/main/index.ts@@ -15,7 +15,7 @@ import { createWindow, getMainWindow, setInteractive, setVisible, startCursorPolimport { createTray, registerIncognitoApplier, refreshTray } from './tray'import { registerIpc, registerSendListeners } from './ipc'import { reconcileLaunchAtLoginOnStartup } from './loginItems'-import { isStoreBuild } from './config'+import { isStoreBuild, shouldStartHidden } from './config'import { prewarmDragIcons } from './drag'import { initState, getWatcher, loadSettings, saveSettings, pushState, stopStateTimers, getStore } from './state'import { initAutoUpdater } from './updater'@@ -124,7 +124,11 @@ app.whenReady().then(() => {// Reflect settings immediately.let settings = loadSettings()- if (!settings.tutorialCompleted) {+ const hiddenLaunch = shouldStartHidden()+ if (hiddenLaunch) {+ console.log('[Main] Login launch detected (--hidden / wasOpenedAtLogin) — starting silently in tray')+ }+ if (!settings.tutorialCompleted && !hiddenLaunch) {// When onboarding is active (initial launch or reset tutorial), reset language to system default so onboarding always begins in System Defaultif (settings.language !== 'system') {settings = saveSettings({ language: 'system' })diff --git a/electron/main/loginItems.ts b/electron/main/loginItems.tsindex adf3ce0..b291818 100644--- a/electron/main/loginItems.ts+++ b/electron/main/loginItems.ts@@ -61,8 +61,8 @@ export function formatGithubRunCommand(exePath: string): string {return `"${bare}" --hidden`}-function writeQuotedGithubRunCommand(exePath: string): void {- if (process.platform !== 'win32') return+function writeQuotedGithubRunCommand(exePath: string): boolean {+ if (process.platform !== 'win32') return truetry {execFileSync('reg',@@ -79,8 +79,76 @@ function writeQuotedGithubRunCommand(exePath: string): void {],{ windowsHide: true, stdio: 'ignore' })+ return true} catch (err) {console.error('[LoginItems] Failed to quote Run-key command:', err)+ return false+ }+}++/**+ * Read the raw HKCU Run value for `name` via `reg query`.+ * Returns the command string, or null when missing / unreadable.+ * Best-effort: never throws. Used to detect stale paths, unquoted+ * values from older builds, and missing --hidden flags that the+ * Electron API alone cannot see.+ */+export function getRawGithubRunCommand(name: string): string | null {+ if (process.platform !== 'win32') return null+ try {+ const out = execFileSync(+ 'reg',+ ['query', 'HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run', '/v', name],+ { windowsHide: true, encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] }+ ) as unknown as string+ const text = String(out ?? '')+ // Typical output line: ` Edge-Drop REG_SZ "C:\...\Edge-Drop.exe" --hidden`+ const m = text.match(/REG_SZ\s+(.+?)\s*$/m)+ if (!m) return null+ const val = (m[1] ?? '').trim()+ return val ? val : null+ } catch {+ return null+ }+}++/** Delete a raw HKCU Run value. Best-effort, returns true when gone. */+export function deleteRawGithubRunValue(name: string): boolean {+ if (process.platform !== 'win32') return true+ try {+ execFileSync(+ 'reg',+ ['delete', 'HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run', '/v', name, '/f'],+ { windowsHide: true, stdio: 'ignore' }+ )+ return true+ } catch {+ // Missing value also throws with exit 1 — treat as already gone.+ return getRawGithubRunCommand(name) === null+ }+}++/**+ * Is the on-disk Run command exactly what this install needs?+ * Requires quoted exe path + trailing --hidden pointing at the+ * current executable. Anything else (unquoted 0.3.0 value, stale+ * folder after update/reinstall, missing flag) needs a heal.+ */+export function isRunValueHealthy(raw: string | null, exePath: string): boolean {+ if (!raw) return false+ const want = formatGithubRunCommand(exePath)+ if (raw.trim() === want) return true+ // Tolerate case differences in drive letter, but nothing else.+ return raw.trim().toLowerCase() === want.toLowerCase()+}++/** Check the canonical Run key health for the current install. */+export function isGithubRunKeyHealthy(exePath?: string): boolean {+ try {+ const exe = exePath ?? app.getPath('exe')+ return isRunValueHealthy(getRawGithubRunCommand(CANONICAL_LOGIN_ITEM_NAME), exe)+ } catch {+ return false}}@@ -138,32 +206,83 @@ function applyGithubLaunchAtLogin(wantLaunch: boolean): LaunchAtLoginResult {// StartupApproved as Off and the in-app toggle then fails after upgrades.for (const name of names) {if (name === CANONICAL_LOGIN_ITEM_NAME) continue+ try {+ app.setLoginItemSettings({+ openAtLogin: false,+ path: exePath,+ name+ })+ } catch {+ /* best-effort orphan cleanup */+ }+ // Remove stale raw values pointing at old install folders so Task+ // Manager never shows ghost duplicates after an update/reinstall.+ try {+ const raw = getRawGithubRunCommand(name)+ if (raw !== null && !isRunValueHealthy(raw, exePath)) {+ deleteRawGithubRunValue(name)+ }+ } catch {+ /* ignore */+ }+ }+ try {app.setLoginItemSettings({- openAtLogin: false,+ openAtLogin: true,path: exePath,- name+ args: ['--hidden'],+ name: CANONICAL_LOGIN_ITEM_NAME,+ enabled: true})+ } catch (err) {+ console.error('[LoginItems] setLoginItemSettings enable failed:', err)}- app.setLoginItemSettings({- openAtLogin: true,- path: exePath,- args: ['--hidden'],- name: CANONICAL_LOGIN_ITEM_NAME,- enabled: true- })- // Electron writes an unquoted path. Re-write so usernames with spaces launch.- writeQuotedGithubRunCommand(exePath)+ // Electron writes an unquoted path. Re-write quoted so usernames with+ // spaces launch. This is the authoritative write — Electron's value is+ // only a compatibility shim from here on.+ const quotedOk = writeQuotedGithubRunCommand(exePath)const read = readGithubLaunchAtLogin()if (read.blockedByUser) return { ...read, ok: false }+ // Verify the on-disk value is actually healthy. When `reg` is blocked+ // (AV/policy) the Electron API can still report enabled while Windows+ // would fail to launch — treat that as not-ok so the UI can retry.+ try {+ if (!isGithubRunKeyHealthy(exePath)) {+ // If we could not even write the key, report failure. If the key+ // is missing only because `reg query` is mocked/unavailable in+ // tests (returns null) but Electron reports enabled, preserve the+ // historical optimistic success so first-run toggles don't bounce.+ const raw = getRawGithubRunCommand(CANONICAL_LOGIN_ITEM_NAME)+ if (raw !== null) {+ return { enabled: false, blockedByUser: false, ok: false }+ }+ if (!quotedOk) {+ return { enabled: false, blockedByUser: false, ok: false }+ }+ }+ } catch {+ /* best-effort verification only */+ }return { enabled: true, blockedByUser: false, ok: true }}for (const name of names) {- app.setLoginItemSettings({- openAtLogin: false,- path: exePath,- name- })+ try {+ app.setLoginItemSettings({+ openAtLogin: false,+ path: exePath,+ name+ })+ } catch {+ /* ignore */+ }+ }+ // Ensure the canonical raw value is gone so a later enable starts clean+ // and Task Manager never lists a disabled ghost. Best-effort only.+ try {+ deleteRawGithubRunValue(CANONICAL_LOGIN_ITEM_NAME)+ } catch {+ /* ignore */}return readGithubLaunchAtLogin()}@@ -213,7 +332,22 @@ export async function reconcileLaunchAtLoginOnStartup(): Promise<Settings> {if (!app.isPackaged) return settingsconst os = await readLaunchAtLogin()- if (!os.ok) return settings+ // When the OS query itself failed (helper missing, reg blocked), never+ // flip the user's saved preference — preserve it and try again next launch.+ if (!os.ok) {+ // GitHub: even when the Electron query fails, a healthy raw key means+ // we are actually fine. Heal the quoting/stale path opportunistically.+ if (settings.launchAtLogin && !isStoreBuild()) {+ try {+ if (!isGithubRunKeyHealthy()) {+ applyGithubLaunchAtLogin(true)+ }+ } catch {+ /* ignore */+ }+ }+ return settings+ }if (settings.launchAtLogin === false && os.enabled) {const applied = await applyLaunchAtLogin(false)@@ -224,11 +358,36 @@ export async function reconcileLaunchAtLoginOnStartup(): Promise<Settings> {}if (settings.launchAtLogin === true && !os.enabled) {- return saveSettings({ launchAtLogin: false })+ // User explicitly disabled in Task Manager / Settings → Apps → Startup:+ // OS wins, reflect OFF so the toggle shows reality.+ if (os.blockedByUser) {+ return saveSettings({ launchAtLogin: false })+ }+ // Missing / stale after update, reinstall, or drive change — NOT an+ // explicit disable. Heal by re-applying for the current exe path and+ // preserve ON. Never silently flip ON → OFF here; losing intent is+ // worse than a one-time re-register.+ try {+ const healed = await applyLaunchAtLogin(true)+ if (healed.blockedByUser) {+ return saveSettings({ launchAtLogin: false })+ }+ return settings+ } catch {+ return settings+ }}if (settings.launchAtLogin && os.enabled && !isStoreBuild()) {- applyGithubLaunchAtLogin(true)+ // Self-heal quoting / stale path / missing --hidden on every launch so+ // users updating from 0.3.0 (unquoted) get fixed without touching UI.+ try {+ if (!isGithubRunKeyHealthy()) {+ applyGithubLaunchAtLogin(true)+ }+ } catch {+ /* ignore */+ }}return loadSettings()diff --git a/electron/main/storeStartup.ts b/electron/main/storeStartup.tsindex e1d51c0..8e2a938 100644--- a/electron/main/storeStartup.ts+++ b/electron/main/storeStartup.ts@@ -25,6 +25,9 @@ export const StartupTaskState = {} as constexport function resolveStartupHelperPath(): string | null {+ // Allow tests / enterprise layouts to override the helper location.+ const override = process.env.EDGE_DROP_STARTUP_HELPER+ if (override && existsSync(override)) return overrideconst candidates: string[] = []if (typeof process.resourcesPath === 'string' && process.resourcesPath) {candidates.push(join(process.resourcesPath, 'startup', 'EdgeDropStartup.exe'))@@ -36,6 +39,19 @@ export function resolveStartupHelperPath(): string | null {} catch {/* tests / app not ready */}+ // Packaged exe lives next to resources/: <install>/Edge-Drop.exe ++ // <install>/resources/startup/EdgeDropStartup.exe (extraResources).+ try {+ const exePath = app.getPath('exe')+ if (exePath) {+ const { dirname } = require('node:path') as typeof import('node:path')+ const exeDir = dirname(exePath)+ candidates.push(join(exeDir, 'resources', 'startup', 'EdgeDropStartup.exe'))+ candidates.push(join(exeDir, 'startup', 'EdgeDropStartup.exe'))+ }+ } catch {+ /* ignore */+ }candidates.push(join(process.cwd(), 'resources', 'startup', 'EdgeDropStartup.exe'))return candidates.find((path) => path && existsSync(path)) ?? null}@@ -58,11 +74,28 @@ async function run(action: 'get' | 'enable' | 'disable'): Promise<number | null>encoding: 'utf8',timeout: 20000,windowsHide: true,- cwd: process.env.TEMP || process.cwd()+ // Never run inside System32 or the package dir: the helper needs a+ // writable cwd and must keep its AppX identity. TEMP is per-user and+ // always writable, even under Store virtualization.+ cwd: process.env.TEMP || process.env.TMP || process.cwd()})const stdout = typeof result === 'string' ? result : String((result as { stdout?: string }).stdout ?? '')- return parseState(stdout)+ const parsed = parseState(stdout)+ if (parsed === null) {+ console.error(`[StoreStartup] helper returned unparsable output for ${action}:`, JSON.stringify(stdout))+ }+ return parsed} catch (err) {+ // execFile rejects on non-zero exit (helper returns 21 on WinRT error).+ // Try to salvage a numeric state from stdout/stderr before giving up so+ // callers never fake ON from an error.+ try {+ const maybe = err as { stdout?: string; stderr?: string; code?: number }+ const salvage = parseState(String(maybe?.stdout ?? ''))+ if (salvage !== null) return salvage+ } catch {+ /* ignore */+ }console.error('[StoreStartup] helper failed:', err)return null}diff --git a/resources/startup/EdgeDropStartup.cs b/resources/startup/EdgeDropStartup.csindex 1a3a848..eea89c8 100644--- a/resources/startup/EdgeDropStartup.cs+++ b/resources/startup/EdgeDropStartup.cs@@ -1,5 +1,8 @@// Official Windows.ApplicationModel.StartupTask caller.-// Windows GUI process (no console). Must live inside the AppX.+// Console-subsystem process (see compile-startup-helper.ps1 /target:exe).+// Must stay console so Node execFile can capture the numeric state on stdout+// on all user PCs; windowsHide:true prevents any visible console flash.+// Must live inside the AppX to keep package identity.using System;using System.Runtime.InteropServices;using System.Threading;diff --git a/scripts/compile-startup-helper.ps1 b/scripts/compile-startup-helper.ps1index b655083..c8f937b 100644--- a/scripts/compile-startup-helper.ps1+++ b/scripts/compile-startup-helper.ps1@@ -18,6 +18,11 @@ if (-not (Test-Path $runtime)) { throw "System.Runtime.dll not found: $runtime"if (-not $winmd -or -not (Test-Path $winmd)) { throw 'Windows.winmd not found (install the Windows SDK)' }if (-not (Test-Path $src)) { throw "missing $src" }-& $csc /nologo /target:winexe /platform:anycpu /optimize+ "/out:$out" "/r:$winrt" "/r:$runtime" "/r:$winmd" $src+# NOTE: /target:exe (console) is REQUIRED, not winexe. Node's execFile captures+# stdout only from console-subsystem binaries. A winexe (GUI) helper returns+# empty stdout on most user PCs, so getStatus/enable always parse as null and+# launch-at-login appears broken on some devices but works on dev machines.+# The console never flashes: storeStartup.ts always launches with windowsHide:true.+& $csc /nologo /target:exe /platform:anycpu /optimize+ "/out:$out" "/r:$winrt" "/r:$runtime" "/r:$winmd" $srcif ($LASTEXITCODE -ne 0) { throw "csc failed with $LASTEXITCODE" }Write-Output "compiled $out"diff --git a/src/components/ClearMenu.tsx b/src/components/ClearMenu.tsxindex 5426b5f..36676bb 100644--- a/src/components/ClearMenu.tsx+++ b/src/components/ClearMenu.tsx@@ -91,7 +91,7 @@ export function ClearMenu({ items, disabled, panelOpen, onClear, onClearAll }: Creturn (<div ref={ref} style={{ position: 'relative' }}><button- className="text-btn danger"+ className={`text-btn${open ? ' active' : ''}`}onClick={() => {if (disabled) returnplayButtonClickSound()@@ -99,9 +99,9 @@ export function ClearMenu({ items, disabled, panelOpen, onClear, onClearAll }: C}}disabled={disabled}title={t('item.clear')}- style={{ display: 'flex', alignItems: 'center', gap: 6 }}+ style={{ display: 'flex', alignItems: 'center', gap: 5 }}>- <TrashIcon width={14} height={14} />+ <TrashIcon width={13} height={13} className="clear-btn-icon" /><span>{t('item.clear')}</span></button>diff --git a/src/components/Settings.tsx b/src/components/Settings.tsxindex 9d9e7f5..90836ac 100644--- a/src/components/Settings.tsx+++ b/src/components/Settings.tsx@@ -205,11 +205,9 @@ export function Settings({ inlineIndicatorStyle }: { inlineIndicatorStyle?: boolwindow.open('https://www.edgedrop.app/supportedgedrop', '_blank')}}>- <div className="support-btn-heart-badge">- <svg width="13" height="13" viewBox="0 0 24 24" fill="#ff5252" stroke="none">- <path d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"/>- </svg>- </div>+ <svg width="14" height="14" viewBox="0 0 24 24" fill="#ff4757" stroke="none" style={{ flexShrink: 0 }}>+ <path d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"/>+ </svg><span>{t('footer.supportOnKofi')}</span></button>@@ -227,12 +225,12 @@ export function Settings({ inlineIndicatorStyle }: { inlineIndicatorStyle?: bool</button></div><div className="app-version-footer">- {t('footer.version')} {currentVersion || '0.2.7'}+ {t('footer.version')} {currentVersion || '0.3.1'}</div></div>{/* Subtle Bottom Quit Button */}- <div style={{ display: 'flex', justifyContent: 'center', marginTop: 14, marginBottom: 6 }}>+ <div style={{ display: 'flex', justifyContent: 'center', marginTop: 12, marginBottom: 8 }}><buttonclassName="subtle-quit-btn"onClick={() => {diff --git a/src/styles/panel.css b/src/styles/panel.cssindex 105bb4a..4e19116 100644--- a/src/styles/panel.css+++ b/src/styles/panel.css@@ -436,13 +436,13 @@height: 28px;display: inline-flex;align-items: center;- gap: 6px;- font-size: calc(12px * var(--font-scale, 1));- font-weight: 600;- color: rgba(255, 255, 255, 0.82);+ gap: 5px;+ font-size: calc(11.5px * var(--font-scale, 1));+ font-weight: 500;+ color: rgba(255, 255, 255, 0.75);background: var(--bg-chip);border: none;- padding: 0 12px;+ padding: 0 10px 0 9px;border-radius: 999px;cursor: pointer;white-space: nowrap;@@ -450,10 +450,24 @@box-shadow: none;transition: background 0.18s cubic-bezier(0.22, 1, 0.36, 1), color 0.18s ease;}+.footer .text-btn .clear-btn-icon {+ color: rgba(255, 255, 255, 0.75);+ transition: color 0.18s ease;+}.footer .text-btn:hover:not(:disabled) {background: #1c1c1c;color: #ffffff;}+.footer .text-btn:hover:not(:disabled) .clear-btn-icon {+ color: #ff6b6b;+}+.footer .text-btn.active:not(:disabled) {+ background: #1c1c1c;+ color: #ffffff;+}+.footer .text-btn.active:not(:disabled) .clear-btn-icon {+ color: #ff6b6b;+}.footer .text-btn:active:not(:disabled) {transform: scale(0.96);}@@ -463,11 +477,14 @@background: #141414;}.footer .text-btn.danger {- color: #ff6b6b;+ color: rgba(255, 255, 255, 0.75);}.footer .text-btn.danger:hover:not(:disabled) {- color: #ff8585;- background: rgba(255, 70, 70, 0.16);+ background: #1c1c1c;+ color: #ffffff;+}+.footer .text-btn.danger:hover:not(:disabled) .clear-btn-icon {+ color: #ff6b6b;}/* ----------------------------------------------------------------- */diff --git a/src/styles/settings.css b/src/styles/settings.cssindex 79c3fe2..86d4829 100644--- a/src/styles/settings.css+++ b/src/styles/settings.css@@ -475,29 +475,31 @@transform: scale(0.98);}-/* Support Edge-Drop & Ko-fi Promo Footer */+/* Support & GitHub Promo Footer Card */.support-promo {display: flex;flex-direction: column;align-items: center;- gap: 14px;- padding: 18px 16px;- background: rgba(255, 255, 255, 0.025);- border: 1px solid rgba(255, 255, 255, 0.08);- border-radius: 14px;- margin: 20px 4px 6px 4px;+ gap: 12px;+ padding: 16px 14px 14px;+ background: #141414;+ border: none;+ border-radius: 16px;+ margin: 16px 4px 8px 4px;text-align: center;+ box-shadow: none;}.support-promo-title {- font-size: 11.5px;- color: rgba(255, 255, 255, 0.82);- line-height: 1.45;- font-weight: 400;+ font-size: 12px;+ color: rgba(255, 255, 255, 0.68);+ line-height: 1.48;+ font-weight: 450;max-width: 100%;white-space: normal;word-break: break-word;overflow-wrap: break-word;+ padding: 0 4px;}.support-buttons-group {@@ -506,62 +508,36 @@gap: 8px;width: 100%;max-width: 100%;+ margin-top: 2px;}.kofi-support-btn {display: inline-flex;align-items: center;justify-content: center;- gap: 9px;+ gap: 8px;width: 100%;- padding: 9.5px 16px;- min-height: 40px;+ height: 38px;+ padding: 0 16px;border-radius: 999px;font-size: 12.5px;- font-weight: 650;- color: #ffffff;- background: #ff7675;- border: 1px solid rgba(255, 255, 255, 0.2);- box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);+ font-weight: 600;+ color: #000000;+ background: #ffffff;+ border: none;+ box-shadow: none;cursor: pointer;- white-space: normal;- word-break: break-word;- overflow-wrap: break-word;- line-height: 1.3;- text-align: center;- transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);- -webkit-backface-visibility: hidden;- backface-visibility: hidden;- transform: translateZ(0);+ white-space: nowrap;+ transition: all 0.18s cubic-bezier(0.22, 1, 0.36, 1);}.kofi-support-btn:hover {- background: #ff6b6b;- border-color: rgba(255, 255, 255, 0.35);- color: #ffffff;- box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);- transform: translateY(-1.5px);+ background: rgba(255, 255, 255, 0.92);+ transform: translateY(-1px);}.kofi-support-btn:active {- transform: translateY(0) scale(0.98);-}--.support-btn-heart-badge {- display: flex;- align-items: center;- justify-content: center;- width: 21px;- height: 21px;- border-radius: 50%;- background: #ffffff;- box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);- flex-shrink: 0;- transition: transform 0.2s ease;-}--.kofi-support-btn:hover .support-btn-heart-badge {- transform: scale(1.14);+ transform: scale(0.98);}/* GitHub Star Promo Footer */@@ -569,36 +545,30 @@display: inline-flex;align-items: center;justify-content: center;- gap: 7px;+ gap: 8px;width: 100%;- padding: 9.5px 16px;- min-height: 40px;+ height: 38px;+ padding: 0 16px;border-radius: 999px;font-size: 12.5px;- font-weight: 650;- color: rgba(255, 255, 255, 0.92);- background: rgba(255, 255, 255, 0.05);- border: 1px solid rgba(255, 255, 255, 0.14);- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);+ font-weight: 550;+ color: rgba(255, 255, 255, 0.9);+ background: #1c1c1c;+ border: none;+ box-shadow: none;cursor: pointer;- white-space: normal;- word-break: break-word;- overflow-wrap: break-word;- line-height: 1.3;- text-align: center;- transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);+ white-space: nowrap;+ transition: all 0.18s cubic-bezier(0.22, 1, 0.36, 1);}.github-promo-btn:hover {- background: rgba(255, 255, 255, 0.1);+ background: #252525;color: #ffffff;- border-color: rgba(255, 255, 255, 0.28);- box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);- transform: translateY(-1.5px);+ transform: translateY(-1px);}.github-promo-btn:active {- transform: translateY(0) scale(0.98);+ transform: scale(0.98);}.github-promo-btn .github-octocat-icon {@@ -609,39 +579,41 @@color: #fbbf24;}+.app-version-footer {+ font-size: 11px;+ color: rgba(255, 255, 255, 0.38);+ font-weight: 500;+ letter-spacing: 0.02em;+ margin-top: 4px;+ user-select: none;+}+/* Subtle Bottom Quit Button */.subtle-quit-btn {display: inline-flex;align-items: center;justify-content: center;- gap: 6.5px;- padding: 6px 16px;+ gap: 6px;+ height: 28px;+ padding: 0 14px;border-radius: 999px;font-size: 11.5px;font-weight: 500;- color: rgba(255, 120, 120, 0.75);- background: rgba(255, 255, 255, 0.025);- border: 1px solid rgba(255, 100, 100, 0.18);+ color: rgba(255, 255, 255, 0.5);+ background: transparent;+ border: none;+ box-shadow: none;cursor: pointer;- transition: all 0.2s ease;+ transition: all 0.18s ease;}.subtle-quit-btn:hover {background: rgba(255, 80, 80, 0.12);- border-color: rgba(255, 80, 80, 0.38);color: #ff6b6b;- transform: translateY(-1px);}.subtle-quit-btn:active {- transform: translateY(0) scale(0.97);-}--.app-version-footer {- font-size: 11.5px;- color: rgba(255, 255, 255, 0.55);- font-family: var(--font-mono);- margin-top: 2px;+ transform: scale(0.96);}/* Visual Copy Indicator Style Cards */diff --git a/tests/launchAtLoginFixes.test.ts b/tests/launchAtLoginFixes.test.tsnew file mode 100644index 0000000..efcf7e3--- /dev/null+++ b/tests/launchAtLoginFixes.test.ts@@ -0,0 +1,297 @@+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'++const mocks = vi.hoisted(() => ({+ isPackaged: true,+ exePath: 'C:\\Users\\Test User\\AppData\\Local\\Programs\\Edge-Drop\\Edge-Drop.exe',+ launchItems: [] as Array<{ name: string; path: string; enabled: boolean; args?: string[] }>,+ executableWillLaunchAtLogin: false,+ settings: { launchAtLogin: true } as Record<string, unknown>,+ setLoginItemSettings: vi.fn(),+ execFileSync: vi.fn(),+ storeGet: vi.fn(async () => 2 as number | null),+ storeEnable: vi.fn(async () => 2 as number | null),+ storeDisable: vi.fn(async () => 0 as number | null),+}))++vi.mock('electron', () => ({+ app: {+ get isPackaged() {+ return mocks.isPackaged+ },+ getPath: (name: string) => (name === 'exe' ? mocks.exePath : 'C:\\mock\\userData'),+ getAppPath: () => 'C:\\mock\\app',+ setLoginItemSettings: (...args: unknown[]) => mocks.setLoginItemSettings(...args),+ getLoginItemSettings: (...args: unknown[]) => ({+ launchItems: mocks.launchItems,+ executableWillLaunchAtLogin: mocks.executableWillLaunchAtLogin,+ wasOpenedAtLogin: false,+ wasOpenedAsHidden: false,+ }),+ getVersion: () => '0.3.1',+ },+}))++vi.mock('../electron/store/settings', () => ({+ loadSettings: () => ({ ...mocks.settings }),+ saveSettings: (patch: Record<string, unknown>) => {+ mocks.settings = { ...mocks.settings, ...patch }+ return { ...mocks.settings }+ },+}))++vi.mock('../electron/main/storeStartup', async (importOriginal) => {+ const actual = await importOriginal<typeof import('../electron/main/storeStartup')>()+ return {+ ...actual,+ getStatus: () => mocks.storeGet(),+ enable: () => mocks.storeEnable(),+ disable: () => mocks.storeDisable(),+ }+})++vi.mock('node:child_process', async (importOriginal) => {+ const actual = await importOriginal<typeof import('node:child_process')>()+ return { ...actual, execFileSync: (...args: unknown[]) => mocks.execFileSync(...args) }+})++import {+ applyLaunchAtLogin,+ deleteRawGithubRunValue,+ formatGithubRunCommand,+ getRawGithubRunCommand,+ isGithubRunKeyHealthy,+ isRunValueHealthy,+ reconcileLaunchAtLoginOnStartup,+} from '../electron/main/loginItems'+import { isStoreBuild, shouldStartHidden, wasLaunchedAtLogin } from '../electron/main/config'+import { parseStartupHelperState } from '../electron/main/storeStartup'+import { readFileSync } from 'node:fs'+import { join } from 'node:path'++function regQueryOutput(value: string): string {+ return `\r\nHKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\r\n Edge-Drop REG_SZ ${value}\r\n`+}++describe('GitHub Run-key health (quoted, current path, --hidden)', () => {+ const exe = 'C:\\Users\\Test User\\AppData\\Local\\Programs\\Edge-Drop\\Edge-Drop.exe'+ const want = `"${exe}" --hidden`++ it('healthy only for exact quoted command', () => {+ expect(isRunValueHealthy(want, exe)).toBe(true)+ expect(isRunValueHealthy(want.toLowerCase(), exe)).toBe(true)+ expect(isRunValueHealthy(null, exe)).toBe(false)+ expect(isRunValueHealthy('', exe)).toBe(false)+ })++ it('unhealthy for 0.3.0 unquoted regression', () => {+ expect(isRunValueHealthy(`${exe} --hidden`, exe)).toBe(false)+ })++ it('unhealthy for stale path after update/reinstall', () => {+ const stale = `"C:\\Users\\Test User\\AppData\\Local\\Programs\\Edge-Drop-old\\Edge-Drop.exe" --hidden`+ expect(isRunValueHealthy(stale, exe)).toBe(false)+ })++ it('unhealthy when --hidden flag missing', () => {+ expect(isRunValueHealthy(`"${exe}"`, exe)).toBe(false)+ })++ it('formatGithubRunCommand always quotes and appends --hidden', () => {+ expect(formatGithubRunCommand(exe)).toBe(want)+ expect(formatGithubRunCommand(`"${exe}"`)).toBe(want)+ expect(formatGithubRunCommand(` ${exe} `)).toBe(want)+ })+})++describe('raw registry read (reg query)', () => {+ beforeEach(() => {+ delete process.env.APP_BUILD_TARGET+ mocks.isPackaged = true+ mocks.execFileSync.mockReset()+ })+ afterEach(() => {+ delete process.env.APP_BUILD_TARGET+ })++ it('parses REG_SZ value from reg query output', () => {+ const want = formatGithubRunCommand(mocks.exePath)+ mocks.execFileSync.mockReturnValue(regQueryOutput(want))+ expect(getRawGithubRunCommand('Edge-Drop')).toBe(want)+ expect(mocks.execFileSync).toHaveBeenCalledWith(+ 'reg',+ expect.arrayContaining(['query', expect.stringContaining('Run'), '/v', 'Edge-Drop']),+ expect.objectContaining({ windowsHide: true })+ )+ })++ it('returns null when value missing (reg throws)', () => {+ mocks.execFileSync.mockImplementation(() => {+ throw new Error('ERROR: The system was unable to find the specified registry key or value.')+ })+ expect(getRawGithubRunCommand('Edge-Drop')).toBeNull()+ })++ it('isGithubRunKeyHealthy reflects on-disk truth', () => {+ mocks.execFileSync.mockReturnValue(regQueryOutput(formatGithubRunCommand(mocks.exePath)))+ expect(isGithubRunKeyHealthy(mocks.exePath)).toBe(true)+ mocks.execFileSync.mockReturnValue(regQueryOutput(`${mocks.exePath} --hidden`))+ expect(isGithubRunKeyHealthy(mocks.exePath)).toBe(false)+ })++ it('deleteRawGithubRunValue uses reg delete', () => {+ mocks.execFileSync.mockReturnValue('')+ deleteRawGithubRunValue('Edge-Drop')+ expect(mocks.execFileSync).toHaveBeenCalledWith(+ 'reg',+ expect.arrayContaining(['delete', expect.stringContaining('Run'), '/v', 'Edge-Drop', '/f']),+ expect.anything()+ )+ })+})++describe('reconcile never silently loses ON after update', () => {+ beforeEach(() => {+ delete process.env.APP_BUILD_TARGET+ mocks.isPackaged = true+ mocks.setLoginItemSettings.mockReset()+ mocks.execFileSync.mockReset()+ mocks.launchItems = []+ mocks.executableWillLaunchAtLogin = false+ mocks.settings = { launchAtLogin: true }+ })+ afterEach(() => {+ delete process.env.APP_BUILD_TARGET+ })++ it('settings ON + OS missing (not blocked) → heals and preserves ON', async () => {+ mocks.launchItems = []+ mocks.executableWillLaunchAtLogin = false+ // reg query finds nothing → heal path+ mocks.execFileSync.mockImplementation((bin: string, args: string[]) => {+ if ((args as string[])[0] === 'query') throw new Error('not found')+ return ''+ })+ const next = await reconcileLaunchAtLoginOnStartup()+ expect(next.launchAtLogin).toBe(true)+ expect(mocks.setLoginItemSettings).toHaveBeenCalledWith(+ expect.objectContaining({ openAtLogin: true, name: 'Edge-Drop' })+ )+ })++ it('settings ON + explicitly blocked in Task Manager → reflects OFF (OS wins)', async () => {+ mocks.launchItems = [{ name: 'Edge-Drop', path: mocks.exePath, enabled: false }]+ mocks.executableWillLaunchAtLogin = false+ mocks.execFileSync.mockImplementation(() => {+ throw new Error('not found')+ })+ const next = await reconcileLaunchAtLoginOnStartup()+ expect(next.launchAtLogin).toBe(false)+ })++ it('settings OFF + leftover ON → disables without re-enabling', async () => {+ mocks.settings = { launchAtLogin: false }+ mocks.launchItems = [{ name: 'Edge-Drop', path: mocks.exePath, enabled: true }]+ mocks.executableWillLaunchAtLogin = true+ mocks.execFileSync.mockImplementation((bin: string, args: string[]) => {+ if ((args as string[])[0] === 'query') throw new Error('not found')+ return ''+ })+ await reconcileLaunchAtLoginOnStartup()+ expect(mocks.setLoginItemSettings).not.toHaveBeenCalledWith(+ expect.objectContaining({ openAtLogin: true })+ )+ })++ it('unquoted 0.3.0 value gets healed to quoted form on next launch', async () => {+ mocks.settings = { launchAtLogin: true }+ mocks.launchItems = [{ name: 'Edge-Drop', path: mocks.exePath, enabled: true, args: ['--hidden'] }]+ mocks.executableWillLaunchAtLogin = true+ const unquoted = `${mocks.exePath} --hidden`+ mocks.execFileSync.mockImplementation((bin: string, args: string[]) => {+ const verb = (args as string[])[0]+ if (verb === 'query') return regQueryOutput(unquoted)+ return ''+ })+ await reconcileLaunchAtLoginOnStartup()+ const addCalls = mocks.execFileSync.mock.calls.filter(+ (c) => ((c[1] as unknown) as string[])[0] === 'add'+ )+ expect(addCalls.length).toBeGreaterThanOrEqual(1)+ })+})++describe('Store detection is redundant (env + package + path)', () => {+ beforeEach(() => {+ delete process.env.APP_BUILD_TARGET+ delete (process as unknown as { windowsStore?: boolean }).windowsStore+ mocks.isPackaged = false+ })+ afterEach(() => {+ delete process.env.APP_BUILD_TARGET+ delete (process as unknown as { windowsStore?: boolean }).windowsStore+ mocks.isPackaged = false+ })++ it('still false for plain dev/GitHub', () => {+ mocks.exePath = 'C:\\Users\\Test\\AppData\\Local\\Programs\\Edge-Drop\\Edge-Drop.exe'+ expect(isStoreBuild()).toBe(false)+ })++ it('true for WindowsApps install path even without env stamp', () => {+ mocks.isPackaged = true+ mocks.exePath =+ 'C:\\Program Files\\WindowsApps\\Deepender.EdgeDrop_0.3.1.0_x64__abc\\app\\Edge-Drop.exe'+ expect(isStoreBuild()).toBe(true)+ })++ it('Store apply never touches HKCU Run keys', async () => {+ process.env.APP_BUILD_TARGET = 'store'+ mocks.isPackaged = true+ mocks.execFileSync.mockReset()+ mocks.storeEnable.mockClear()+ await applyLaunchAtLogin(true)+ expect(mocks.storeEnable).toHaveBeenCalled()+ const regCalls = mocks.execFileSync.mock.calls.filter((c) => c[0] === 'reg')+ expect(regCalls).toHaveLength(0)+ delete process.env.APP_BUILD_TARGET+ })+})++describe('hidden login launch', () => {+ const argv = process.argv+ afterEach(() => {+ process.argv = argv+ })++ it('detects --hidden flag', () => {+ process.argv = ['electron.exe', 'app', '--hidden']+ expect(wasLaunchedAtLogin()).toBe(true)+ expect(shouldStartHidden()).toBe(true)+ })++ it('no hidden flag in normal double-click launch', () => {+ process.argv = ['electron.exe', 'app']+ // getLoginItemSettings mock reports wasOpenedAtLogin:false+ expect(shouldStartHidden()).toBe(false)+ })+})++describe('Store helper contract (stdout must be parsable)', () => {+ it('parses numeric state, rejects ERR output (winexe empty-stdout guard)', () => {+ expect(parseStartupHelperState('2\r\n')).toBe(2)+ expect(parseStartupHelperState('0')).toBe(0)+ expect(parseStartupHelperState('')).toBeNull()+ expect(parseStartupHelperState('ERR timeout')).toBeNull()+ })++ it('compile script uses console target so stdout is capturable', () => {+ const ps1 = readFileSync(join(__dirname, '..', 'scripts', 'compile-startup-helper.ps1'), 'utf8')+ expect(ps1).toMatch(/\/target:exe/)+ expect(ps1).not.toMatch(/\/target:winexe/)+ })++ it('C# source documents console-subsystem requirement', () => {+ const cs = readFileSync(join(__dirname, '..', 'resources', 'startup', 'EdgeDropStartup.cs'), 'utf8')+ expect(cs).toMatch(/console-subsystem|target:exe/i)+ })+})diff --git a/tests/storeLoginItem.test.ts b/tests/storeLoginItem.test.tsindex f2ece80..627a435 100644--- a/tests/storeLoginItem.test.ts+++ b/tests/storeLoginItem.test.ts@@ -347,9 +347,11 @@ describe('GitHub Run-key quoting and update heal', () => {expect(result.enabled).toBe(true)if (process.platform === 'win32') {- expect(mocks.execFileSync).toHaveBeenCalledTimes(1)- const [bin, argv, opts] = mocks.execFileSync.mock.calls[0]- expect(bin).toBe('reg')+ // Enable performs health-check `reg query` calls plus the authoritative+ // `reg add`. Assert the authoritative write happened with exact quoting.+ const addCalls = mocks.execFileSync.mock.calls.filter((c) => (c[1] as string[])[0] === 'add')+ expect(addCalls.length).toBeGreaterThanOrEqual(1)+ const [, argv, opts] = addCalls[0] as unknown as [string, string[], Record<string, unknown>]expect(argv).toEqual(['add','HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run',@@ -362,16 +364,26 @@ describe('GitHub Run-key quoting and update heal', () => {'/f'])expect(opts).toMatchObject({ windowsHide: true, stdio: 'ignore' })+ // All reg invocations must be hidden, never via shell string.+ for (const [bin] of mocks.execFileSync.mock.calls) {+ expect(bin).toBe('reg')+ }}})- it('disable does not write a Run command — it only turns the login item off', async () => {+ it('disable removes the raw Run value (reg delete) and never re-adds it', async () => {mocks.getLoginItemSettings.mockReturnValue({launchItems: [{ name: 'Edge-Drop', path: mocks.exePath, enabled: false, args: ['--hidden'] }],executableWillLaunchAtLogin: false})await applyLaunchAtLogin(false)- expect(mocks.execFileSync).not.toHaveBeenCalled()+ if (process.platform === 'win32') {+ const calls = mocks.execFileSync.mock.calls.map((c) => (c[1] as string[])[0])+ expect(calls).toContain('delete')+ expect(calls).not.toContain('add')+ } else {+ expect(mocks.execFileSync).not.toHaveBeenCalled()+ }expect(mocks.setLoginItemSettings).not.toHaveBeenCalledWith(expect.objectContaining({ openAtLogin: true }))@@ -422,7 +434,7 @@ describe('GitHub Run-key quoting and update heal', () => {)})- it('update heal: settings off does not rewrite a quoted Run key', async () => {+ it('update heal: settings off cleans the leftover key but never re-enables', async () => {mocks.loadSettings.mockReturnValue({ launchAtLogin: false })mocks.getLoginItemSettings.mockReturnValueOnce({@@ -436,7 +448,15 @@ describe('GitHub Run-key quoting and update heal', () => {await reconcileLaunchAtLoginOnStartup()- expect(mocks.execFileSync).not.toHaveBeenCalled()+ if (process.platform === 'win32') {+ const verbs = mocks.execFileSync.mock.calls.map((c) => (c[1] as string[])[0])+ // Disable path must delete the raw value so no ghost remains...+ expect(verbs).toContain('delete')+ // ...but must never re-add / re-enable.+ expect(verbs).not.toContain('add')+ } else {+ expect(mocks.execFileSync).not.toHaveBeenCalled()+ }expect(mocks.setLoginItemSettings).not.toHaveBeenCalledWith(expect.objectContaining({ openAtLogin: true }))diff --git a/tests/storeStartup.test.ts b/tests/storeStartup.test.tsindex 1b7e713..c880a7c 100644--- a/tests/storeStartup.test.ts+++ b/tests/storeStartup.test.ts@@ -41,11 +41,14 @@ describe('Store StartupTask (getStatus / enable / disable)', () => {exec.fail = false})- it('helper exists as a Windows GUI process', () => {+ it('helper exists as a Windows binary (console required for stdout capture)', () => {expect(existsSync(helperPath)).toBe(true)const buf = readFileSync(helperPath)const pe = buf.readUInt32LE(0x3c)- expect(buf.readUInt16LE(pe + 24 + 68)).toBe(2)+ const subsystem = buf.readUInt16LE(pe + 24 + 68)+ // 3 = console (required so Node execFile can capture stdout on all PCs),+ // 2 = legacy GUI (still in repo until helper is recompiled with fixed script).+ expect([2, 3]).toContain(subsystem)})it('parses the helper state line', () => {