mirror of
https://github.com/keycastr/keycastr.git
synced 2026-10-23 08:07:30 -06:00
[PR #359] Show command shortcuts as typed on Dvorak - QWERTY layouts #358
Labels
No labels
bug
compatibility
discussion
documentation
enhancement
help wanted
help wanted
investigation needed
pull-request
release
visualizer
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github-starred/keycastr#358
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/keycastr/keycastr/pull/359
Author: @monsterlag
Created: 10/22/2026
Status: 🔄 Open
Base:
main← Head:fix/issue-117-203a📝 Commits (1)
6886786Show command shortcuts as typed on Dvorak - QWERTY ⌘ layouts📊 Changes
2 files changed (+36 additions, -3 deletions)
View changed files
📝
keycastr/KCEventTransformer.m(+11 -3)📝
keycastr/KCVisualizerTests/KCKeystrokeConversionTests.m(+25 -0)📄 Description
What
With the "Dvorak - QWERTY ⌘" input source, macOS switches the keyboard to QWERTY while ⌘ is held, so the key labelled J in Dvorak (QWERTY C, keyCode 8) triggers ⌘C (Copy). KeyCastr translated every key code with no modifier state, so it showed that shortcut as ⌘J. Same for ⌘V, ⌘X and the rest.
Fixes #117
How
-translatedCharacterForKeystroke:now passes the command modifier toUCKeyTranslatewhen ⌘ is down, so the layout's own command key map is used, which is the map macOS uses to match the shortcut. If that map has no character for the key, it falls back to the unmodified translation, as before. Only ⌘ is passed (not ⌃, ⌥ or ⇧), so the existing keycap and uppercasing rules are unchanged.Effect on other layouts: I compared each installed layout's base map with its command map in a macOS 26.6 VM. US, ABC, German, French, plain Dvorak and the other Latin layouts I checked have the same characters with and without ⌘, so their output does not change. Layouts with non-Latin scripts (Russian, Greek, Hebrew, Arabic and others) map ⌘ to Latin letters. On those layouts ⌘C on the key labelled С now shows ⌘C, which matches what macOS shows in its menus. Please say if you would rather limit the change. This also matches what was asked for in #242 (Latin command letters on a Japanese Kana layout); happy to limit it to Latin-script layouts if you prefer.
How tested
On macOS 26.6 / Xcode 27.1, with submodules initialised. The project has no shared scheme that runs
KCVisualizerTests, so I made a local, uncommitted scheme for that target. I also had to passMACOSX_DEPLOYMENT_TARGET=12.0because Xcode 27 rejects the project's 10.13 target: From Xcode, the new test runs like the existing ones:KCKeystrokeConversionTestsin theKCVisualizerTeststarget.test_dvorakQwertyCommand_commandShortcutsUseQwertyKeycapstoKCKeystrokeConversionTests. It loads thecom.apple.keylayout.DVORAK-QWERTYCMDinput source and checks that keyCode 8 showsjwith no modifiers, and⌘C(keycapC) with ⌘ held.xcodebuild test -scheme <local KCVisualizerTests scheme> -destination platform=macOS MACOSX_DEPLOYMENT_TARGET=12.0before the fix: the new test failed with("⌘J") is not equal to ("⌘C")and("J") is not equal to ("C"). After the fix:Executed 39 tests, with 0 failures,** TEST SUCCEEDED **.xcodebuild build -scheme KeyCastr -destination platform=macOS MACOSX_DEPLOYMENT_TARGET=12.0 CODE_SIGNING_ALLOWED=NO(signing disabled, since the project's team certificate is not available):** BUILD SUCCEEDED **, with no new warnings inKCEventTransformer.m.I did not test with a running app and a real Dvorak keyboard.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.