From f3c48b19a0cd1f7cb4945cbcfb55b5171a9e92a2 Mon Sep 17 00:00:00 2001 From: Ivan Ottinger <25105483+ivan-ottinger@users.noreply.github.com> Date: Tue, 26 May 2026 16:58:02 +0200 Subject: [PATCH 1/3] Show File Manager label on Linux for the Open Folder button --- apps/studio/src/components/content-tab-overview.tsx | 5 ++++- apps/studio/src/components/site-menu.tsx | 8 ++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/apps/studio/src/components/content-tab-overview.tsx b/apps/studio/src/components/content-tab-overview.tsx index e1eda39410..f8ce2f502b 100644 --- a/apps/studio/src/components/content-tab-overview.tsx +++ b/apps/studio/src/components/content-tab-overview.tsx @@ -20,7 +20,7 @@ import { ArrowIcon } from 'src/components/arrow-icon'; import { ButtonsSection, ButtonsSectionProps } from 'src/components/buttons-section'; import { useSiteDetails } from 'src/hooks/use-site-details'; import { useThemeDetails } from 'src/hooks/use-theme-details'; -import { isWindows } from 'src/lib/app-globals'; +import { isLinux, isWindows } from 'src/lib/app-globals'; import { cx } from 'src/lib/cx'; import { getIpcApi } from 'src/lib/get-ipc-api'; import { supportedEditorConfig } from 'src/modules/user-settings/lib/editor'; @@ -143,6 +143,9 @@ function ShortcutsSection( { selectedSite }: Pick< ContentTabOverviewProps, 'sel label: isWindows() ? // translators: name of app used to navigate files and folders on Windows __( 'File Explorer' ) + : isLinux() + ? // translators: generic name of the app used to navigate files and folders on Linux + __( 'File Manager' ) : // translators: name of app used to navigate files and folders on macOS __( 'Finder' ), className: 'text-nowrap', diff --git a/apps/studio/src/components/site-menu.tsx b/apps/studio/src/components/site-menu.tsx index 08f79f7b06..99db4223a4 100644 --- a/apps/studio/src/components/site-menu.tsx +++ b/apps/studio/src/components/site-menu.tsx @@ -9,7 +9,7 @@ import { useContentTabs } from 'src/hooks/use-content-tabs'; import { useDeleteSite } from 'src/hooks/use-delete-site'; import { useImportExport } from 'src/hooks/use-import-export'; import { useSiteDetails } from 'src/hooks/use-site-details'; -import { isMac, isWindows } from 'src/lib/app-globals'; +import { isLinux, isMac, isWindows } from 'src/lib/app-globals'; import { cx } from 'src/lib/cx'; import { getIpcApi } from 'src/lib/get-ipc-api'; import { supportedEditorConfig } from 'src/modules/user-settings/lib/editor'; @@ -188,7 +188,11 @@ function SiteItem( { const isLoading = loadingServer[ site.id ] || false; const isAddingSite = site.isAddingSite || false; const isAnySiteAdding = sites.some( ( s ) => s.isAddingSite ); - const finderLabel = isWindows() ? __( 'File Explorer' ) : __( 'Finder' ); + const finderLabel = isWindows() + ? __( 'File Explorer' ) + : isLinux() + ? __( 'File Manager' ) + : __( 'Finder' ); const editorLabel = editor && supportedEditorConfig[ editor ] ? supportedEditorConfig[ editor ].label : null; const terminalLabel = getTerminalName( terminal ); From cb95499bf9326f762587ad22c2b2255227dc04a2 Mon Sep 17 00:00:00 2001 From: Ivan Ottinger <25105483+ivan-ottinger@users.noreply.github.com> Date: Tue, 26 May 2026 17:12:53 +0200 Subject: [PATCH 2/3] Extract getFileManagerLabel helper to avoid nested ternaries --- .../src/components/content-tab-overview.tsx | 11 ++--------- apps/studio/src/components/site-menu.tsx | 8 ++------ ...ontent-tab-overview-shortcuts-section.test.tsx | 1 + .../tests/content-tab-overview.test.tsx | 1 + apps/studio/src/lib/app-globals.ts | 15 +++++++++++++++ 5 files changed, 21 insertions(+), 15 deletions(-) diff --git a/apps/studio/src/components/content-tab-overview.tsx b/apps/studio/src/components/content-tab-overview.tsx index f8ce2f502b..433cb55695 100644 --- a/apps/studio/src/components/content-tab-overview.tsx +++ b/apps/studio/src/components/content-tab-overview.tsx @@ -20,7 +20,7 @@ import { ArrowIcon } from 'src/components/arrow-icon'; import { ButtonsSection, ButtonsSectionProps } from 'src/components/buttons-section'; import { useSiteDetails } from 'src/hooks/use-site-details'; import { useThemeDetails } from 'src/hooks/use-theme-details'; -import { isLinux, isWindows } from 'src/lib/app-globals'; +import { getFileManagerLabel } from 'src/lib/app-globals'; import { cx } from 'src/lib/cx'; import { getIpcApi } from 'src/lib/get-ipc-api'; import { supportedEditorConfig } from 'src/modules/user-settings/lib/editor'; @@ -140,14 +140,7 @@ function ShortcutsSection( { selectedSite }: Pick< ContentTabOverviewProps, 'sel const buttonsArray: ButtonsSectionProps[ 'buttonsArray' ] = [ { - label: isWindows() - ? // translators: name of app used to navigate files and folders on Windows - __( 'File Explorer' ) - : isLinux() - ? // translators: generic name of the app used to navigate files and folders on Linux - __( 'File Manager' ) - : // translators: name of app used to navigate files and folders on macOS - __( 'Finder' ), + label: getFileManagerLabel(), className: 'text-nowrap', icon: archive, onClick: () => { diff --git a/apps/studio/src/components/site-menu.tsx b/apps/studio/src/components/site-menu.tsx index 99db4223a4..27ccf888d9 100644 --- a/apps/studio/src/components/site-menu.tsx +++ b/apps/studio/src/components/site-menu.tsx @@ -9,7 +9,7 @@ import { useContentTabs } from 'src/hooks/use-content-tabs'; import { useDeleteSite } from 'src/hooks/use-delete-site'; import { useImportExport } from 'src/hooks/use-import-export'; import { useSiteDetails } from 'src/hooks/use-site-details'; -import { isLinux, isMac, isWindows } from 'src/lib/app-globals'; +import { getFileManagerLabel, isMac } from 'src/lib/app-globals'; import { cx } from 'src/lib/cx'; import { getIpcApi } from 'src/lib/get-ipc-api'; import { supportedEditorConfig } from 'src/modules/user-settings/lib/editor'; @@ -188,11 +188,7 @@ function SiteItem( { const isLoading = loadingServer[ site.id ] || false; const isAddingSite = site.isAddingSite || false; const isAnySiteAdding = sites.some( ( s ) => s.isAddingSite ); - const finderLabel = isWindows() - ? __( 'File Explorer' ) - : isLinux() - ? __( 'File Manager' ) - : __( 'Finder' ); + const finderLabel = getFileManagerLabel(); const editorLabel = editor && supportedEditorConfig[ editor ] ? supportedEditorConfig[ editor ].label : null; const terminalLabel = getTerminalName( terminal ); diff --git a/apps/studio/src/components/tests/content-tab-overview-shortcuts-section.test.tsx b/apps/studio/src/components/tests/content-tab-overview-shortcuts-section.test.tsx index 8f6c64b83c..60d75826ee 100644 --- a/apps/studio/src/components/tests/content-tab-overview-shortcuts-section.test.tsx +++ b/apps/studio/src/components/tests/content-tab-overview-shortcuts-section.test.tsx @@ -14,6 +14,7 @@ vi.mock( 'src/lib/app-globals', () => ( { isWindows: vi.fn().mockReturnValue( false ), isLinux: vi.fn().mockReturnValue( false ), isMac: vi.fn().mockReturnValue( false ), + getFileManagerLabel: vi.fn().mockReturnValue( 'Finder' ), getAppGlobals: vi.fn( () => ( { platform: 'darwin', } ) ), diff --git a/apps/studio/src/components/tests/content-tab-overview.test.tsx b/apps/studio/src/components/tests/content-tab-overview.test.tsx index 1489d8e76d..0d23567d77 100644 --- a/apps/studio/src/components/tests/content-tab-overview.test.tsx +++ b/apps/studio/src/components/tests/content-tab-overview.test.tsx @@ -12,6 +12,7 @@ import { testActions, testReducer } from 'src/stores/tests/utils/test-reducer'; vi.mock( 'src/lib/app-globals', () => ( { isWindows: vi.fn().mockReturnValue( false ), isLinux: vi.fn().mockReturnValue( false ), + getFileManagerLabel: vi.fn().mockReturnValue( 'Finder' ), getAppGlobals: vi.fn( () => ( { platform: 'darwin' } ) ), } ) ); vi.mock( 'src/hooks/use-site-details' ); diff --git a/apps/studio/src/lib/app-globals.ts b/apps/studio/src/lib/app-globals.ts index a1b7390fa7..43aaec3043 100644 --- a/apps/studio/src/lib/app-globals.ts +++ b/apps/studio/src/lib/app-globals.ts @@ -1,3 +1,5 @@ +import { __ } from '@wordpress/i18n'; + export function getAppGlobals(): AppGlobals { return window.appGlobals; } @@ -26,3 +28,16 @@ export function isLinux() { export function isWindowsStore() { return getAppGlobals().isWindowsStore; } + +export function getFileManagerLabel(): string { + if ( isWindows() ) { + // translators: name of app used to navigate files and folders on Windows + return __( 'File Explorer' ); + } + if ( isLinux() ) { + // translators: generic name of the app used to navigate files and folders on Linux + return __( 'File Manager' ); + } + // translators: name of app used to navigate files and folders on macOS + return __( 'Finder' ); +} From 00d634bc477bacd526fd7ffd25582c7a001d012e Mon Sep 17 00:00:00 2001 From: Ivan Ottinger <25105483+ivan-ottinger@users.noreply.github.com> Date: Tue, 26 May 2026 17:25:50 +0200 Subject: [PATCH 3/3] Move getFileManagerLabel into its own file-manager module --- .../src/components/content-tab-overview.tsx | 2 +- apps/studio/src/components/site-menu.tsx | 3 ++- ...ontent-tab-overview-shortcuts-section.test.tsx | 4 +++- .../tests/content-tab-overview.test.tsx | 4 +++- apps/studio/src/lib/app-globals.ts | 15 --------------- apps/studio/src/lib/file-manager.ts | 15 +++++++++++++++ 6 files changed, 24 insertions(+), 19 deletions(-) create mode 100644 apps/studio/src/lib/file-manager.ts diff --git a/apps/studio/src/components/content-tab-overview.tsx b/apps/studio/src/components/content-tab-overview.tsx index 433cb55695..7984a7bf2d 100644 --- a/apps/studio/src/components/content-tab-overview.tsx +++ b/apps/studio/src/components/content-tab-overview.tsx @@ -20,8 +20,8 @@ import { ArrowIcon } from 'src/components/arrow-icon'; import { ButtonsSection, ButtonsSectionProps } from 'src/components/buttons-section'; import { useSiteDetails } from 'src/hooks/use-site-details'; import { useThemeDetails } from 'src/hooks/use-theme-details'; -import { getFileManagerLabel } from 'src/lib/app-globals'; import { cx } from 'src/lib/cx'; +import { getFileManagerLabel } from 'src/lib/file-manager'; import { getIpcApi } from 'src/lib/get-ipc-api'; import { supportedEditorConfig } from 'src/modules/user-settings/lib/editor'; import { getTerminalName } from 'src/modules/user-settings/lib/terminal'; diff --git a/apps/studio/src/components/site-menu.tsx b/apps/studio/src/components/site-menu.tsx index 27ccf888d9..626d9698cf 100644 --- a/apps/studio/src/components/site-menu.tsx +++ b/apps/studio/src/components/site-menu.tsx @@ -9,8 +9,9 @@ import { useContentTabs } from 'src/hooks/use-content-tabs'; import { useDeleteSite } from 'src/hooks/use-delete-site'; import { useImportExport } from 'src/hooks/use-import-export'; import { useSiteDetails } from 'src/hooks/use-site-details'; -import { getFileManagerLabel, isMac } from 'src/lib/app-globals'; +import { isMac } from 'src/lib/app-globals'; import { cx } from 'src/lib/cx'; +import { getFileManagerLabel } from 'src/lib/file-manager'; import { getIpcApi } from 'src/lib/get-ipc-api'; import { supportedEditorConfig } from 'src/modules/user-settings/lib/editor'; import { getTerminalName } from 'src/modules/user-settings/lib/terminal'; diff --git a/apps/studio/src/components/tests/content-tab-overview-shortcuts-section.test.tsx b/apps/studio/src/components/tests/content-tab-overview-shortcuts-section.test.tsx index 60d75826ee..f6164c8130 100644 --- a/apps/studio/src/components/tests/content-tab-overview-shortcuts-section.test.tsx +++ b/apps/studio/src/components/tests/content-tab-overview-shortcuts-section.test.tsx @@ -14,11 +14,13 @@ vi.mock( 'src/lib/app-globals', () => ( { isWindows: vi.fn().mockReturnValue( false ), isLinux: vi.fn().mockReturnValue( false ), isMac: vi.fn().mockReturnValue( false ), - getFileManagerLabel: vi.fn().mockReturnValue( 'Finder' ), getAppGlobals: vi.fn( () => ( { platform: 'darwin', } ) ), } ) ); +vi.mock( 'src/lib/file-manager', () => ( { + getFileManagerLabel: vi.fn().mockReturnValue( 'Finder' ), +} ) ); const selectedSite: StartedSiteDetails = { name: 'Test Site', diff --git a/apps/studio/src/components/tests/content-tab-overview.test.tsx b/apps/studio/src/components/tests/content-tab-overview.test.tsx index 0d23567d77..243aae8c67 100644 --- a/apps/studio/src/components/tests/content-tab-overview.test.tsx +++ b/apps/studio/src/components/tests/content-tab-overview.test.tsx @@ -12,9 +12,11 @@ import { testActions, testReducer } from 'src/stores/tests/utils/test-reducer'; vi.mock( 'src/lib/app-globals', () => ( { isWindows: vi.fn().mockReturnValue( false ), isLinux: vi.fn().mockReturnValue( false ), - getFileManagerLabel: vi.fn().mockReturnValue( 'Finder' ), getAppGlobals: vi.fn( () => ( { platform: 'darwin' } ) ), } ) ); +vi.mock( 'src/lib/file-manager', () => ( { + getFileManagerLabel: vi.fn().mockReturnValue( 'Finder' ), +} ) ); vi.mock( 'src/hooks/use-site-details' ); vi.mock( 'src/hooks/use-theme-details' ); vi.mock( 'src/lib/get-ipc-api', () => ( { diff --git a/apps/studio/src/lib/app-globals.ts b/apps/studio/src/lib/app-globals.ts index 43aaec3043..a1b7390fa7 100644 --- a/apps/studio/src/lib/app-globals.ts +++ b/apps/studio/src/lib/app-globals.ts @@ -1,5 +1,3 @@ -import { __ } from '@wordpress/i18n'; - export function getAppGlobals(): AppGlobals { return window.appGlobals; } @@ -28,16 +26,3 @@ export function isLinux() { export function isWindowsStore() { return getAppGlobals().isWindowsStore; } - -export function getFileManagerLabel(): string { - if ( isWindows() ) { - // translators: name of app used to navigate files and folders on Windows - return __( 'File Explorer' ); - } - if ( isLinux() ) { - // translators: generic name of the app used to navigate files and folders on Linux - return __( 'File Manager' ); - } - // translators: name of app used to navigate files and folders on macOS - return __( 'Finder' ); -} diff --git a/apps/studio/src/lib/file-manager.ts b/apps/studio/src/lib/file-manager.ts new file mode 100644 index 0000000000..1c671a8b6d --- /dev/null +++ b/apps/studio/src/lib/file-manager.ts @@ -0,0 +1,15 @@ +import { __ } from '@wordpress/i18n'; +import { isLinux, isWindows } from 'src/lib/app-globals'; + +export function getFileManagerLabel(): string { + if ( isWindows() ) { + // translators: name of app used to navigate files and folders on Windows + return __( 'File Explorer' ); + } + if ( isLinux() ) { + // translators: generic name of the app used to navigate files and folders on Linux + return __( 'File Manager' ); + } + // translators: name of app used to navigate files and folders on macOS + return __( 'Finder' ); +}