feat(sway): bind shortcuts by keycode with --to-code - #262
Open
QuentinCazier wants to merge 2 commits into
Open
QuentinCazier wants to merge 2 commits into
QuentinCazier wants to merge 2 commits into
Conversation
The sway configuration binds shortcuts by keysym, so on a keyboard using another layout than fr the workspace keys and letter shortcuts land on different physical keys. Using bindsym --to-code translates each keysym to its keycode from the first configured layout (fr), so the same physical keys work on both fr and en keyboards without carrying the bindings in an extra config. Closes cloud-gouv#84 Signed-off-by: Quentin Cazier <cazierquentin@gmail.com>
Boots the Securix sway configuration and sends key events through QEMU. The shortcuts must react on the same physical keys with the default fr layout and once the keyboard is switched to a us layout. Signed-off-by: Quentin Cazier <cazierquentin@gmail.com>
QuentinCazier
marked this pull request as ready for review
September 11, 2026 16:48
QuentinCazier
requested review from
jdauphant-dinum,
olebrouster-dinum,
plegrand-dinum and
rlahfa-dinum
as code owners
September 11, 2026 16:48
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #84
Sway bindings were declared by keysym, so a keyboard set to another layout than
frends up with the workspace and letter shortcuts on different physical keys.This adds
--to-codeto everybindsymof the shipped config. Sway resolves each keysym to its keycode from the firstinputblock that declares anxkb_layout, heretype:keyboardwithfr, so the shortcuts stay on the same physical keys whatever layout is active on the keyboard. The bindings stay in the main config, so they remain overridable without an extra config file.Note on how sway picks the reference layout: the translation uses the first layout of the first
inputblock that declares one. A sharedxkb_layout "fr,us"with a layout switch works as expected. A per device override such asinput <id> xkb_layout usbecomes that reference instead, so this case is not covered by the change.Test
tests/sway-keybindings.nixboots the Securix sway configuration in a VM and sends key events through QEMU: Mod+Return, Mod+Shift+q and Mod+2 on the fr layout, then Mod+3, Mod+Return and Mod+Shift+q after switching the keyboard to us. Onmainthe us part fails, with this change both parts pass.nixfmt, statix and reuse pass on the new files.