I frequently type in french, so I need keys like caret and backtick to act as dead keys
But I also program and write markdown, so I need to type literal backticks quite frequently, but almost always in multiples of 2
On windows, when I press backtick twice, it inserts 2 backticks, which is convenient
(IIRC on MacOS as well)
Since I have moved to NixOS, pressing the backtick key twice only inserts a single backtick
This means to open a markdown code block, I need to press the backtick key 12 times !
(And sometimes that is in the middle of french text, so changing layout is not practical)
How can I make it work in the windows way ?
I was not able to find an answer on my own (even searching for linux more broadly) since the search results are saturated with many different flavours of “what are deadkeys ?”/“Why is this working like this ? (answer: deadkeys)”
The closest I have been able to find is this:
But it actually explains how to make dead keys not dead, not the specific behavior I am looking for
To replicate, easiest is to use the live nixos installer and set your keyboard layout to swiss french (for some reason it is under the german language). It’s a qwertz layout, so it should be almost familiar
Not the solution you’re looking for, but a potential workaround would be to configure a custom key/key combination to insert the grave symbol.
E.g. one way of doing so is via xkb.extraLayouts. I’ve tested with swiss german:
After some more testing I was able to figure out a solution. Again, I tested with the swiss german keyboard layout. If you are using home-manager, add this to e.g. home.nix:
home.file.".XCompose".text = ''
include "%L"
<dead_grave> <dead_grave> : "``"
'';
This would only work for X11 and not wayland, right ?
Also the behavior was more general, I should have been more precise:
“A dead diacritic key followed by a non-diacritic-able key would result in both being emitted.”
For example ^ followed by T would output ^T, ~ followed by / would output ~/
On NixOS (and IIRC linux more generally) I get different behaviour depending on the program:
This forum and Codium: ~/
Kitty: nothing, no character is typed
Konsole: /, the tilde character is ignored
And for the double backtick I get:
This forum, Kitty, Konsole, and Codium terminal: a single backtick
Codium text editor: double backtick
On windows I really don’t remember being surprised, everything worked using the above convention