mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-15 22:33:05 -07:00
39 lines
930 B
TypeScript
39 lines
930 B
TypeScript
/**
|
|
* @license
|
|
* Copyright 2025 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
import { useIsScreenReaderEnabled } from 'ink';
|
|
|
|
export interface LayoutConfig {
|
|
shouldUseStatic: boolean;
|
|
shouldShowFooterInComposer: boolean;
|
|
mode: 'default' | 'screenReader';
|
|
allowStaticToggle?: boolean;
|
|
}
|
|
|
|
export interface LayoutConfigOptions {
|
|
forceStaticMode?: boolean;
|
|
allowToggle?: boolean;
|
|
}
|
|
|
|
export const useLayoutConfig = (
|
|
options?: LayoutConfigOptions,
|
|
): LayoutConfig => {
|
|
const isScreenReader = useIsScreenReaderEnabled();
|
|
|
|
// Allow overriding static behavior when toggle is enabled
|
|
const shouldUseStatic =
|
|
options?.forceStaticMode !== undefined
|
|
? options.forceStaticMode
|
|
: !isScreenReader;
|
|
|
|
return {
|
|
shouldUseStatic,
|
|
shouldShowFooterInComposer: !isScreenReader,
|
|
mode: isScreenReader ? 'screenReader' : 'default',
|
|
allowStaticToggle: options?.allowToggle ?? false,
|
|
};
|
|
};
|