diff --git a/packages/app/src/components/settings-general.tsx b/packages/app/src/components/settings-general.tsx index b0db4effb3..2b31cfb55c 100644 --- a/packages/app/src/components/settings-general.tsx +++ b/packages/app/src/components/settings-general.tsx @@ -143,8 +143,31 @@ export const SettingsGeneral: Component = () => { const shellOptions = createMemo(() => { const list = shells() || [] const current = globalSync.data.config.shell - const options = list.map((s) => ({ value: s, label: s })) - if (current && !list.includes(current)) { + + const getShortName = (p: string) => { + const parts = p.split(/[/\\]/) + let name = parts[parts.length - 1] + if (name.toLowerCase().endsWith(".exe")) { + name = name.slice(0, -4) + } + return name + } + + const nameCounts = new Map() + for (const s of list) { + const name = getShortName(s) + nameCounts.set(name, (nameCounts.get(name) || 0) + 1) + } + + const options = list.map((s) => { + const name = getShortName(s) + const isDuplicate = (nameCounts.get(name) || 0) > 1 + const label = isDuplicate ? s : name + const value = isDuplicate ? s : name + return { value, label } + }) + + if (current && !options.some((o) => o.value === current)) { options.unshift({ value: current, label: current }) } return options @@ -344,24 +367,23 @@ export const SettingsGeneral: Component = () => { } >