Skip to content

Implement Customizable Keyboard Shortcuts #29

@MathisVerstrepen

Description

@MathisVerstrepen

This feature aims to significantly improve user efficiency and interaction speed by introducing a robust system for keyboard shortcuts. Users will be able to perform common application actions more quickly without relying on mouse clicks, catering to power users and enhancing overall accessibility. The system will include a set of default shortcuts, along with a dedicated UI for users to customize and manage them.

1. Core Functionality

  • Pre-defined Default Shortcuts: A carefully selected set of intuitive default shortcuts will be provided for high-frequency actions across the application. These defaults should align with common operating system and application conventions where possible.
  • User Customization: Users will have the ability to:
    • Remap any pre-defined shortcut to a different key combination.
    • Disable specific shortcuts if they conflict with their workflow or other applications.
    • Reset all shortcuts to their default values.

2. Key Areas for Shortcut Implementation (Examples)

The following actions (and potentially others identified during development) should be considered for default keyboard shortcuts:

  • Global / Application-wide:
    • New Chat / Canvas: Ctrl/Cmd + N
    • Open Settings: Ctrl/Cmd + ,
    • Search (when implemented): Ctrl/Cmd + K
    • Open Keyboard Shortcut Cheat Sheet (see section 5): ? or F1
  • Chat View Specific:
    • Send Message: Enter (if input is single-line), Ctrl/Cmd + Enter (if input is multi-line)
    • New Line in Input: Shift + Enter (if Enter sends message)
    • Focus Message Input: Ctrl/Cmd + /
    • Navigate Chat History (select previous/next message for editing/copying): Ctrl/Cmd + Up Arrow / Ctrl/Cmd + Down Arrow
    • Copy Last AI Response: Ctrl/Cmd + Alt + C
  • Canvas View Specific:
    • Create New Node: Ctrl/Cmd + N (if not global new chat, otherwise C for "Create")
    • Delete Selected Node(s): Delete / Backspace
    • Duplicate Selected Node(s): Ctrl/Cmd + D
    • Zoom In / Out: Ctrl/Cmd + Plus / Ctrl/Cmd + Minus
    • Fit View to Content: Ctrl/Cmd + 0
    • Select All Nodes: Ctrl/Cmd + A
  • Sidebar / UI Toggles:
    • Toggle Properties (Right) Sidebar Visibility: Ctrl/Cmd + P

3. Customization Mechanism

A dedicated user interface will be implemented within the application settings for managing shortcuts:

  • Settings Location: A new section titled "Keyboard Shortcuts" will be added under the main application settings.
  • Customization UI:
    • A clear, scrollable list of all available actions, each with its current assigned shortcut displayed.
    • Each shortcut display will be an editable field.
    • Input Capture: When a user clicks on a shortcut field to edit, the system should enter a "listening" mode, capturing the next key combination pressed by the user (e.g., Ctrl + Shift + S). This prevents manual typing of key names.
    • Modifier Key Handling: The UI should intelligently display the correct modifier key (Ctrl for Windows/Linux, Cmd for macOS) based on the user's operating system.
  • Conflict Detection & Resolution:
    • Action Collision: If a user tries to assign a shortcut that is already assigned to another action, the system must warn the user. Options should be presented: "Assign anyway (unassign from original action)" or "Cancel."
    • System/Browser Conflicts: While difficult to fully prevent, the system should ideally warn users if they attempt to assign a shortcut that is commonly used by the browser or operating system (e.g., Ctrl/Cmd + T for new tab).
  • Reset to Defaults: A prominent button will allow users to revert all customized shortcuts back to their original pre-defined values.
  • Persistence: All custom shortcut assignments must be saved persistently and loaded correctly upon application startup.

4. Technical Considerations

  • Event Handling:
    • Implement a robust, centralized key event listener (e.g., keydown events on document).
  • Scope & Context:
    • Shortcuts should generally only trigger when relevant to the currently focused UI element or view (e.g., Canvas-specific shortcuts active only when Canvas is focused).
    • Shortcuts should not trigger when the user is actively typing in a standard text input field, unless the shortcut is specifically designed for input manipulation (e.g., Shift + Enter for new line).
  • Platform Compatibility: Ensure modifier key handling (Ctrl vs. Cmd) is correct and seamless across Windows, macOS, and Linux.
  • Displaying Shortcuts in UI:
    • Consider adding subtle keyboard shortcut hints to tooltips for buttons and menu items where applicable (e.g., "New Chat (Ctrl+N)").
    • Keyboard Shortcut Cheat Sheet: Implement a modal pop-up that can be opened with a dedicated shortcut (e.g., ? or F1) to display a comprehensive list of all active shortcuts. This sheet should update dynamically with user customizations.
  • Performance: The key event listener should be efficient and not introduce noticeable latency.

Metadata

Metadata

Labels

enhancementImproving existing features or functionality, without adding entirely new capabilities.

Projects

Status

Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions