Hotkeys | InvokeAI Documentation

Hotkeys

InvokeAI allows you to customize all keyboard shortcuts (hotkeys) to match your workflow preferences. This guide covers how to use and customize hotkeys as a user, as well as providing technical documentation for developers.

User Guide

View All Hotkeys

See all available keyboard shortcuts organized by category in one place.

Customize Any Hotkey

Change any shortcut to your preference, or assign multiple key combinations to the same action.

Smart Validation

Built-in validation prevents invalid combinations.

Persistent Settings

Your custom hotkeys are safely stored and restored across sessions.

Opening the Hotkeys Modal

Press Shift + ? or click the keyboard icon in the application to open the Hotkeys Modal.

Managing Hotkeys

  1. Click the pencil button by the hotkey you want to change, or click the plus button to add a new one.
  2. Enter your new hotkey combination in the editor.
    • Use modifier buttons for quick-insert ( Mod, Ctrl, Shift, Alt).
    • Check the live preview to see how your hotkey will look.
  3. Click the checkmark or press Enter to save.

Hotkey Format Reference

When customizing hotkeys, use the following formats:


Developer Guide

The hotkeys system allows developers to centrally define, manage, and validate hotkeys throughout the application. It is built on top of react-hotkeys-hook.

Architecture

The customizable hotkeys feature comprises the following components:

Adding New Hotkeys

To add a new hotkey to the system, follow these steps:

  1. Add Translation Strings
    In invokeai/frontend/web/public/locales/en.json:

    {
        "hotkeys": {
            "app": {
                "myAction": {
                    "title": "My Action",
                    "desc": "Description of what this hotkey does"
                }
            }
        }
    }
    
  2. Register the Hotkey
    In invokeai/frontend/web/src/features/system/components/HotkeysModal/useHotkeyData.ts:

    addHotkey('app', 'myAction', ['mod+k']); // Default binding
    
  3. Use the Hotkey in Components

    import { useRegisteredHotkeys } from 'features/system/components/HotkeysModal/useHotkeyData';
    
    const MyComponent = () => {
        const handleAction = useCallback(() => {
            // Your action here
        }, []);
        useRegisteredHotkeys({
            id: 'myAction',
            category: 'app',
            callback: handleAction,
            options: { enabled: true, preventDefault: true },
            dependencies: [handleAction]
        });
        // ...
    };
    

Common Patterns