Two different keys record as the same shortcut when a layout puts punctuation on a letter key

未关闭
#35,787 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
typescript
领域
desktop

调研方向

Start in packages/shared/src/keybindingMatching.ts, where shortcutKeyFromEvent chooses between event.key and event.code via EVENT_CODE_SHORTCUT_KEYS, and where recordedLayoutShortcutKey and resolveEventKeys decide what gets stored and matched. Reproduce the collision by checking that a keydown with key '.' and code KeyH is recorded differently from key '.' and code Period. Done means those two keys no longer record the same shortcut, while letter-layout cases such as Colemak and AZERTY (#7995) still behave as before. The mapping rule needs a maintainer decision first.

由索引模型根据 Issue 内容生成。

描述

via-triage
What happened

On Linux (Hyprland, Wayland) with a custom XKB layout that puts . on the physical H key, Ctrl+H and Ctrl+. both record as ctrl+. in Settings → Keybindings. The two can't be bound separately. A ctrl+. binding fires on both keys, and on H a ctrl+h binding fires as well.

Diagnosis

Chromium reports:

  • physical Ctrl+H: key=".", code=KeyH
  • physical Ctrl+.: key=".", code=Period

In packages/shared/src/keybindingMatching.ts, shortcutKeyFromEvent keeps event.key only when it is a letter. Otherwise it maps punctuation event.codes through EVENT_CODE_SHORTCUT_KEYS and falls back to event.key:

  • KeyH: . isn't a letter and KeyH isn't a punctuation code, so it falls back to "."
  • Period: maps to "."

recordedLayoutShortcutKey records "." for both. resolveEventKeys returns {".", "h"} for KeyH and {"."} for Period, so ctrl+. matches both keys.

The ambiguity comes from mixing two rules: the layout symbol for letters, and the physical key for punctuation. When event.key is punctuation but event.code is Key[A-Z], one option is to record and match by that letter, as resolveEventKeys already adds it for matching. That keeps Colemak and AZERTY (#7995) working.

Steps to reproduce
  1. On Linux, use an XKB layout whose base symbol on the physical H key is ., e.g. key <AC06> { [ period, parenright ] }; while <AB09> keeps . reachable.
  2. Settings → Keybindings: record a shortcut with Ctrl + physical H. It records ctrl+..
  3. Record another with Ctrl + physical .. It also records ctrl+., so the two conflict.
Version

0.1.10-nightly.20261111.4544 (desktop AppImage, commit 1264c206). No changes to the shortcut matching or recording code through main as of 2026-11-13 (nightly 0.1.10-nightly.20261113.4616).

Environment

NixOS, Linux 6.18 x64, Hyprland (Wayland), custom XKB layout (Halmak-based, with a Ctrl/Super level that gives QWERTY symbols), keyd 2.6.0.

Evidence
`keydown` events captured inside T3 Code Desktop, with no key remapping active for the app:

mods=ctrl key="." code=KeyH   keyCode=72
mods=ctrl key="." code=Period keyCode=75
mods=ctrl key="e" code=KeyK   keyCode=69
mods=ctrl key="v" code=KeyC   keyCode=86
mods=ctrl key="c" code=KeyV   keyCode=67

Chromium ignores the layout's Ctrl level for most keys. That part is upstream Chromium behaviour and isn't what this issue asks to fix. The collision between the first two lines happens in T3's own logic.
Related issues

#7995 / PR #4469 (shortcuts now follow layout symbols), #15954 / open PR #24034 (layout map for macOS Option shortcuts; same files, doesn't cover this case), #14833 (German +).

Fix applied or workaround

None.

Filed by

Claude Opus 5.5 (claude-opus-5-5) through T3 Code triage, in Claude Code.

主要语言
TypeScript
星标
24.8k
派生
6.4k
平均合并
59 分钟
30 天内合并 PR
418

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

pingdotgg/t3code 的其他 Issue

查看 pingdotgg/t3code 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。