diff --git a/packages/cli/src/config/footerItems.ts b/packages/cli/src/config/footerItems.ts
index 612418a48f..4688a3fe23 100644
--- a/packages/cli/src/config/footerItems.ts
+++ b/packages/cli/src/config/footerItems.ts
@@ -22,6 +22,11 @@ export const ALL_ITEMS = [
header: 'sandbox',
description: 'Sandbox type and trust indicator',
},
+ {
+ id: 'hostname',
+ header: 'host',
+ description: 'System hostname (only shown when remote or in a container)',
+ },
{
id: 'model-name',
header: '/model',
@@ -70,6 +75,7 @@ export const DEFAULT_ORDER = [
'workspace',
'git-branch',
'sandbox',
+ 'hostname',
'model-name',
'context-used',
'quota',
@@ -87,6 +93,7 @@ export function deriveItemsFromLegacySettings(
'workspace',
'git-branch',
'sandbox',
+ 'hostname',
'model-name',
'quota',
];
diff --git a/packages/cli/src/ui/components/Footer.test.tsx b/packages/cli/src/ui/components/Footer.test.tsx
index ab242928aa..eac7cb86bd 100644
--- a/packages/cli/src/ui/components/Footer.test.tsx
+++ b/packages/cli/src/ui/components/Footer.test.tsx
@@ -861,6 +861,47 @@ describe('', () => {
expect(output).toContain('/model');
unmount();
});
+
+ it('renders hostname item when enabled and remote', async () => {
+ vi.stubEnv('SSH_TTY', '/dev/pts/1');
+ const { lastFrame, unmount } = await renderWithProviders(, {
+ config: mockConfig,
+ width: 120,
+ uiState: { sessionStats: mockSessionStats },
+ settings: createMockSettings({
+ ui: {
+ footer: {
+ items: ['hostname'],
+ },
+ },
+ }),
+ });
+
+ expect(lastFrame()).toContain('host');
+ unmount();
+ });
+
+ it('does NOT render hostname item when enabled but NOT remote', async () => {
+ // Ensure no remote env vars are set
+ vi.stubEnv('SSH_TTY', '');
+ vi.stubEnv('CLOUD_SHELL', '');
+
+ const { lastFrame, unmount } = await renderWithProviders(, {
+ config: mockConfig,
+ width: 120,
+ uiState: { sessionStats: mockSessionStats },
+ settings: createMockSettings({
+ ui: {
+ footer: {
+ items: ['hostname'],
+ },
+ },
+ }),
+ });
+
+ expect(lastFrame({ allowEmpty: true })).not.toContain('host');
+ unmount();
+ });
});
describe('fallback mode display', () => {
diff --git a/packages/cli/src/ui/components/Footer.tsx b/packages/cli/src/ui/components/Footer.tsx
index d21345d831..72145b659c 100644
--- a/packages/cli/src/ui/components/Footer.tsx
+++ b/packages/cli/src/ui/components/Footer.tsx
@@ -18,6 +18,8 @@ import {
} from '@google/gemini-cli-core';
import { ConsoleSummaryDisplay } from './ConsoleSummaryDisplay.js';
import process from 'node:process';
+import { hostname } from 'node:os';
+import * as fs from 'node:fs';
import { MemoryUsageDisplay } from './MemoryUsageDisplay.js';
import { ContextUsageDisplay } from './ContextUsageDisplay.js';
import { QuotaDisplay } from './QuotaDisplay.js';
@@ -35,6 +37,8 @@ import {
} from '../../config/footerItems.js';
import { isDevelopment } from '../../utils/installationInfo.js';
+const SYSTEM_HOSTNAME = hostname().split('.')[0];
+
interface CwdIndicatorProps {
targetDir: string;
maxWidth: number;
@@ -172,14 +176,22 @@ interface FooterColumn {
width: number;
isHighPriority: boolean;
}
-
export const Footer: React.FC = () => {
const uiState = useUIState();
const quotaState = useQuotaState();
const { copyModeEnabled } = useInputState();
const config = useConfig();
const settings = useSettings();
- const { vimEnabled, vimMode } = useVimMode();
+ const { vimMode, vimEnabled } = useVimMode();
+
+ const isRemote =
+ process.env['SSH_TTY'] ||
+ process.env['SSH_CONNECTION'] ||
+ process.env['SSH_CLIENT'] ||
+ process.env['CLOUD_SHELL'] === 'true' ||
+ process.env['EDITOR_IN_CLOUD_SHELL'] === 'true' ||
+ process.env['KUBERNETES_SERVICE_HOST'] ||
+ (process.platform === 'linux' && fs.existsSync('/.dockerenv'));
const authType = config.getContentGeneratorConfig()?.authType;
const [email, setEmail] = useState();
@@ -319,6 +331,17 @@ export const Footer: React.FC = () => {
);
break;
}
+ case 'hostname': {
+ if (isRemote && SYSTEM_HOSTNAME) {
+ addCol(
+ id,
+ header,
+ () => {SYSTEM_HOSTNAME},
+ SYSTEM_HOSTNAME.length,
+ );
+ }
+ break;
+ }
case 'model-name': {
const str = getDisplayString(model);
addCol(