From 4d002415493582c6c7804032e3810a49cd948f5c Mon Sep 17 00:00:00 2001 From: Max Li Date: Fri, 20 Mar 2026 12:16:55 -0700 Subject: [PATCH] fix: prefer account email over generic profile name in picker Chrome profiles signed into a Google account often have generic display names like "Person 2". Check account_info[0].email first for a more readable label, falling back to profile.name as before. Addresses review feedback from @ngurney. Co-Authored-By: Claude Opus 4.6 (1M context) --- browse/src/cookie-import-browser.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/browse/src/cookie-import-browser.ts b/browse/src/cookie-import-browser.ts index ec4e61ab..7a9e7581 100644 --- a/browse/src/cookie-import-browser.ts +++ b/browse/src/cookie-import-browser.ts @@ -152,15 +152,22 @@ export function listProfiles(browserName: string): ProfileEntry[] { const cookiePath = path.join(browserDir, entry.name, 'Cookies'); if (!fs.existsSync(cookiePath)) continue; - // Try to read display name from Preferences + // Try to read display name from Preferences. + // Prefer account email — signed-in Chrome profiles often have generic + // names like "Person 2" while the email is far more readable. let displayName = entry.name; try { const prefsPath = path.join(browserDir, entry.name, 'Preferences'); if (fs.existsSync(prefsPath)) { const prefs = JSON.parse(fs.readFileSync(prefsPath, 'utf-8')); - const profileName = prefs?.profile?.name; - if (profileName && typeof profileName === 'string') { - displayName = profileName; + const email = prefs?.account_info?.[0]?.email; + if (email && typeof email === 'string') { + displayName = email; + } else { + const profileName = prefs?.profile?.name; + if (profileName && typeof profileName === 'string') { + displayName = profileName; + } } } } catch {