Skip to content

πŸŽ₯ Make videos programmatically with React

`@remotion/studio`: Add keyboard shortcuts settings

JonnyBurgereda9ddf44f99
diff --git a/packages/studio/src/components/ConfigSelect.tsx b/packages/studio/src/components/ConfigSelect.tsx
new file mode 100644
index 0000000000..5825644959
--- /dev/null
+++ b/packages/studio/src/components/ConfigSelect.tsx
@@ -0,0 +1,76 @@
+import React from 'react';
+import {Checkmark} from '../icons/Checkmark';
+import type {ComboboxValue} from './NewComposition/ComboBox';
+import {Combobox} from './NewComposition/ComboBox';
+import {label, optionRow, rightRow} from './RenderModal/layout';
+
+const DEFAULT_VALUE = 'studio-default';
+
+const controlWidth: React.CSSProperties = {
+ boxSizing: 'border-box',
+ width: 180,
+};
+
+export const booleanOptions = [
+ {label: 'Enabled', value: true},
+ {label: 'Disabled', value: false},
+] as const;
+
+export const ConfigSelect = <T extends string | boolean>({
+ defaultLabel,
+ name,
+ onChange,
+ options,
+ value,
+}: {
+ readonly defaultLabel: string;
+ readonly name: string;
+ readonly onChange: (value: T | null) => void;
+ readonly options: readonly {label: string; value: T}[];
+ readonly value: T | null;
+}) => {
+ const values: ComboboxValue[] = [
+ {
+ id: DEFAULT_VALUE,
+ keyHint: null,
+ label: `Default (${defaultLabel})`,
+ leftItem: value === null ? <Checkmark /> : null,
+ onClick: () => onChange(null),
+ quickSwitcherLabel: null,
+ subMenu: null,
+ type: 'item',
+ value: DEFAULT_VALUE,
+ },
+ {id: `${DEFAULT_VALUE}-divider`, type: 'divider'},
+ ...options.map((option): ComboboxValue => {
+ const id = `${name}-${String(option.value)}`;
+ return {
+ id,
+ keyHint: null,
+ label: option.label,
+ leftItem: value === option.value ? <Checkmark /> : null,
+ onClick: () => onChange(option.value),
+ quickSwitcherLabel: null,
+ subMenu: null,
+ type: 'item',
+ value: id,
+ };
+ }),
+ ];
+
+ return (
+ <div style={optionRow}>
+ <div style={label}>{name}</div>
+ <div style={rightRow}>
+ <Combobox
+ values={values}
+ selectedId={
+ value === null ? DEFAULT_VALUE : `${name}-${String(value)}`
+ }
+ style={controlWidth}
+ title={name}
+ />
+ </div>
+ </div>
+ );
+};
diff --git a/packages/studio/src/components/GlobalKeybindings.tsx b/packages/studio/src/components/GlobalKeybindings.tsx
index c46199b6e3..19845603fa 100644
--- a/packages/studio/src/components/GlobalKeybindings.tsx
+++ b/packages/studio/src/components/GlobalKeybindings.tsx
@@ -203,11 +203,10 @@ export const GlobalKeybindings: React.FC = () => {
key: '?',
callback: () => {
setSelectedModal({
- type: 'quick-switcher',
- mode: 'docs',
- invocationTimestamp: Date.now(),
- assetSelection: null,
- compositionSelection: null,
+ type: 'settings',
+ initialTab: 'shortcuts',
+ initialPublicLicenseKey:
+ window.remotion_renderDefaults?.publicLicenseKey ?? null,
});
},
commandCtrlKey: false,
diff --git a/packages/studio/src/components/KeyboardShortcutsExplainer.tsx b/packages/studio/src/components/KeyboardShortcutsExplainer.tsx
deleted file mode 100644
index a87e7b9ad1..0000000000
--- a/packages/studio/src/components/KeyboardShortcutsExplainer.tsx
+++ /dev/null
@@ -1,440 +0,0 @@
-import React from 'react';
-import {cmdOrCtrlCharacter} from '../error-overlay/remotion-overlay/ShortcutHint';
-import {
- INPUT_BACKGROUND,
- BLACK_ALPHA_60,
- KEYBOARD_SHORTCUT_KEY_COLOR,
- WHITE,
- WHITE_ALPHA_10,
-} from '../helpers/colors';
-import {isMac} from '../helpers/is-mac';
-import {getStudioAskAIEnabled} from '../helpers/studio-runtime-config';
-import {areKeyboardShortcutsDisabled} from '../helpers/use-keybinding';
-import {ArrowLeft, ArrowRight, ShiftIcon} from '../icons/keys';
-import {Column, Row, Spacing} from './layout';
-
-const left: React.CSSProperties = {
- width: 85,
- paddingTop: 8,
- paddingBottom: 8,
-};
-
-const key: React.CSSProperties = {
- background: INPUT_BACKGROUND,
- padding: '3px 6px',
- color: WHITE,
- borderRadius: 3,
- border: '1px solid ' + BLACK_ALPHA_60,
- borderBottomWidth: 3,
- fontSize: 14,
- fontFamily: 'monospace',
-};
-
-const right: React.CSSProperties = {
- fontSize: 14,
- color: KEYBOARD_SHORTCUT_KEY_COLOR,
-};
-
-const container: React.CSSProperties = {
- paddingLeft: 20,
- paddingRight: 40,
- paddingTop: 10,
- paddingBottom: 10,
-};
-
-const title: React.CSSProperties = {
- fontWeight: 'bold',
- color: WHITE,
- fontSize: 14,
- marginBottom: 10,
-};
-
-const keyboardShortcutsDisabled: React.CSSProperties = {
- padding: 12,
- width: '100%',
- fontSize: 14,
- backgroundColor: WHITE_ALPHA_10,
-};
-
-const ul: React.CSSProperties = {
- marginTop: 0,
- marginBottom: 0,
-};
-
-const li: React.CSSProperties = {
- fontSize: 14,
-};
-
-export const KeyboardShortcutsExplainer: React.FC = () => {
- return (
- <div>
- {areKeyboardShortcutsDisabled() ? (
- <div style={keyboardShortcutsDisabled}>
- Keyboard shortcuts disabled either due to:
- <ul style={ul}>
- <li style={li}>a) --disable-keyboard-shortcuts being passed</li>
- <li style={li}>
- b) Config.setKeyboardShortcutsEnabled(false) being set or
- </li>
- <li style={li}> c) a Remotion version mismatch.</li>
- </ul>
- </div>
- ) : null}
- <Row style={container}>
- <Column>
- <div style={title}>Playback</div>
- <Row align="center">
- <div style={left}>
- <kbd style={key}>
- <ShiftIcon />
- </kbd>
- <Spacing x={0.3} />
- <kbd style={key}>
- <ArrowLeft />
- </kbd>
- </div>
- <div style={right}>1 second back</div>
- </Row>
- <Row align="center">
- <div style={left}>
- <kbd style={key}>
- <ArrowLeft />
- </kbd>
- </div>
- <div style={right}>Previous frame</div>
- </Row>
- <Row align="center">
- <div style={left}>
- <kbd style={key}>Space</kbd>
- </div>
- <div style={right}>Play / Pause</div>
- </Row>
- <Row align="center">
- <div style={left}>
- <kbd style={key}>
- <ArrowRight />
- </kbd>
- </div>
- <div style={right}>Next frame</div>
- </Row>
- <Row align="center">
- <div style={left}>
- <kbd style={key}>
- <ShiftIcon />
- </kbd>
- <Spacing x={0.3} />
- <kbd style={key}>
- <ArrowRight />
- </kbd>
- </div>
- <div style={right}>1 second forward</div>
- </Row>
- <Row align="center">
- <div style={left}>
- <kbd style={key}>A</kbd>
- </div>
- <div style={right}>Jump to beginning</div>
- </Row>
- <Row align="center">
- <div style={left}>
- <kbd style={key}>E</kbd>
- </div>
- <div style={right}>Jump to end</div>
- </Row>
- <Row align="center">
- <div style={left}>
- <kbd style={key}>J</kbd>
- </div>
- <div style={right}>Reverse playback</div>
- </Row>
- <Row align="center">
- <div style={left}>
- <kbd style={key}>K</kbd>
- </div>
- <div style={right}>Pause</div>
- </Row>
- <Row align="center">
- <div style={left}>
- <kbd style={key}>L</kbd>
- </div>
- <div style={right}>Play / Speed up</div>
- </Row>
- <Row align="center">
- <div style={left}>
- <kbd style={key}>G</kbd>
- </div>
- <div style={right}>Go to frame</div>
- </Row>
- <Row align="center">
- <div style={left}>
- <kbd style={key}>Enter</kbd>
- </div>
- <div style={right}>Pause & return to playback start</div>
- </Row>
- <br />
- <div style={title}>Sidebar</div>
- <Row align="center">
- <div style={left}>
- <kbd style={key}>{cmdOrCtrlCharacter}</kbd>
- <Spacing x={0.3} />
- <kbd style={key}>B</kbd>
- </div>
- <div style={right}>Toggle left sidebar</div>
- </Row>
- <Row align="center">
- <div style={left}>
- <kbd style={key}>{cmdOrCtrlCharacter}</kbd>
- <Spacing x={0.3} />
- <kbd style={key}>J</kbd>
- </div>
- <div style={right}>Toggle right sidebar</div>
- </Row>
- <Row align="center">
- <div style={left}>
- <kbd style={key}>{cmdOrCtrlCharacter}</kbd>
- <Spacing x={0.3} />
- <kbd style={key}>G</kbd>
- </div>
- <div style={right}>Toggle both sidebars</div>
- </Row>
- <br />
- <div style={title}>View</div>
- <Row align="center">
- <div style={left}>
- <kbd style={key}>F</kbd>
- </div>
- <div style={right}>Enter fullscreen</div>
- </Row>
- <Row align="center">
- <div style={left}>
- <kbd style={key}>Esc</kbd>
- </div>
- <div style={right}>Exit fullscreen</div>
- </Row>
- <Row align="center">
- <div style={left}>
- <kbd style={key}>
- <ShiftIcon />
- </kbd>
- <Spacing x={0.3} />
- <kbd style={key}>M</kbd>
- </div>
- <div style={right}>Enable snapping</div>
- </Row>
- </Column>
- <Spacing x={8} />
- <Column>
- <div style={title}>Navigation</div>
- <Row align="center">
- <div style={left}>
- <kbd style={key}>PageUp</kbd>
- </div>
- <div style={right}>Previous composition</div>
- </Row>
- <Row align="center">
- <div style={left}>
- <kbd style={key}>PageDown</kbd>
- </div>
- <div style={right}>Next composition</div>
- </Row>
- <Row align="center">
- <div style={left}>
- <kbd style={key}>R</kbd>
- </div>
- <div style={right}>
- Render, unless a sequence or prop is selected
- </div>
- </Row>
- <Row align="center">
- <div style={left}>
- <kbd style={key}>T</kbd>
- </div>
- <div style={right}>
- Checkerboard, unless a sequence or prop is selected
- </div>
- </Row>
- <Row align="center">
- <div style={left}>
- <kbd style={key}>?</kbd>
- </div>
- <div style={right}>Show keyboard shortcuts</div>
- </Row>
- <Row align="center">
- <div style={left}>
- <kbd style={key}>{cmdOrCtrlCharacter}</kbd>
- <Spacing x={0.3} />
- <kbd style={key}>K</kbd>
- </div>
- <div style={right}>Quick Switcher</div>
- </Row>
- <br />
- <div style={title}>Playback range</div>
- <Row align="center">
- <div style={left}>
- <kbd style={key}>I</kbd>
- </div>
- <div style={right}>Set In Point</div>
- </Row>
- <Row align="center">
- <div style={left}>
- <kbd style={key}>O</kbd>
- </div>
- <div style={right}>Set Out Point</div>
- </Row>
- <Row align="center">
- <div style={left}>
- <kbd style={key}>X</kbd>
- </div>
- <div style={right}>Clear In/Out Points</div>
- </Row>
- <br />
- <div style={title}>Zoom</div>
- <Row align="center">
- <div style={left}>
- <kbd style={key}>+</kbd>
- </div>
- <div style={right}>Zoom in</div>
- </Row>
- <Row align="center">
- <div style={left}>
- <kbd style={key}>-</kbd>
- </div>
- <div style={right}>Zoom out</div>
- </Row>
- <Row align="center">
- <div style={left}>
- <kbd style={key}>0</kbd>
- </div>
- <div style={right}>Reset zoom</div>
- </Row>{' '}
- <br />
- <div style={title}>Props Editor</div>
- <Row align="center">
- <div style={left}>
- <kbd style={key}>{cmdOrCtrlCharacter}</kbd>
- <Spacing x={0.3} />
- <kbd style={key}>Z</kbd>
- </div>
- <div style={right}>Undo</div>
- </Row>
- <Row align="center">
- <div style={left}>
- <kbd style={key}>{cmdOrCtrlCharacter}</kbd>
- <Spacing x={0.3} />
- {isMac ? (
- <>
- <kbd style={key}>Shift</kbd>
- <Spacing x={0.3} />
- <kbd style={key}>Z</kbd>
- </>
- ) : (
- <kbd style={key}>Y</kbd>
- )}
- </div>
- <div style={right}>Redo</div>
- </Row>
- <br />
- <div style={title}>Interactivity</div>
- <Row align="center">
- <div style={left}>
- <kbd style={key}>Shift</kbd>
- </div>
- <div style={right}>Select range / axis lock drag</div>
- </Row>
- <Row align="center">
- <div style={left}>
- <kbd style={key}>{cmdOrCtrlCharacter}</kbd>
- </div>
- <div style={right}>Toggle selection</div>
- </Row>
- <Row align="center">
- <div style={left}>
- <kbd style={key}>{cmdOrCtrlCharacter}</kbd>
- <Spacing x={0.3} />
- <kbd style={key}>A</kbd>
- </div>
- <div style={right}>Select sequence rows</div>
- </Row>
- <Row align="center">
- <div style={left}>
- <kbd style={key}>P</kbd>
- </div>
- <div style={right}>Select translate prop</div>
- </Row>
- <Row align="center">
- <div style={left}>
- <kbd style={key}>T</kbd>
- </div>
- <div style={right}>Select opacity prop</div>
- </Row>
- <Row align="center">
- <div style={left}>
- <kbd style={key}>R</kbd>
- </div>
- <div style={right}>Select rotate prop</div>
- </Row>
- <Row align="center">
- <div style={left}>
- <kbd style={key}>S</kbd>
- </div>
- <div style={right}>Select scale prop</div>
- </Row>
- <Row align="center">
- <div style={left}>
- <kbd style={key}>{cmdOrCtrlCharacter}</kbd>
- <Spacing x={0.3} />
- <kbd style={key}>D</kbd>
- </div>
- <div style={right}>Duplicate sequences</div>
- </Row>
- <Row align="center">
- <div style={left}>
- <kbd style={key}>{cmdOrCtrlCharacter}</kbd>
- <Spacing x={0.3} />
- <kbd style={key}>C</kbd>
- </div>
- <div style={right}>Copy effects / values</div>
- </Row>
- <Row align="center">
- <div style={left}>
- <kbd style={key}>{cmdOrCtrlCharacter}</kbd>
- <Spacing x={0.3} />
- <kbd style={key}>X</kbd>
- </div>
- <div style={right}>Cut effects</div>
- </Row>
- <Row align="center">
- <div style={left}>
- <kbd style={key}>{cmdOrCtrlCharacter}</kbd>
- <Spacing x={0.3} />
- <kbd style={key}>V</kbd>
- </div>
- <div style={right}>Paste effects / values</div>
- </Row>
- <Row align="center">
- <div style={left}>
- <kbd style={key}>Del</kbd>
- <Spacing x={0.3} />
- <kbd style={key}>⌫</kbd>
- </div>
- <div style={right}>Delete / reset selection</div>
- </Row>
- {getStudioAskAIEnabled() && (
- <>
- <br />
- <div style={title}>AI</div>
- <Row align="center">
- <div style={left}>
- <kbd style={key}>{cmdOrCtrlCharacter}</kbd>
- <Spacing x={0.3} />
- <kbd style={key}>I</kbd>
- </div>
- <div style={right}>Ask AI</div>
- </Row>
- </>
- )}
- </Column>
- </Row>
- </div>
- );
-};
diff --git a/packages/studio/src/components/KeyboardShortcutsSettings.tsx b/packages/studio/src/components/KeyboardShortcutsSettings.tsx
new file mode 100644
index 0000000000..27024fc0e8
--- /dev/null
+++ b/packages/studio/src/components/KeyboardShortcutsSettings.tsx
@@ -0,0 +1,214 @@
+import type {ConfigUpdate} from '@remotion/studio-shared';
+import React, {useCallback, useEffect, useMemo, useState} from 'react';
+import {
+ BLACK_ALPHA_60,
+ BORDER_WHITE_ALPHA_12,
+ INPUT_BACKGROUND,
+ LIGHT_TEXT,
+ WHITE,
+} from '../helpers/colors';
+import {getStudioAskAIEnabled} from '../helpers/studio-runtime-config';
+import {booleanOptions, ConfigSelect} from './ConfigSelect';
+import {sectionHeader} from './InspectorPanel/styles';
+import {
+ askAIKeyboardShortcutGroup,
+ keyboardShortcutGroups,
+} from './keyboard-shortcuts';
+import {Spacing} from './layout';
+import {ValidationMessage} from './NewComposition/ValidationMessage';
+import {useSettings} from './SettingsContext';
+import {useAutoSaveConfig} from './use-auto-save-config';
+
+const container: React.CSSProperties = {
+ alignSelf: 'flex-start',
+ display: 'flex',
+ flex: 1,
+ flexDirection: 'column',
+ minWidth: 0,
+};
+
+const dividerLabel: React.CSSProperties = {
+ ...sectionHeader,
+ margin: 0,
+ padding: '4px 16px',
+};
+
+const shortcutSectionTitle: React.CSSProperties = {
+ ...dividerLabel,
+ marginTop: 8,
+};
+
+const shortcutRow: React.CSSProperties = {
+ alignItems: 'center',
+ borderBottom: BORDER_WHITE_ALPHA_12,
+ display: 'flex',
+ gap: 16,
+ justifyContent: 'space-between',
+ margin: '0 16px',
+ minHeight: 38,
+};
+
+const lastShortcutRow: React.CSSProperties = {
+ ...shortcutRow,
+ borderBottom: 'none',
+};
+
+const actionName: React.CSSProperties = {
+ color: LIGHT_TEXT,
+ fontSize: 13,
+ lineHeight: 1.4,
+ minWidth: 0,
+};
+
+const chords: React.CSSProperties = {
+ alignItems: 'center',
+ display: 'flex',
+ flexShrink: 0,
+ gap: 6,
+};
+
+const chord: React.CSSProperties = {
+ alignItems: 'center',
+ display: 'flex',
+ gap: 4,
+};
+
+const key: React.CSSProperties = {
+ background: INPUT_BACKGROUND,
+ border: `1px solid ${BLACK_ALPHA_60}`,
+ borderBottomWidth: 2,
+ borderRadius: 3,
+ color: WHITE,
+ fontFamily: 'monospace',
+ fontSize: 12,
+ lineHeight: '18px',
+ minWidth: 18,
+ padding: '1px 5px',
+ textAlign: 'center',
+};
+
+const alternative: React.CSSProperties = {
+ color: LIGHT_TEXT,
+ fontSize: 11,
+};
+
+export const KeyboardShortcutsSettings: React.FC = () => {
+ const {error: settingsError, revision, studioRuntimeConfig} = useSettings();
+ const [enabled, setEnabled] = useState<boolean | null>(null);
+ const [edited, setEdited] = useState(false);
+ const [syncedRevision, setSyncedRevision] = useState(-1);
+ const [error, setError] = useState<string | null>(null);
+ const displayedShortcutGroups = getStudioAskAIEnabled()
+ ? [...keyboardShortcutGroups, askAIKeyboardShortcutGroup]
+ : keyboardShortcutGroups;
+
+ useEffect(() => {
+ if (studioRuntimeConfig === null) {
+ return;
+ }
+
+ setEnabled(
+ studioRuntimeConfig.configFileStudioSettings?.keyboardShortcutsEnabled ??
+ null,
+ );
+ setEdited(false);
+ setSyncedRevision(revision);
+ setError(null);
+ }, [revision, studioRuntimeConfig]);
+
+ const onEnabledChange = useCallback((value: boolean | null) => {
+ setEnabled(value);
+ setEdited(true);
+ }, []);
+
+ const updates = useMemo((): ConfigUpdate[] => {
+ if (!edited) {
+ return [];
+ }
+
+ return enabled === null
+ ? [{setter: 'setKeyboardShortcutsEnabled', type: 'delete'}]
+ : [
+ {
+ setter: 'setKeyboardShortcutsEnabled',
+ type: 'set',
+ value: enabled,
+ },
+ ];
+ }, [edited, enabled]);
+
+ const ready = studioRuntimeConfig !== null && syncedRevision === revision;
+ useAutoSaveConfig({
+ enabled: ready,
+ onError: setError,
+ ready,
+ syncRevision: syncedRevision,
+ updates,
+ });
+
+ if (studioRuntimeConfig === null) {
+ return null;
+ }
+
+ return (
+ <div style={container}>
+ <p style={dividerLabel}>General</p>
+ <ConfigSelect
+ defaultLabel="Enabled"
+ name="Keyboard shortcuts"
+ onChange={onEnabledChange}
+ options={booleanOptions}
+ value={enabled}
+ />
+ {displayedShortcutGroups.map((group, groupIndex) => (
+ <div key={group.name}>
+ <p style={shortcutSectionTitle}>{group.name}</p>
+ <div role="list" aria-label={group.name}>
+ {group.shortcuts.map((shortcut, shortcutIndex) => (
+ <div
+ key={shortcut.action}
+ role="listitem"
+ style={
+ groupIndex === displayedShortcutGroups.length - 1 &&
+ shortcutIndex === group.shortcuts.length - 1
+ ? lastShortcutRow
+ : shortcutRow
+ }
+ >
+ <span style={actionName}>{shortcut.action}</span>
+ <span style={chords}>
+ {shortcut.chords.map((keys, chordIndex) => (
+ <React.Fragment key={keys.join('-')}>
+ {chordIndex > 0 ? (
+ <span style={alternative}>or</span>
+ ) : null}
+ <span style={chord}>
+ {keys.map((keyboardKey) => (
+ <kbd key={keyboardKey} style={key}>
+ {keyboardKey}
+ </kbd>
+ ))}
+ </span>
+ </React.Fragment>
+ ))}
+ </span>
+ </div>
+ ))}
+ </div>
+ </div>
+ ))}
+ {(error ?? settingsError) ? (
+ <>
+ <Spacing y={1} block />
+ <div style={{paddingLeft: 16, paddingRight: 16}}>
+ <ValidationMessage
+ align="flex-start"
+ message={error ?? settingsError ?? ''}
+ type="error"
+ />
+ </div>
+ </>
+ ) : null}
+ </div>
+ );
+};
diff --git a/packages/studio/src/components/QuickSwitcher/QuickSwitcherContent.tsx b/packages/studio/src/components/QuickSwitcher/QuickSwitcherContent.tsx
index 87ae728f4a..4ef48b0cd3 100644
--- a/packages/studio/src/components/QuickSwitcher/QuickSwitcherContent.tsx
+++ b/packages/studio/src/components/QuickSwitcher/QuickSwitcherContent.tsx
@@ -20,14 +20,12 @@ import {
} from '../../helpers/use-menu-structure';
import {SetSelectedModalContext} from '../../state/modals';
import {useSelectComposition} from '../InitialCompositionLoader';
-import {KeyboardShortcutsExplainer} from '../KeyboardShortcutsExplainer';
import {Spacing} from '../layout';
import {VERTICAL_SCROLLBAR_CLASSNAME} from '../Menu/is-menu-item';
import {RemotionInput} from '../NewComposition/RemInput';
import {useSelectAsset} from '../use-select-asset';
import {useStaticFiles} from '../use-static-files';
import {algoliaSearch} from './algolia-search';
-import {AlgoliaCredit} from './AlgoliaCredit';
import {filterAssetsByType} from './asset-search';
import {fuzzySearch} from './fuzzy-search';
import type {QuickSwitcherMode} from './NoResults';
@@ -84,6 +82,16 @@ const contentWithoutModeSelector: React.CSSProperties = {
paddingTop: 16,
};
+const container: React.CSSProperties = {
+ width: 400,
+ maxWidth: 'calc(100vw - 40px)',
+};
+
+const results: React.CSSProperties = {
+ overflowY: 'auto',
+ height: 300,
+};
+
const stripQuery = (query: string) => {
if (query.startsWith('$') || query.startsWith('>') || query.startsWith('?')) {
return query.substring(1).trim();
@@ -229,8 +237,8 @@ export const QuickSwitcherContent: React.FC<{
return fuzzySearch(actualQuery, menuActions);
}
- if (mode === 'docs' && docResults.type === 'results') {
- return docResults.results;
+ if (mode === 'docs') {
+ return docResults.type === 'results' ? docResults.results : [];
}
if (mode === 'assets') {
@@ -452,9 +460,9 @@ export const QuickSwitcherContent: React.FC<{
inputRef.current?.focus();
}, []);
- const showKeyboardShortcuts = mode === 'docs' && actualQuery.trim() === '';
const showSearchLoadingState =
mode === 'docs' && docResults.type === 'loading';
+ const showEmptyDocSearch = mode === 'docs' && actualQuery.trim() === '';
const placeholder =
mode === 'assets'
? 'Search assets...'
@@ -464,27 +472,6 @@ export const QuickSwitcherContent: React.FC<{
? 'Search documentation...'
: 'Search compositions...';
- const container: React.CSSProperties = useMemo(() => {
- return {
- width: showKeyboardShortcuts ? 800 : 400,
- maxWidth: 'calc(100vw - 40px)',
- };
- }, [showKeyboardShortcuts]);
-
- const results: React.CSSProperties = useMemo(() => {
- if (showKeyboardShortcuts) {
- return {
- maxHeight: 600,
- overflowY: 'auto',
- };
- }
-
- return {
- overflowY: 'auto',
- height: 300,
- };
- }, [showKeyboardShortcuts]);
-
return (
<div style={container}>
{assetSelection === null && compositionSelection === null && (
@@ -540,16 +527,10 @@ export const QuickSwitcherContent: React.FC<{
placeholder={placeholder}
rightAlign={false}
/>
- {showKeyboardShortcuts ? (
- <>
- <Spacing x={2} /> <AlgoliaCredit />
- </>
- ) : null}
</div>
<div style={results} className={VERTICAL_SCROLLBAR_CLASSNAME}>
- {showKeyboardShortcuts ? (
- <KeyboardShortcutsExplainer />
- ) : showSearchLoadingState ? null : resultsArray.length === 0 ? (
+ {showEmptyDocSearch ||
+ showSearchLoadingState ? null : resultsArray.length === 0 ? (
<QuickSwitcherNoResults mode={mode} query={actualQuery} />
) : (
resultsArray.map((result, i) => {
diff --git a/packages/studio/src/components/RenderingSettings.tsx b/packages/studio/src/components/RenderingSettings.tsx
index 295bc4e5db..847aef68cb 100644
--- a/packages/studio/src/components/RenderingSettings.tsx
+++ b/packages/studio/src/components/RenderingSettings.tsx
@@ -21,7 +21,6 @@ import {CrfSetting} from './RenderModal/CrfSetting';
import {humanReadableCodec} from './RenderModal/human-readable-codec';
import {input, label, optionRow, rightRow} from './RenderModal/layout';
import {NumberSetting} from './RenderModal/NumberSetting';
-import {RenderModalHr} from './RenderModal/RenderModalHr';
import type {SegmentedControlItem} from './SegmentedControl';
import {SegmentedControl} from './SegmentedControl';
import {useSettings} from './SettingsContext';
@@ -40,6 +39,11 @@ const dividerLabel: React.CSSProperties = {
padding: '4px 16px',
};
+const sectionTitle: React.CSSProperties = {
+ ...dividerLabel,
+ marginTop: 8,
+};
+
const fullWidth: React.CSSProperties = {
boxSizing: 'border-box',
width: 180,
@@ -473,8 +477,7 @@ export const RenderingSettings: React.FC = () => {
/>
</div>
</div>
- <RenderModalHr />
- <p style={dividerLabel}>Encoding</p>
+ <p style={sectionTitle}>Encoding</p>
{BrowserSafeApis.codecSupportsCrf(resolvedCodec) &&
BrowserSafeApis.codecSupportsVideoBitrate(resolvedCodec) ? (
<div style={optionRow}>
@@ -536,8 +539,7 @@ export const RenderingSettings: React.FC = () => {
</div>
) : null}
- <RenderModalHr />
- <p style={dividerLabel}>Audio</p>
+ <p style={sectionTitle}>Audio</p>
<div style={optionRow}>
<div style={label}>Audio codec</div>
<div style={rightRow}>
@@ -548,8 +550,7 @@ export const RenderingSettings: React.FC = () => {
/>
</div>
</div>
- <RenderModalHr />
- <p style={dividerLabel}>Performance</p>
+ <p style={sectionTitle}>Performance</p>
<NumberSetting
name="Concurrency"
value={concurrency}
diff --git a/packages/studio/src/components/SettingsModal.tsx b/packages/studio/src/components/SettingsModal.tsx
index d574445465..2b60122af1 100644
--- a/packages/studio/src/components/SettingsModal.tsx
+++ b/packages/studio/src/components/SettingsModal.tsx
@@ -1,12 +1,14 @@
import React, {useCallback, useContext, useEffect, useState} from 'react';
import {AppsIcon} from '../icons/apps';
import {CertificateIcon} from '../icons/certificate';
+import {KeyboardIcon} from '../icons/keyboard';
import {RemotionTriangleIcon} from '../icons/remotion-triangle';
import {SkillsIcon} from '../icons/skills';
import {FilmIcon} from '../icons/video';
import {SetSelectedModalContext} from '../state/modals';
import {DefaultEditorSettings} from './ConfigureDefaultEditorModal';
import {LicenseSettings} from './ConfigureLicenseModal';
+import {KeyboardShortcutsSettings} from './KeyboardShortcutsSettings';
import {VERTICAL_SCROLLBAR_CLASSNAME} from './Menu/is-menu-item';
import {ModalHeader} from './ModalHeader';
import {DismissableModal} from './NewComposition/DismissableModal';
@@ -26,7 +28,13 @@ import {SkillsSettings} from './SkillsSettings';
import {StudioSettings} from './StudioSettings';
import {VerticalTab} from './Tabs/vertical';
-type SettingsTab = 'apps' | 'rendering' | 'studio' | 'skills' | 'license';
+type SettingsTab =
+ | 'apps'
+ | 'rendering'
+ | 'studio'
+ | 'shortcuts'
+ | 'skills'
+ | 'license';
const hiddenPanel: React.CSSProperties = {
display: 'none',
@@ -50,6 +58,12 @@ const appsIconContainer: React.CSSProperties = {
width: 20,
};
+const keyboardIcon: React.CSSProperties = {
+ ...icon,
+ height: 16,
+ width: 16,
+};
+
export const SettingsModal: React.FC<{
readonly initialTab: SettingsTab;
readonly initialPublicLicenseKey: string | null;
@@ -106,6 +120,18 @@ export const SettingsModal: React.FC<{
>
Studio
</VerticalTab>
+ <VerticalTab
+ style={horizontalTab}
+ selected={tab === 'shortcuts'}
+ onClick={() => selectTab('shortcuts')}
+ renderIcon={(color) => (
+ <div style={iconContainer}>
+ <KeyboardIcon color={color} style={keyboardIcon} />
+ </div>
+ )}
+ >
+ Shortcuts
+ </VerticalTab>
<VerticalTab
style={horizontalTab}
selected={tab === 'skills'}
@@ -167,6 +193,14 @@ export const SettingsModal: React.FC<{
<SkillsSettings />
</div>
) : null}
+ {openedTabs.includes('shortcuts') ? (
+ <div
+ style={tab === 'shortcuts' ? settingsOptionsPanel : hiddenPanel}
+ className={VERTICAL_SCROLLBAR_CLASSNAME}
+ >
+ <KeyboardShortcutsSettings />
+ </div>
+ ) : null}
{openedTabs.includes('rendering') ? (
<div
style={tab === 'rendering' ? settingsOptionsPanel : hiddenPanel}
diff --git a/packages/studio/src/components/StudioSettings.tsx b/packages/studio/src/components/StudioSettings.tsx
index 2c482ebecb..e9b2f29ea3 100644
--- a/packages/studio/src/components/StudioSettings.tsx
+++ b/packages/studio/src/components/StudioSettings.tsx
@@ -7,17 +7,14 @@ import type {
import {DEFAULT_TIMELINE_TRACKS} from '@remotion/studio-shared';
import React, {useCallback, useEffect, useMemo, useState} from 'react';
import {LIGHT_TEXT} from '../helpers/colors';
-import {Checkmark} from '../icons/Checkmark';
import {UndoIcon} from '../icons/undo';
import {Button} from './Button';
+import {booleanOptions, ConfigSelect} from './ConfigSelect';
import {sectionHeader} from './InspectorPanel/styles';
import {Spacing} from './layout';
-import type {ComboboxValue} from './NewComposition/ComboBox';
-import {Combobox} from './NewComposition/ComboBox';
import {InputDragger} from './NewComposition/InputDragger';
import {ValidationMessage} from './NewComposition/ValidationMessage';
import {label, optionRow, rightRow} from './RenderModal/layout';
-import {RenderModalHr} from './RenderModal/RenderModalHr';
import {useSettings} from './SettingsContext';
import {useAutoSaveConfig} from './use-auto-save-config';
@@ -34,9 +31,9 @@ const dividerLabel: React.CSSProperties = {
padding: '4px 16px',
};
-const controlWidth: React.CSSProperties = {
- boxSizing: 'border-box',
- width: 180,
+const sectionTitle: React.CSSProperties = {
+ ...dividerLabel,
+ marginTop: 8,
};
const resetIcon: React.CSSProperties = {
@@ -44,8 +41,6 @@ const resetIcon: React.CSSProperties = {
width: 12,
};
-const DEFAULT_VALUE = 'studio-default';
-
const initialSettings: ConfigFileStudioSettings = {
askAIEnabled: null,
audioLatencyHint: null,
@@ -59,65 +54,6 @@ const initialSettings: ConfigFileStudioSettings = {
rspack: null,
};
-const ConfigSelect = <T extends string | boolean>({
- defaultLabel,
- name,
- onChange,
- options,
- value,
-}: {
- readonly defaultLabel: string;
- readonly name: string;
- readonly onChange: (value: T | null) => void;
- readonly options: readonly {label: string; value: T}[];
- readonly value: T | null;
-}) => {
- const values: ComboboxValue[] = [
- {
- id: DEFAULT_VALUE,
- keyHint: null,
- label: `Default (${defaultLabel})`,
- leftItem: value === null ? <Checkmark /> : null,
- onClick: () => onChange(null),
- quickSwitcherLabel: null,
- subMenu: null,
- type: 'item',
- value: DEFAULT_VALUE,
- },
- {id: `${DEFAULT_VALUE}-divider`, type: 'divider'},
- ...options.map((option): ComboboxValue => {
- const id = `${name}-${String(option.value)}`;
- return {
- id,
- keyHint: null,
- label: option.label,
- leftItem: value === option.value ? <Checkmark /> : null,
- onClick: () => onChange(option.value),
- quickSwitcherLabel: null,
- subMenu: null,
- type: 'item',
- value: id,
- };
- }),
- ];
-
- return (
- <div style={optionRow}>
- <div style={label}>{name}</div>
- <div style={rightRow}>
- <Combobox
- values={values}
- selectedId={
- value === null ? DEFAULT_VALUE : `${name}-${String(value)}`
- }
- style={controlWidth}
- title={name}
- />
- </div>
- </div>
- );
-};
-
const ConfigNumber = ({
defaultLabel,
defaultValue,
@@ -169,11 +105,6 @@ const ConfigNumber = ({
);
};
-const booleanOptions = [
- {label: 'Enabled', value: true},
- {label: 'Disabled', value: false},
-] as const;
-
export const StudioSettings: React.FC = () => {
const {error: settingsError, revision, studioRuntimeConfig} = useSettings();
const [settings, setSettings] =
@@ -259,7 +190,6 @@ export const StudioSettings: React.FC = () => {
committedNumberSettings.numberOfSharedAudioTags,
),
update('setRspack', settings.rspack),
- update('setKeyboardShortcutsEnabled', settings.keyboardShortcutsEnabled),
update('setInteractivityEnabled', settings.interactivityEnabled),
update('setLogLevel', settings.logLevel),
].filter((item) => editedSetters.has(item.setter));
@@ -303,19 +233,6 @@ export const StudioSettings: React.FC = () => {
options={booleanOptions}
value={settings.askAIEnabled}
/>
- <ConfigSelect
- defaultLabel="Enabled"
- name="Keyboard shortcuts enabled"
- onChange={(value) =>
- changeSetting(
- 'keyboardShortcutsEnabled',
- 'setKeyboardShortcutsEnabled',
- value,
- )
- }
- options={booleanOptions}
- value={settings.keyboardShortcutsEnabled}
- />
<ConfigSelect
defaultLabel="Enabled"
name="Interactivity enabled"
@@ -344,8 +261,7 @@ export const StudioSettings: React.FC = () => {
value={settings.maxTimelineTracks}
/>
- <RenderModalHr />
- <p style={dividerLabel}>Audio</p>
+ <p style={sectionTitle}>Audio</p>
<ConfigSelect
defaultLabel="Playback"
name="Audio latency hint"
@@ -384,8 +300,7 @@ export const StudioSettings: React.FC = () => {
value={settings.beepOnFinish}
/>
- <RenderModalHr />
- <p style={dividerLabel}>Development</p>
+ <p style={sectionTitle}>Development</p>
<ConfigSelect
defaultLabel="Webpack"
name="Bundler"
diff --git a/packages/studio/src/components/keyboard-shortcuts.ts b/packages/studio/src/components/keyboard-shortcuts.ts
new file mode 100644
index 0000000000..96decd7ba4
--- /dev/null
+++ b/packages/studio/src/components/keyboard-shortcuts.ts
@@ -0,0 +1,144 @@
+import {cmdOrCtrlCharacter} from '../error-overlay/remotion-overlay/ShortcutHint';
+import {isMac} from '../helpers/is-mac';
+
+export type KeyboardShortcut = {
+ readonly action: string;
+ readonly chords: readonly (readonly string[])[];
+};
+
+export type KeyboardShortcutGroup = {
+ readonly name: string;
+ readonly shortcuts: readonly KeyboardShortcut[];
+};
+
+export const keyboardShortcutGroups: readonly KeyboardShortcutGroup[] = [
+ {
+ name: 'Playback',
+ shortcuts: [
+ {action: '1 second back', chords: [['Shift', '←']]},
+ {action: 'Previous frame', chords: [['←']]},
+ {action: 'Play / Pause', chords: [['Space']]},
+ {action: 'Next frame', chords: [['β†’']]},
+ {action: '1 second forward', chords: [['Shift', 'β†’']]},
+ {action: 'Jump to beginning', chords: [['A']]},
+ {action: 'Jump to end', chords: [['E']]},
+ {action: 'Reverse playback', chords: [['J']]},
+ {action: 'Pause', chords: [['K']]},
+ {action: 'Play / Speed up', chords: [['L']]},
+ {action: 'Go to frame', chords: [['G']]},
+ {
+ action: 'Pause & return to playback start',
+ chords: [['Enter']],
+ },
+ ],
+ },
+ {
+ name: 'Sidebar',
+ shortcuts: [
+ {
+ action: 'Toggle left sidebar',
+ chords: [[cmdOrCtrlCharacter, 'B']],
+ },
+ {
+ action: 'Toggle right sidebar',
+ chords: [[cmdOrCtrlCharacter, 'J']],
+ },
+ {
+ action: 'Toggle both sidebars',
+ chords: [[cmdOrCtrlCharacter, 'G']],
+ },
+ ],
+ },
+ {
+ name: 'View',
+ shortcuts: [
+ {action: 'Enter fullscreen', chords: [['F']]},
+ {action: 'Exit fullscreen', chords: [['Esc']]},
+ {action: 'Enable snapping', chords: [['Shift', 'M']]},
+ ],
+ },
+ {
+ name: 'Navigation',
+ shortcuts: [
+ {action: 'Previous composition', chords: [['PageUp']]},
+ {action: 'Next composition', chords: [['PageDown']]},
+ {
+ action: 'Render, unless a sequence or prop is selected',
+ chords: [['R']],
+ },
+ {
+ action: 'Checkerboard, unless a sequence or prop is selected',
+ chords: [['T']],
+ },
+ {action: 'Show keyboard shortcuts', chords: [['?']]},
+ {
+ action: 'Quick Switcher',
+ chords: [[cmdOrCtrlCharacter, 'K']],
+ },
+ ],
+ },
+ {
+ name: 'Playback range',
+ shortcuts: [
+ {action: 'Set In Point', chords: [['I']]},
+ {action: 'Set Out Point', chords: [['O']]},
+ {action: 'Clear In/Out Points', chords: [['X']]},
+ ],
+ },
+ {
+ name: 'Zoom',
+ shortcuts: [
+ {action: 'Zoom in', chords: [['+']]},
+ {action: 'Zoom out', chords: [['-']]},
+ {action: 'Reset zoom', chords: [['0']]},
+ ],
+ },
+ {
+ name: 'Props Editor',
+ shortcuts: [
+ {action: 'Undo', chords: [[cmdOrCtrlCharacter, 'Z']]},
+ {
+ action: 'Redo',
+ chords: [
+ isMac
+ ? [cmdOrCtrlCharacter, 'Shift', 'Z']
+ : [cmdOrCtrlCharacter, 'Y'],
+ ],
+ },
+ ],
+ },
+ {
+ name: 'Interactivity',
+ shortcuts: [
+ {action: 'Select range / axis lock drag', chords: [['Shift']]},
+ {action: 'Toggle selection', chords: [[cmdOrCtrlCharacter]]},
+ {
+ action: 'Select sequence rows',
+ chords: [[cmdOrCtrlCharacter, 'A']],
+ },
+ {action: 'Select translate prop', chords: [['P']]},
+ {action: 'Select opacity prop', chords: [['T']]},
+ {action: 'Select rotate prop', chords: [['R']]},
+ {action: 'Select scale prop', chords: [['S']]},
+ {
+ action: 'Duplicate sequences',
+ chords: [[cmdOrCtrlCharacter, 'D']],
+ },
+ {
+ action: 'Copy effects / values',
+ chords: [[cmdOrCtrlCharacter, 'C']],
+ },
+ {action: 'Cut effects', chords: [[cmdOrCtrlCharacter, 'X']]},
+ {
+ action: 'Paste effects / values',
+ chords: [[cmdOrCtrlCharacter, 'V']],
+ },
+ {action: 'Delete / reset selection', chords: [['Del'], ['⌫']]},
+ ],
+ },
+];
+
+export const askAIKeyboardShortcutGroup: KeyboardShortcutGroup = {
+ name: 'AI',
+ shortcuts: [{action: 'Ask AI', chords: [[cmdOrCtrlCharacter, 'I']]}],
+};
diff --git a/packages/studio/src/helpers/use-menu-structure.tsx b/packages/studio/src/helpers/use-menu-structure.tsx
index 0a22ac07e9..6e627a72d6 100644
--- a/packages/studio/src/helpers/use-menu-structure.tsx
+++ b/packages/studio/src/helpers/use-menu-structure.tsx
@@ -938,11 +938,10 @@ export const useMenuStructure = (
closeMenu();
setSelectedModal({
- type: 'quick-switcher',
- mode: 'docs',
- invocationTimestamp: Date.now(),
- assetSelection: null,
- compositionSelection: null,
+ type: 'settings',
+ initialTab: 'shortcuts',
+ initialPublicLicenseKey:
+ window.remotion_renderDefaults?.publicLicenseKey ?? null,
});
},
keyHint: '?',
diff --git a/packages/studio/src/icons/keyboard.tsx b/packages/studio/src/icons/keyboard.tsx
new file mode 100644
index 0000000000..44a7927267
--- /dev/null
+++ b/packages/studio/src/icons/keyboard.tsx
@@ -0,0 +1,16 @@
+import type {SVGProps} from 'react';
+
+// Font Awesome Pro v7.3.1, Copyright 2026 Fonticons, Inc.
+// https://fontawesome.com/license (Commercial License)
+export const KeyboardIcon: React.FC<
+ SVGProps<SVGSVGElement> & {readonly color: string}
+> = ({color, ...props}) => {
+ return (
+ <svg {...props} xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
+ <path
+ fill={color}
+ d="M96 192l64 0 0 128-64 0c-53 0-96 43-96 96s43 96 96 96 96-43 96-96l0-64 128 0 0 64c0 53 43 96 96 96s96-43 96-96-43-96-96-96l-64 0 0-128 64 0c53 0 96-43 96-96s-43-96-96-96-96 43-96 96l0 64-128 0 0-64c0-53-43-96-96-96S0 43 0 96 43 192 96 192zM256 320l-64 0 0-128 128 0 0 128-64 0zM96 160c-35.3 0-64-28.7-64-64s28.7-64 64-64 64 28.7 64 64l0 64-64 0zm64 256c0 35.3-28.7 64-64 64s-64-28.7-64-64 28.7-64 64-64l64 0 0 64zM352 160l0-64c0-35.3 28.7-64 64-64s64 28.7 64 64-28.7 64-64 64l-64 0zm64 192c35.3 0 64 28.7 64 64s-28.7 64-64 64-64-28.7-64-64l0-64 64 0z"
+ />
+ </svg>
+ );
+};
diff --git a/packages/studio/src/state/modals.ts b/packages/studio/src/state/modals.ts
index b8e2a4c9df..7855c67ce5 100644
--- a/packages/studio/src/state/modals.ts
+++ b/packages/studio/src/state/modals.ts
@@ -195,7 +195,7 @@ export type ModalState =
}
| {
type: 'settings';
- initialTab: 'apps' | 'rendering' | 'studio' | 'license';
+ initialTab: 'apps' | 'rendering' | 'studio' | 'shortcuts' | 'license';
initialPublicLicenseKey: string | null;
}
| RenderModalState