ClawWork icon indicating copy to clipboard operation
ClawWork copied to clipboard

[Cleanup] Extract keyboard shortcuts and settings bootstrap from App.tsx

Open samzong opened this issue 8 months ago • 2 comments

What problem are you trying to solve?

App.tsx (281 lines) handles 5+ concerns inline: layout, keyboard shortcuts, settings bootstrap, workspace detection, and window/tray event handling. Some hooks have already been extracted (useGatewayBootstrap, useUpdateCheck, useTraySync), but keyboard shortcuts and settings bootstrap are still inline, making the root component harder to read and test.

Where

packages/desktop/src/renderer/App.tsx

What needs to be done

  1. Open packages/desktop/src/renderer/App.tsx
  2. Extract a useKeyboardShortcuts() hook:
    • Move the handleGlobalKeyDown function and the useEffect that attaches/detaches the keydown listener
    • The hook should accept any dependencies it needs as parameters
    • Place it in packages/desktop/src/renderer/hooks/useKeyboardShortcuts.ts
  3. Extract a useSettingsBootstrap() hook:
    • Move the settings loading useEffect that runs on mount
    • Place it in packages/desktop/src/renderer/hooks/useSettingsBootstrap.ts
  4. Import and call both hooks in App.tsx
  5. Run pnpm check to verify nothing breaks

Why does this matter?

Smaller components are easier to read and maintain. The keyboard shortcut logic in particular is complex enough (~50 lines) to deserve its own file.

Primary area

Renderer UI

samzong avatar Apr 01 '26 15:04 samzong

Hi @samzong, Thanks for opening an issue! We will look into it as soon as possible.

Details

Instructions for interacting with me using comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the gh-ci-bot repository.

github-actions[bot] avatar Apr 01 '26 15:04 github-actions[bot]

@samzong Hi! I'd like to work on this issue if it's still available.

I'll extract the keyboard shortcut logic into a useKeyboardShortcuts hook and move the settings loading logic into a useSettingsBootstrap hook, then update App.tsx to use both hooks.

Thanks!

alstondsouza1 avatar Jul 08 '26 23:07 alstondsouza1