feat(ui): add favorite-model cycling shortcuts (#592)

* feat(ui): add Alt+F / Alt+Shift+F keyboard shortcuts to cycle favorite models

Allows cycling forward/backward through starred models without opening
the model picker. Mirrors the cycle_thinking_variant pattern. Silent
no-op when no models are favorited.

* fix(ui): remap favorite model cycling to ctrl brackets

* chore(ui): update favorite-cycle shortcut comment
This commit is contained in:
Henry Moran
2026-03-04 02:02:51 +02:00
committed by GitHub
parent 79143bff4c
commit 84326e17cf
2 changed files with 57 additions and 0 deletions
@@ -290,6 +290,49 @@ export const useKeyboardShortcuts = () => {
return;
}
// Ctrl+] / Ctrl+[: Cycle through starred models (same gating as Shift+M)
if (
eventMatchesShortcut(e, combo('cycle_favorite_model_forward')) ||
eventMatchesShortcut(e, combo('cycle_favorite_model_backward'))
) {
const {
isSettingsDialogOpen,
isCommandPaletteOpen,
isHelpDialogOpen,
isSessionSwitcherOpen,
isAboutDialogOpen,
activeMainTab,
favoriteModels,
addRecentModel,
} = useUIStore.getState();
if (isSettingsDialogOpen) {
return;
}
const hasOverlay = isCommandPaletteOpen || isHelpDialogOpen || isSessionSwitcherOpen || isAboutDialogOpen;
const isChatActive = activeMainTab === 'chat';
if (hasOverlay || !isChatActive || favoriteModels.length === 0) {
return;
}
e.preventDefault();
const { currentProviderId, currentModelId, setProvider, setModel } = useConfigStore.getState();
const len = favoriteModels.length;
const currentIdx = favoriteModels.findIndex(
(f) => f.providerID === currentProviderId && f.modelID === currentModelId,
);
const delta = eventMatchesShortcut(e, combo('cycle_favorite_model_forward')) ? 1 : -1;
const next = favoriteModels[(currentIdx + delta + len) % len];
setProvider(next.providerID);
setModel(next.modelID);
addRecentModel(next.providerID, next.modelID);
return;
}
if (eventMatchesShortcut(e, combo('expand_input'))) {
if (isMobile) {
return;
+14
View File
@@ -291,6 +291,20 @@ const SHORTCUT_ACTIONS: ReadonlyArray<ShortcutAction> = [
label: 'Cycle thinking variant',
description: 'Cycle thinking variant while in chat',
},
{
id: 'cycle_favorite_model_forward',
defaultCombo: 'ctrl+]',
label: 'Cycle favorite model forward',
description: 'Cycle forward through starred models without opening the picker',
customizable: true,
},
{
id: 'cycle_favorite_model_backward',
defaultCombo: 'ctrl+[',
label: 'Cycle favorite model backward',
description: 'Cycle backward through starred models without opening the picker',
customizable: true,
},
{
id: 'expand_input',
defaultCombo: 'mod+shift+e',