feat: floating workspace shortcuts and tab shortcut affordances (#6077)

* feat: add floating workspace shortcuts

* test: shim localStorage in happy-dom tests

* refactor: tighten floating shortcut tests and docs

- Drop unrelated localStorage test shim (local Node 25 only; CI runs Node 24)
- Add why-comments for minify/minimize macOS-only and unbound defaults
- Assert minify bounds via getMinifiedFloatingTerminalBounds() not magic numbers
- Cover out-of-range tab index and no-active-tab rename edge cases

* test: cover custom floating shortcut bindings on Linux/Windows

Proves user-assigned overrides for floatingWorkspace.maximize/minify fire
on platforms where the default bindings are intentionally empty.

* feat: show keybinding hints in floating panel control tooltips

Maximize/restore and minimize tooltips now surface their live shortcut as
"Label (shortcut)", matching the repo convention (e.g. ReviewPRViewAnimatedVisual).
Degrades to a bare label when the action is unbound (Win/Linux defaults,
and minimize on every platform).

* feat: rework floating panel resize shortcut to Cmd+Opt+Shift+A

- Move maximize/restore default from Cmd+Opt+Up to Cmd+Opt+Shift+A so it
  shares the Cmd+Opt+A toggle anchor and stays one-handed.
- Open-into-maximized: pressing the chord while the panel is closed opens
  it straight into the maximized state (one-shot intent bridges the
  closed->mounted gap), regardless of last saved size. While open it
  remains a maximize<->restore toggle returning to saved dimensions.
- Drop the minify action and its Cmd+Opt+Down default entirely; it was
  introduced earlier in this PR and is not in main, so this trims unshipped
  surface rather than removing an existing feature.

Maximize tooltip now surfaces the new chord. Adds panel tests for the
open-maximized intent and updates keybinding default tests.

* feat: surface tab shortcut affordances

* refactor: address 5.5 Pro review on tab shortcut affordances

- Add Darwin Option-composed (Cmd+Opt+Shift+A) maximize capture/round-trip regression
- Replace 'Unassigned' string-sentinel checks with useOptionalShortcutLabel (string | null)
- Add TTL guard + unit tests so a stale open-maximized intent cannot leak into a later open

* feat: show default agent shortcut in new tab menu

* fix: address PR review on tab tooltip a11y, i18n, and test guards

* Fix floating workspace shortcut edge cases

Co-authored-by: Orca <help@stably.ai>

---------

Co-authored-by: Wolfgang Schoenberger <221313372+wolfiesch@users.noreply.github.com>
Co-authored-by: Jinwoo-H <jinwoo0825@gmail.com>
Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
Wolfie
2026-06-23 13:37:17 -07:00
committed by GitHub
co-authored by Orca Wolfgang Schoenberger Jinwoo-H
parent eb650d6cb8
commit 7c5e8a7f30
27 changed files with 1313 additions and 141 deletions
+102
View File
@@ -21,6 +21,7 @@ import {
normalizeKeybindingListForAction,
normalizeKeybindingList
} from './keybindings'
import type { KeybindingActionId, KeybindingPlatform } from './keybindings'
import { ALL_TUI_AGENTS } from './tui-agent-display-names'
describe('keybindings', () => {
@@ -250,6 +251,22 @@ describe('keybindings', () => {
'linux'
)
).toBe(false)
expect(
keybindingMatchesAction(
'tab.rename',
{
key: 'r',
code: 'KeyR',
meta: true,
control: false,
alt: false,
shift: false
},
'darwin',
undefined,
{ context: 'terminal', terminalShortcutPolicy: 'terminal-first' }
)
).toBe(false)
// Why: tab.rename (Mod+R) intentionally shares its binding with
// browser.reload, but the two live in different scopes (tabs vs browser),
@@ -439,6 +456,65 @@ describe('keybindings', () => {
)
})
it('defines floating workspace panel action metadata', () => {
const actionIds = [
'floatingWorkspace.maximize' as KeybindingActionId,
'floatingWorkspace.minimize' as KeybindingActionId
] as const
for (const actionId of actionIds) {
expect(getKeybindingDefinition(actionId), actionId).toMatchObject({ id: actionId })
}
})
it('assigns the floating workspace maximize default only on macOS', () => {
const maximizeAction = 'floatingWorkspace.maximize' as KeybindingActionId
expect(getEffectiveKeybindingsForAction(maximizeAction, 'darwin')).toEqual(['Mod+Alt+Shift+A'])
expect(getEffectiveKeybindingsForAction(maximizeAction, 'linux')).toEqual([])
expect(getEffectiveKeybindingsForAction(maximizeAction, 'win32')).toEqual([])
})
it('captures and round-trips the macOS Option-composed maximize chord', () => {
const maximizeAction = 'floatingWorkspace.maximize' as KeybindingActionId
// Why: macOS Option+A composes to a glyph (å), so capture must resolve the
// chord through the physical-code fallback rather than the composed key,
// matching the matcher so a user override round-trips to the same binding.
const macComposedMaximize = {
key: 'å',
code: 'KeyA',
meta: true,
control: false,
alt: true,
shift: true
}
expect(keybindingFromInput(macComposedMaximize, 'darwin')).toEqual({
ok: true,
value: 'Mod+Alt+Shift+A'
})
expect(keybindingMatchesAction(maximizeAction, macComposedMaximize, 'darwin')).toBe(true)
// The captured override formats back to the same effective shortcut.
expect(
getEffectiveKeybindingsForAction(maximizeAction, 'darwin', {
[maximizeAction]: ['Mod+Alt+Shift+A']
})
).toEqual(['Mod+Alt+Shift+A'])
expect(formatKeybindingList(['Mod+Alt+Shift+A'], 'darwin')).toBe('⌘⌥⇧A')
})
it('leaves floating workspace minimize unassigned because floating terminal toggle owns show and hide', () => {
const platforms: readonly KeybindingPlatform[] = ['darwin', 'linux', 'win32']
const minimizeAction = 'floatingWorkspace.minimize' as KeybindingActionId
for (const platform of platforms) {
expect(getEffectiveKeybindingsForAction(minimizeAction, platform)).toEqual([])
}
expect(getEffectiveKeybindingsForAction('floatingTerminal.toggle', 'darwin')).toEqual([
'Mod+Alt+A'
])
})
it('defines a macOS-only default for the new agent tab shortcut', () => {
expect(getEffectiveKeybindingsForAction('tab.newAgent', 'darwin')).toEqual(['Mod+Alt+T'])
expect(getEffectiveKeybindingsForAction('tab.newAgent', 'linux')).toEqual([])
@@ -533,6 +609,32 @@ describe('keybindings', () => {
).toBe(true)
})
it('keeps floating workspace tab shortcuts active in app focus even with terminal-first policy configured', () => {
const panelFocus = {
context: 'app',
terminalShortcutPolicy: 'terminal-first'
} as const
expect(
keybindingMatchesAction(
'tab.rename',
{ key: 'r', code: 'KeyR', meta: true, control: false, alt: false, shift: false },
'darwin',
undefined,
panelFocus
)
).toBe(true)
expect(
matchKeybindingDigitIndex(
'tab.selectByIndex',
{ key: '4', code: 'Digit4', meta: false, control: false, alt: true, shift: false },
'linux',
undefined,
panelFocus
)
).toBe(3)
})
it('keeps terminal-allowed app shortcuts active in terminal-first mode', () => {
const deleteBinding = {
key: 'Backspace',
+53
View File
@@ -50,6 +50,8 @@ export type KeybindingActionId =
| 'sidebar.ports.toggle'
| 'sidebar.focusWorktreeList'
| 'floatingTerminal.toggle'
| 'floatingWorkspace.maximize'
| 'floatingWorkspace.minimize'
| 'zoom.in'
| 'zoom.out'
| 'zoom.reset'
@@ -408,6 +410,57 @@ export const KEYBINDING_DEFINITIONS: readonly KeybindingDefinition[] = [
defaultBindings: platformBindings(['Mod+Alt+A']),
allowInTerminal: true
},
{
id: 'floatingWorkspace.maximize',
title: 'Maximize Floating Workspace Panel',
group: 'Global',
scope: 'global',
searchKeywords: [
'shortcut',
'floating',
'workspace',
'panel',
'floating workspace',
'workspace panel',
'maximize',
'expand'
],
// Why: pairs with the floatingTerminal.toggle chord (Cmd+Opt+A) so
// maximize/restore lives on the same key anchor and stays one-handed,
// instead of the two-hand reach to Cmd+Opt+ArrowUp. macOS-only default;
// Linux/Windows stay unbound for users to assign.
defaultBindings: {
darwin: ['Mod+Alt+Shift+A'],
linux: [],
win32: []
},
allowInTerminal: true
},
{
id: 'floatingWorkspace.minimize',
title: 'Minimize Floating Workspace Panel',
group: 'Global',
scope: 'global',
searchKeywords: [
'shortcut',
'floating',
'workspace',
'panel',
'floating workspace',
'workspace panel',
'minimize',
'hide'
],
// Why: intentionally unbound on every platform. floatingTerminal.toggle
// already owns the default show/hide chord; this action exists only so
// users can bind an explicit "hide the focused panel" shortcut in Settings.
defaultBindings: {
darwin: [],
linux: [],
win32: []
},
allowInTerminal: true
},
{
id: 'zoom.in',
title: 'Zoom In',