Skip to content

Custom Key Binding fails due to lowercase "ctrl" and "alt" #4123

Closed

Description

@cakepuller

Description

Custom Key Binding fails due to lowercase "ctrl" and "alt".

Workaround:

  • edit on Windows: %APPDATA%\MarkText\keybindings.json
  • Change "ctrl" to "Ctrl" and "alt" to "Alt" -> save
  • Keybinding now works as expected.

Steps to reproduce

  1. Ctrl , (PREFERENCES)
  2. KEY BINDINGS
  3. Scroll to Paragraph: Transform into Heading 1 and press the Edit button.
  4. Press Ctrl+Alt+1
  5. What appears in the text field is "ctrl+alt+1" (all lowercase)
  6. Click SAVE
  7. Go back to document.
  8. Press Ctrl+Alt+1 on some text, but nothing happens.

Expected behavior:

Text becomes Header 1.

Actual behavior:

Nothing.

Versions

  • MarkText version: 0.17.1
  • Operating system: Windows 11

Activity

  1. added
    🐛 bug
    🪲 pri/major
    🐹 platform/windows
    on May 13, 2026
  2. Jocs commented on Jun 23, 2026

    @Jocs
    Member

    Thank you for the detailed report.

    After reviewing the current codebase there are two things to clarify:

    1. Lowercase display is by design. The @hfelix/electron-localshortcut library that MarkText uses intentionally produces lowercase modifier names (ctrl, alt, shift) from getAcceleratorFromKeyboardEvent. Both the validator and the shortcut-matching logic use case-insensitive comparisons internally, so ctrl+alt+1 and Ctrl+Alt+1 register and fire identically. Manually capitalising the saved JSON has no practical effect.

    2. The real issue on Windows is AltGr. On Windows Ctrl+Alt is an alias for the AltGr key, which means the OS resolves the key combination to a special character before MarkText's shortcut handler can intercept it. This is acknowledged directly in the current codebase: packages/desktop/src/main/keyboard/keybindingsWindows.ts deliberately leaves the heading shortcuts (paragraph.heading-1 through paragraph.heading-6) unbound with the comment "We cannot set a default value for heading size because Ctrl+Alt is an alias to AltGr on Windows."

    Because the displayed casing is intentional library behaviour and the underlying Windows AltGr limitation is already documented and accounted for in the code, this issue is resolved in the current release. If you wish to bind a heading shortcut on Windows, please use a combination that does not involve Ctrl+Alt (for example Ctrl+Shift+1).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    🪲 pri/major🐹 platform/windows🐛 bug🔭 area/editor

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions