|
4 | 4 | * SPDX-License-Identifier: Apache-2.0 |
5 | 5 | */ |
6 | 6 |
|
7 | | -import { Box, Text } from 'ink'; |
| 7 | +import { Box, Text, useIsScreenReaderEnabled } from 'ink'; |
8 | 8 | import { useAppContext } from '../contexts/AppContext.js'; |
9 | 9 | import { useUIState } from '../contexts/UIStateContext.js'; |
10 | 10 | import { theme } from '../semantic-colors.js'; |
11 | 11 | import { StreamingState } from '../types.js'; |
12 | 12 | import { UpdateNotification } from './UpdateNotification.js'; |
13 | 13 |
|
| 14 | +import { homedir } from 'node:os'; |
| 15 | +import path from 'node:path'; |
| 16 | + |
| 17 | +const settingsPath = path.join(homedir(), '.gemini', 'settings.json'); |
| 18 | + |
14 | 19 | export const Notifications = () => { |
15 | 20 | const { startupWarnings } = useAppContext(); |
16 | 21 | const { initError, streamingState, updateInfo } = useUIState(); |
17 | | - |
| 22 | + const isScreenReaderEnabled = useIsScreenReaderEnabled(); |
18 | 23 | const showStartupWarnings = startupWarnings.length > 0; |
19 | 24 | const showInitError = |
20 | 25 | initError && streamingState !== StreamingState.Responding; |
21 | 26 |
|
22 | | - if (!showStartupWarnings && !showInitError && !updateInfo) { |
| 27 | + if ( |
| 28 | + !showStartupWarnings && |
| 29 | + !showInitError && |
| 30 | + !updateInfo && |
| 31 | + !isScreenReaderEnabled |
| 32 | + ) { |
23 | 33 | return null; |
24 | 34 | } |
25 | 35 |
|
26 | 36 | return ( |
27 | 37 | <> |
| 38 | + {isScreenReaderEnabled && ( |
| 39 | + <Text> |
| 40 | + You are currently in screen reader-friendly view. To switch out, open{' '} |
| 41 | + {settingsPath} and remove the entry for {'"screenReader"'}. |
| 42 | + </Text> |
| 43 | + )} |
28 | 44 | {updateInfo && <UpdateNotification message={updateInfo.message} />} |
29 | 45 | {showStartupWarnings && ( |
30 | 46 | <Box |
|
0 commit comments