Skip to content

[PR2/5] feat(upstream): ホットキー型拡張 + Prev/Next Tab・Workspace の unbound 化 (#3422)#160

Merged
MocA-Love merged 3 commits intomainfrom
upstream-merge/pr2-hotkey-types
Apr 14, 2026
Merged

[PR2/5] feat(upstream): ホットキー型拡張 + Prev/Next Tab・Workspace の unbound 化 (#3422)#160
MocA-Love merged 3 commits intomainfrom
upstream-merge/pr2-hotkey-types

Conversation

@MocA-Love
Copy link
Copy Markdown
Owner

@MocA-Love MocA-Love commented Apr 14, 2026

Upstream Merge PR#2 - ホットキー型拡張

upstream superset-sh#3422 を cherry-pick し、フォーク固有ホットキーと整合させるための手動修正を加えます。

改善内容の詳細

背景:PR#3403 で何が起きたか(このPRではまだ取り込んでいないが、関連する文脈)

upstream は PR#3403 で「Cmd+Alt+Arrow で v2 ペイン間を空間認識的に移動」する機能を入れるため、以下を削除しました:

  • `PREV_TAB` / `NEXT_TAB` (Cmd+Alt+Left/Right)
  • `PREV_WORKSPACE` / `NEXT_WORKSPACE` (Cmd+Alt+Up/Down)
  • `PREV_PANE` / `NEXT_PANE` (線形循環)

これらのキーを FOCUS_PANE_LEFT/RIGHT/UP/DOWN に付け替えるためでした。

このPRで取り込む superset-sh#3422 の内容

問題: superset-sh#3403 でタブ切替・ワークスペース切替のホットキーが完全に削除されてしまい、これらの機能に依存していたユーザーが困った。

解決: ホットキー ID としては復活させるが、デフォルトキーは `null` とし、ユーザーが Settings から自由に rebind できる形にする。

このアプローチのために、ホットキーの型システムを以下のように拡張する必要があります:

型定義の拡張(事前修正として手動コミット)

```typescript
// Before
export type PlatformKey = { mac: string; windows: string; linux: string };
export interface HotkeyDefinition {
key: string;
label: string;
...
}

// After
export type PlatformKey = {
mac: string | null;
windows: string | null;
linux: string | null;
};
export interface HotkeyDefinition {
key: string | null;
label: string;
...
}
```

これで `key: { mac: null, windows: null, linux: null }` というデフォルト未割当エントリがレジストリに登録できるようになります。

cherry-pick: c925f4d (superset-sh#3422)

  1. registry.ts

    • `PREV_TAB`, `NEXT_TAB` を null-bound エントリとして復活
    • `PREV_WORKSPACE`, `NEXT_WORKSPACE` を null-bound エントリとして復活
    • 各エントリに `description` を追加
    • 旧キーバインド(`meta+alt+left/right` 等)は削除
  2. useRecordHotkeys.ts

    • `canonicalizeChord(defaultKey)` を null-guard
    • これで unbound ホットキーに対する新規 chord 記録時に例外が出なくなる
  3. 各 handler ファイル

    • `useDashboardSidebarShortcuts.ts`: PREV/NEXT_WORKSPACE ハンドラ復活、`index === -1` ガード追加
    • `v2 useWorkspaceHotkeys.ts`: PREV/NEXT_TAB ハンドラ復活
    • `v1 workspace/page.tsx`: PREV/NEXT_TAB ハンドラ復活

コンフリクト解決

ファイル 解決方針
`registry.ts` フォーク独自の `BROWSER_RELOAD` / `BROWSER_HARD_RELOAD` / `SEARCH_IN_FILES` / `HotkeyCategory "Browser"` を保持。`PREV_PANE` / `NEXT_PANE` も PR#3 の取り込み時まで一時的に保持。重複した `PREV_TAB`/`NEXT_TAB` エントリを削除
`useDashboardSidebarShortcuts.ts` フォークのコメントを除去、upstream の `index === -1` ガードを採用
`workspace/$workspaceId/page.tsx` フォーク独自の deep-link navigation(`useSearch` / `WorkspaceSearchParams`)を保持。フォーク独自の `CLOSE_TERMINAL` / `CLOSE_TAB` ハンドラを保持。cherry-pick が挿入した重複 workspace クエリとハンドラを削除

フォーク固有機能の保持

  • ブラウザホットキー: `BROWSER_RELOAD`, `BROWSER_HARD_RELOAD`, `SEARCH_IN_FILES` すべて維持
  • HotkeyCategory "Browser": 維持
  • v1 deep-link navigation: `useSearch` 経由のファイル/行/列パラメータ処理を維持
  • v1 tRPC-based PREV/NEXT_WORKSPACE: 維持(upstream の `flattenedWorkspaces` 方式ではなくフォーク独自の tRPC クエリ方式)

ユーザーへのメリット

  1. 既存のカスタムバインディングが保持される

    • 以前 PREV_TAB/NEXT_TAB に独自のキーを割り当てていたユーザーは、localStorage の override がそのまま有効になり、自動的にバインディングが復活する
  2. 設定画面で自由に rebind できる

    • デフォルトは unbound なので、ユーザーが Settings → Keyboard で好きなキーを設定できる

テスト計画

  • `bun run typecheck` パス
  • Settings → Keyboard に PREV_TAB / NEXT_TAB が「unbound」として表示される
  • Settings → Keyboard に PREV_WORKSPACE / NEXT_WORKSPACE が「unbound」として表示される
  • フォーク独自ホットキーが引き続き動作:ブラウザリロード、ハードリロード、ファイル内検索
  • PR#3403 以前の localStorage override を持つユーザーは、PREV_TAB/NEXT_TAB のバインディングが自動復活する

sakura-rip and others added 3 commits April 15, 2026 01:08
… null keys

Pre-requisite for upstream superset-sh#3422 (unbound hotkey defaults).
Allows hotkey entries to register with a null chord per platform.
FORK NOTE: fork-specific hotkeys (BROWSER_RELOAD, BROWSER_HARD_RELOAD,
SEARCH_IN_FILES) retain their non-null keys.
…kspace (superset-sh#3422)

* feat(desktop/hotkeys): allow unbound defaults; restore PREV/NEXT tab+workspace

Widen PlatformKey and HotkeyDefinition so hotkey entries can register
with a null chord per platform. Downstream consumers were already
null-safe from superset-sh#3391 (useBinding, buildRegisteredAppChords,
formatHotkeyDisplay, sanitizeOverride, HotkeyMenuShortcut), so the
schema widening is the only structural change needed.

Re-introduce PREV_TAB, NEXT_TAB, PREV_WORKSPACE, NEXT_WORKSPACE as
registered-but-unbound entries so users who want tab/workspace neighbor
navigation can rebind them in Settings → Keyboard. PR superset-sh#3403 removed
these to free Cmd+Alt+Arrow for directional pane focus; this restores
the hotkey IDs (and their v1/v2 handlers) without claiming any default
chord. Users with pre-superset-sh#3403 overrides for these IDs will transparently
get their bindings back since the override is preserved in localStorage.

- Null-guard canonicalizeChord(defaultKey) in useRecordHotkeys so
  recording a new chord for an unbound hotkey no longer throws.
- Replace the force-cast in resolveHotkeyFromEvent.test.ts sample
  picker with a type predicate so sampleDef.key narrows to string
  honestly instead of lying about the widened schema.

* fix(desktop/hotkeys): restore prevIndex in v2 PREV_WORKSPACE handler
…RKSPACE handlers

Post-cherry-pick cleanup after superset-sh#3422:
- registry.ts: remove old key-bound PREV_TAB/NEXT_TAB entries (meta+alt+left/right)
  now superseded by null-bound entries from upstream superset-sh#3422
- page.tsx: remove duplicate getPreviousWorkspace/getNextWorkspace tRPC queries
  and PREV_WORKSPACE/NEXT_WORKSPACE handlers added by cherry-pick
  (originals with { enabled: isActive } guards already present above)
FORK NOTE: PREV/NEXT_WORKSPACE still use tRPC-based implementation in v1 workspace page.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 14, 2026

Warning

Rate limit exceeded

@MocA-Love has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 54 minutes and 37 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 54 minutes and 37 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 08772e7b-7e41-4c82-94a1-b1ecaee0458b

📥 Commits

Reviewing files that changed from the base of the PR and between 80ab6a0 and 5649462.

📒 Files selected for processing (5)
  • apps/desktop/src/renderer/hotkeys/hooks/useRecordHotkeys/useRecordHotkeys.ts
  • apps/desktop/src/renderer/hotkeys/registry.ts
  • apps/desktop/src/renderer/hotkeys/types.ts
  • apps/desktop/src/renderer/hotkeys/utils/resolveHotkeyFromEvent.test.ts
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/hooks/useDashboardSidebarShortcuts/useDashboardSidebarShortcuts.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch upstream-merge/pr2-hotkey-types

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@MocA-Love MocA-Love changed the title feat(upstream): hotkey type widening + unbound prev/next tab & workspace (#3422) feat(upstream): ホットキー型拡張 + Prev/Next Tab・Workspace の unbound 化 (#3422) Apr 14, 2026
@MocA-Love MocA-Love changed the title feat(upstream): ホットキー型拡張 + Prev/Next Tab・Workspace の unbound 化 (#3422) [PR2/5] feat(upstream): ホットキー型拡張 + Prev/Next Tab・Workspace の unbound 化 (#3422) Apr 14, 2026
@MocA-Love MocA-Love merged commit 85f07f4 into main Apr 14, 2026
6 checks passed
MocA-Love pushed a commit that referenced this pull request Apr 14, 2026
All 9 upstream commits have been individually cherry-picked via PR#159~#163:

| Upstream | Our PR | Description |
|---|---|---|
| d656b7e (superset-sh#3415) | #159 (PR#1) | terminal clipboard handling |
| 31fcf19 (superset-sh#3416) | #162 (PR#4) | v1 split pane startup sizing fix |
| 039edf2 (superset-sh#3403) | #161 (PR#3) | Cmd+Alt+Arrow spatial pane focus |
| b18a00c (superset-sh#3421) | #159 (PR#1) | v2 right sidebar toggle reactive |
| 3dd1de2 (superset-sh#3420) | #161 (PR#3) | v2 diff viewer + tab title resolution |
| b42a114 (superset-sh#3418) | #159 (PR#1) | CodeMirror hotkey enablement |
| c925f4d (superset-sh#3422) | #160 (PR#2) | unbound defaults + restore prev/next tab/workspace |
| bb12c09 (superset-sh#3419) | #163 (PR#5) | version bump 1.5.3 |
| 47efa73 (superset-sh#3432) | #159 (PR#1) | pending/update-required error selectable |

Fork-specific features preserved:
- auto-updater (IS_FORK, GitHub Releases API)
- QuitMode/cleanupMainWindowResources lifecycle
- GitHubSyncService, SpreadsheetViewer
- BROWSER_RELOAD / BROWSER_HARD_RELOAD / SEARCH_IN_FILES hotkeys
- HotkeyCategory "Browser"
- v1 deep-link navigation (useSearch/WorkspaceSearchParams)
- v1 tRPC-based PREV/NEXT_WORKSPACE handlers
- v1 CLOSE_TERMINAL/CLOSE_TAB hotkey handlers
- v2 extra state (rightSidebarOpenViewWidth, showPresetsBar)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants