Hide Ghostty import from paired web clients

- Ghostty import now respects showDesktopOnlySettings, matching Warp behavior
- Consolidates desktop-only theme imports under a single showDesktopThemeImports flag
- Adds showGhosttyImport option to control visibility across settings UI and search
This commit is contained in:
m4air
2026-09-10 21:44:43 -07:00
committed by m4air
parent 6c1580aeba
commit e70bcc506b
7 changed files with 61 additions and 41 deletions
@@ -147,7 +147,10 @@ export function AppearancePane({
]
const terminalSearchEntries = [
{ title: terminalTitle },
...getTerminalAppearanceSearchEntries({ showWarpImport: !isWebClient })
...getTerminalAppearanceSearchEntries({
showWarpImport: !isWebClient,
showGhosttyImport: !isWebClient
})
]
const windowSearchEntries = [
{
@@ -473,7 +473,9 @@ describe('TerminalAppearanceSection ghostty import wiring', () => {
})
expect(findComponentByTypeName(element, 'TerminalFontSizeSetting')).toBeNull()
expect(findButtons(element).some((button) => button.text === 'Import from Ghostty')).toBe(false)
expect(
findButtons(element).some((button) => button.text === 'Import from Ghostty')
).toBe(false)
})
it('shows the Ghostty import button for Ghostty-only searches', () => {
@@ -524,6 +526,8 @@ describe('TerminalAppearanceSection ghostty import wiring', () => {
expect(findTerminalThemeCatalogSection(element)?.props.showThemeImport).toBe(false)
expect(findWarpThemeImportModal(element)).toBeNull()
expect(findButtons(element).some((button) => button.text === 'Import from Ghostty')).toBe(false)
expect(findGhosttyImportModal(element)).toBeNull()
})
it('passes hook state to GhosttyImportModal', () => {
@@ -83,7 +83,7 @@ export function TerminalAppearanceSection({
const isSearching = normalizeSettingsSearchQuery(searchQuery).length > 0
const [themeSearch, setThemeSearch] = useState('')
const [previewFontFamily, setPreviewFontFamily] = useState<string | null>(null)
const showWarpThemeImport = !isWebClientLocation()
const showDesktopThemeImports = !isWebClientLocation()
const darkThemeSearchEntries = getTerminalDarkThemeSearchEntries()
const lightThemeSearchEntries = getTerminalLightThemeSearchEntries()
const terminalTypographyEntries = getTerminalTypographySearchEntries()
@@ -92,7 +92,7 @@ export function TerminalAppearanceSection({
...getTerminalThemeTargetSearchEntries(),
...darkThemeSearchEntries,
...lightThemeSearchEntries,
...(showWarpThemeImport
...(showDesktopThemeImports
? [...getTerminalWarpImportSearchEntries(), ...getTerminalYamlImportSearchEntries()]
: [])
]
@@ -116,14 +116,16 @@ export function TerminalAppearanceSection({
searchQuery,
terminalTypographyEntries.slice(0, 2)
)
const ghosttyImportMatches = matchesSettingsSearch(searchQuery, ghosttyImportEntries)
const ghosttyImportMatches =
showDesktopThemeImports && matchesSettingsSearch(searchQuery, ghosttyImportEntries)
const showPrimaryTypography =
!isSearching ||
forceVisiblePrimary ||
primaryTypographyMatches ||
typographyMatches ||
ghosttyImportMatches
const showGhosttyImport = !isSearching || forceVisiblePrimary || ghosttyImportMatches
const showGhosttyImport =
showDesktopThemeImports && (!isSearching || forceVisiblePrimary || ghosttyImportMatches)
const showTypographyAdvancedDisclosure = !isSearching || typographyMatches
const advancedGroups = [
@@ -259,36 +261,38 @@ export function TerminalAppearanceSection({
previewFontFamily={previewFontFamily}
importedHighlightSignal={warpThemes.importSignal}
warpThemes={warpThemes}
showThemeImport={showWarpThemeImport}
showThemeImport={showDesktopThemeImports}
preferredTarget={preferredThemeTarget}
advancedContent={previewAdvancedContent}
/>
) : null}
<GhosttyImportModal
open={ghostty.open}
onOpenChange={ghostty.handleOpenChange}
preview={ghostty.preview}
loading={ghostty.loading}
onApply={ghostty.handleApply}
applied={ghostty.applied}
applyError={ghostty.applyError}
/>
{showWarpThemeImport ? (
<WarpThemeImportModal
open={warpThemes.open}
mode={warpThemes.mode}
preview={warpThemes.preview}
loading={warpThemes.loading}
desktopOnly={warpThemes.desktopOnly}
applyError={warpThemes.applyError}
selectedThemeIds={warpThemes.selectedThemeIds}
handlePreviewSource={warpThemes.handlePreviewSource}
handleToggleTheme={warpThemes.handleToggleTheme}
handleToggleAll={warpThemes.handleToggleAll}
handleApply={warpThemes.handleApply}
handleOpenChange={warpThemes.handleOpenChange}
/>
{showDesktopThemeImports ? (
<>
<GhosttyImportModal
open={ghostty.open}
onOpenChange={ghostty.handleOpenChange}
preview={ghostty.preview}
loading={ghostty.loading}
onApply={ghostty.handleApply}
applied={ghostty.applied}
applyError={ghostty.applyError}
/>
<WarpThemeImportModal
open={warpThemes.open}
mode={warpThemes.mode}
preview={warpThemes.preview}
loading={warpThemes.loading}
desktopOnly={warpThemes.desktopOnly}
applyError={warpThemes.applyError}
selectedThemeIds={warpThemes.selectedThemeIds}
handlePreviewSource={warpThemes.handlePreviewSource}
handleToggleTheme={warpThemes.handleToggleTheme}
handleToggleAll={warpThemes.handleToggleAll}
handleApply={warpThemes.handleApply}
handleOpenChange={warpThemes.handleOpenChange}
/>
</>
) : null}
</div>
)
@@ -224,6 +224,7 @@ const getAppearanceSectionEntries = createLocalizedCatalog((): SettingsSearchEnt
type AppearancePaneSearchOptions = {
showWarpImport?: boolean
showGhosttyImport?: boolean
showSystemTray?: boolean
showMenuBarIcon?: boolean
}
@@ -253,6 +254,7 @@ export function getAppearancePaneSearchEntries(
): SettingsSearchEntry[] {
return buildAppearancePaneSearchEntries({
showWarpImport: options.showWarpImport ?? true,
showGhosttyImport: options.showGhosttyImport ?? true,
showSystemTray: options.showSystemTray,
showMenuBarIcon: options.showMenuBarIcon
})
@@ -156,13 +156,16 @@ describe('getTerminalPaneSearchEntries', () => {
expect(matchesSettingsSearch(query, getAppearancePaneSearchEntries())).toBe(true)
})
it('omits the Warp import appearance entry when desktop-only controls are hidden', () => {
it('omits desktop-only import appearance entries when desktop-only controls are hidden', () => {
const desktopEntries = getAppearancePaneSearchEntries({ showWarpImport: true })
const webEntries = getAppearancePaneSearchEntries({ showWarpImport: false })
const webEntries = getAppearancePaneSearchEntries({
showWarpImport: false,
showGhosttyImport: false
})
expect(desktopEntries.some((entry) => entry.title === 'Import from Warp')).toBe(true)
expect(webEntries.some((entry) => entry.title === 'Import from Warp')).toBe(false)
expect(webEntries.some((entry) => entry.title === 'Import from Ghostty')).toBe(true)
expect(webEntries.some((entry) => entry.title === 'Import from Ghostty')).toBe(false)
})
it('includes the system tray appearance entry only when desktop tray controls are shown', () => {
@@ -64,9 +64,10 @@ export {
type TerminalAppearanceSearchOptions = {
showWarpImport?: boolean
showGhosttyImport?: boolean
}
const getTerminalAppearanceSearchEntriesWithoutWarp = createLocalizedCatalog(
const getTerminalAppearanceSearchEntriesCore = createLocalizedCatalog(
(): SettingsSearchEntry[] => [
...getTerminalTypographySearchEntries(),
...getTerminalCursorSearchEntries(),
@@ -74,8 +75,7 @@ const getTerminalAppearanceSearchEntriesWithoutWarp = createLocalizedCatalog(
...getTerminalThemeTargetSearchEntries(),
...getTerminalDarkThemeSearchEntries(),
...getTerminalLightThemeSearchEntries(),
...getTerminalWindowSearchEntries(),
...getTerminalGhosttyImportSearchEntries()
...getTerminalWindowSearchEntries()
]
)
@@ -83,7 +83,7 @@ const getTerminalAppearanceSearchEntriesWithoutWarp = createLocalizedCatalog(
// an English title would leak the Warp entry back in under non-English locales.
const getTerminalAppearanceSearchEntriesWithWarp = createLocalizedCatalog(
(): SettingsSearchEntry[] => [
...getTerminalAppearanceSearchEntriesWithoutWarp(),
...getTerminalAppearanceSearchEntriesCore(),
...getTerminalWarpImportSearchEntries(),
...getTerminalYamlImportSearchEntries()
]
@@ -92,9 +92,12 @@ const getTerminalAppearanceSearchEntriesWithWarp = createLocalizedCatalog(
export function getTerminalAppearanceSearchEntries(
options: TerminalAppearanceSearchOptions = {}
): SettingsSearchEntry[] {
return (options.showWarpImport ?? true)
? getTerminalAppearanceSearchEntriesWithWarp()
: getTerminalAppearanceSearchEntriesWithoutWarp()
return [
...((options.showWarpImport ?? true)
? getTerminalAppearanceSearchEntriesWithWarp()
: getTerminalAppearanceSearchEntriesCore()),
...((options.showGhosttyImport ?? true) ? getTerminalGhosttyImportSearchEntries() : [])
]
}
export function getTerminalPaneSearchEntries(platform: {
@@ -27,6 +27,7 @@ export function buildInterfaceSettingsSections({
icon: Palette,
searchEntries: getAppearancePaneSearchEntries({
showWarpImport: showDesktopOnlySettings,
showGhosttyImport: showDesktopOnlySettings,
showSystemTray: showDesktopOnlySettings && isWindows,
showMenuBarIcon: showDesktopOnlySettings && isMac
}),