support more browsers

This commit is contained in:
Julian Freeman
2026-04-16 21:47:00 -04:00
parent ca649f700f
commit 83f762435b
5 changed files with 55 additions and 2 deletions

View File

@@ -73,6 +73,35 @@ pub fn browser_definitions() -> Vec<BrowserDefinition> {
]), ]),
], ],
}, },
BrowserDefinition {
id: "vivaldi",
name: "Vivaldi",
local_app_data_segments: &["Vivaldi", "User Data"],
executable_candidates: &[
ExecutableCandidate::LocalAppData(&["Vivaldi", "Application", "vivaldi.exe"]),
ExecutableCandidate::ProgramFiles(&["Vivaldi", "Application", "vivaldi.exe"]),
],
},
BrowserDefinition {
id: "yandex",
name: "Yandex Browser",
local_app_data_segments: &["Yandex", "YandexBrowser", "User Data"],
executable_candidates: &[ExecutableCandidate::LocalAppData(&[
"Yandex",
"YandexBrowser",
"Application",
"browser.exe",
])],
},
BrowserDefinition {
id: "chromium",
name: "Chromium",
local_app_data_segments: &["Chromium", "User Data"],
executable_candidates: &[
ExecutableCandidate::LocalAppData(&["Chromium", "Application", "chrome.exe"]),
ExecutableCandidate::ProgramFiles(&["Chromium", "Application", "chrome.exe"]),
],
},
] ]
} }

View File

@@ -205,6 +205,9 @@ fn infer_browser_family_id(icon_key: Option<&str>) -> Option<String> {
Some("chrome") => Some("chrome".to_string()), Some("chrome") => Some("chrome".to_string()),
Some("edge") => Some("edge".to_string()), Some("edge") => Some("edge".to_string()),
Some("brave") => Some("brave".to_string()), Some("brave") => Some("brave".to_string()),
Some("vivaldi") => Some("vivaldi".to_string()),
Some("yandex") => Some("yandex".to_string()),
Some("chromium") => Some("chromium".to_string()),
_ => None, _ => None,
} }
} }

BIN
src/assets/chromium.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

View File

@@ -229,6 +229,9 @@ export function useBrowserManager() {
if (iconKey === "chrome") return "CH"; if (iconKey === "chrome") return "CH";
if (iconKey === "edge") return "ED"; if (iconKey === "edge") return "ED";
if (iconKey === "brave") return "BR"; if (iconKey === "brave") return "BR";
if (iconKey === "vivaldi") return "VI";
if (iconKey === "yandex") return "YA";
if (iconKey === "chromium") return "CR";
const name = current?.browserName?.trim() ?? ""; const name = current?.browserName?.trim() ?? "";
if (name) { if (name) {
@@ -248,6 +251,9 @@ export function useBrowserManager() {
if (iconKey === "chrome") return "CH"; if (iconKey === "chrome") return "CH";
if (iconKey === "edge") return "ED"; if (iconKey === "edge") return "ED";
if (iconKey === "brave") return "BR"; if (iconKey === "brave") return "BR";
if (iconKey === "vivaldi") return "VI";
if (iconKey === "yandex") return "YA";
if (iconKey === "chromium") return "CR";
const letters = config.name const letters = config.name
.trim() .trim()

View File

@@ -1,7 +1,10 @@
import braveIcon from "../assets/brave.png"; import braveIcon from "../assets/brave.png";
import chromiumIcon from "../assets/chromium.png";
import chromeIcon from "../assets/google-chrome.png"; import chromeIcon from "../assets/google-chrome.png";
import edgeIcon from "../assets/microsoft-edge.png"; import edgeIcon from "../assets/microsoft-edge.png";
import settingsIcon from "../assets/settings.png"; import settingsIcon from "../assets/settings.png";
import vivaldiIcon from "../assets/vivaldi.png";
import yandexIcon from "../assets/yandex.png";
import type { import type {
AssociatedProfileSummary, AssociatedProfileSummary,
BookmarkAssociatedProfileSummary, BookmarkAssociatedProfileSummary,
@@ -12,6 +15,9 @@ export const browserIconOptions = [
{ key: "chrome", label: "Google Chrome", src: chromeIcon }, { key: "chrome", label: "Google Chrome", src: chromeIcon },
{ key: "edge", label: "Microsoft Edge", src: edgeIcon }, { key: "edge", label: "Microsoft Edge", src: edgeIcon },
{ key: "brave", label: "Brave", src: braveIcon }, { key: "brave", label: "Brave", src: braveIcon },
{ key: "vivaldi", label: "Vivaldi", src: vivaldiIcon },
{ key: "yandex", label: "Yandex Browser", src: yandexIcon },
{ key: "chromium", label: "Chromium", src: chromiumIcon },
] as const; ] as const;
export function browserIconSrc(iconKey: string | null | undefined) { export function browserIconSrc(iconKey: string | null | undefined) {
@@ -83,15 +89,16 @@ export function profileAvatarSrc(
return profile.avatarDataUrl; return profile.avatarDataUrl;
} }
const avatarFamilyId = resolveAvatarFamilyId(browserFamilyId);
const avatarKey = normalizeAvatarIcon(profile.avatarIcon); const avatarKey = normalizeAvatarIcon(profile.avatarIcon);
if (avatarKey) { if (avatarKey) {
const familyMap = browserFamilyId ? avatarMap[browserFamilyId] : undefined; const familyMap = avatarFamilyId ? avatarMap[avatarFamilyId] : undefined;
if (familyMap?.[avatarKey]) { if (familyMap?.[avatarKey]) {
return familyMap[avatarKey]; return familyMap[avatarKey];
} }
} }
if (browserFamilyId === "chrome") { if (avatarFamilyId === "chrome") {
return createChromeGeneratedAvatar( return createChromeGeneratedAvatar(
profile.defaultAvatarFillColor, profile.defaultAvatarFillColor,
profile.defaultAvatarStrokeColor, profile.defaultAvatarStrokeColor,
@@ -110,6 +117,14 @@ function normalizeAvatarIcon(value: string | null | undefined) {
return lastSegment.replace(/\.png$/i, ""); return lastSegment.replace(/\.png$/i, "");
} }
function resolveAvatarFamilyId(browserFamilyId: string | null | undefined) {
if (browserFamilyId === "chromium") {
return "chrome";
}
return browserFamilyId ?? null;
}
function createChromeGeneratedAvatar( function createChromeGeneratedAvatar(
backgroundArgb: number | null | undefined, backgroundArgb: number | null | undefined,
foregroundArgb: number | null | undefined, foregroundArgb: number | null | undefined,