MCPcopy Index your code
hub / github.com/codeaashu/claude-code / GlobalKeybindingHandlers

Function GlobalKeybindingHandlers

src/hooks/useGlobalKeybindings.tsx:36–248  ·  view source on GitHub ↗
({
  screen,
  setScreen,
  showAllInTranscript,
  setShowAllInTranscript,
  messageCount,
  onEnterTranscript,
  onExitTranscript,
  virtualScrollActive,
  searchBarOpen = false
}: Props)

Source from the content-addressed store, hash-verified

34 * - ctrl+c/escape: Exit transcript mode
35 */
36export function GlobalKeybindingHandlers({
37 screen,
38 setScreen,
39 showAllInTranscript,
40 setShowAllInTranscript,
41 messageCount,
42 onEnterTranscript,
43 onExitTranscript,
44 virtualScrollActive,
45 searchBarOpen = false
46}: Props): null {
47 const expandedView = useAppState(s => s.expandedView);
48 const setAppState = useSetAppState();
49
50 // Toggle todo list (ctrl+t) - cycles through views
51 const handleToggleTodos = useCallback(() => {
52 logEvent('tengu_toggle_todos', {
53 is_expanded: expandedView === 'tasks'
54 });
55 setAppState(prev => {
56 const {
57 getAllInProcessTeammateTasks
58 } =
59 // eslint-disable-next-line @typescript-eslint/no-require-imports
60 require('../tasks/InProcessTeammateTask/InProcessTeammateTask.js') as typeof import('../tasks/InProcessTeammateTask/InProcessTeammateTask.js');
61 const hasTeammates = count(getAllInProcessTeammateTasks(prev.tasks), t => t.status === 'running') > 0;
62 if (hasTeammates) {
63 // Both exist: none → tasks → teammates → none
64 switch (prev.expandedView) {
65 case 'none':
66 return {
67 ...prev,
68 expandedView: 'tasks' as const
69 };
70 case 'tasks':
71 return {
72 ...prev,
73 expandedView: 'teammates' as const
74 };
75 case 'teammates':
76 return {
77 ...prev,
78 expandedView: 'none' as const
79 };
80 }
81 }
82 // Only tasks: none ↔ tasks
83 return {
84 ...prev,
85 expandedView: prev.expandedView === 'tasks' ? 'none' as const : 'tasks' as const
86 };
87 });
88 }, [expandedView, setAppState]);
89
90 // Toggle transcript mode (ctrl+o). Two-way prompt ↔ transcript.
91 // Brief view has its own dedicated toggle on ctrl+shift+b.
92 const isBriefOnly = feature('KAIROS') || feature('KAIROS_BRIEF') ?
93 // biome-ignore lint/correctness/useHookAtTopLevel: feature() is a compile-time constant

Callers

nothing calls this directly

Calls 13

useAppStateFunction · 0.85
useSetAppStateFunction · 0.85
logEventFunction · 0.85
countFunction · 0.85
featureFunction · 0.85
isBriefEnabledFunction · 0.85
useKeybindingFunction · 0.85
getTerminalPanelFunction · 0.85
toggleMethod · 0.80
forceRedrawMethod · 0.80

Tested by

no test coverage detected