Bug 513571

Summary: Dead keys leaking in Latvian (Apostrophe) keyboard layouts
Product: [Plasma] kwin Reporter: Jānis Locāns <j.locans>
Component: inputAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED NOT A BUG    
Severity: normal CC: dev, duha.bugs, j.locans, nate
Priority: NOR    
Version First Reported In: 6.5.4   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Keyboard settings

Description Jānis Locāns 2025-12-19 10:01:52 UTC
Created attachment 187789 [details]
Keyboard settings

SUMMARY
When typing FAST - dead keys in Latvian (Apostrophe) keyboard layouts leak or in other words - the diacritics are applied to more than just the letter after the dead key (apostrophe) press.

STEPS TO REPRODUCE
1. Press `'´ (apostrophe)
2. Press `a`
3. Press `c`
4. Repeat this several times as this can be a bit flaky.

Or any other combination with 2 letters which have the diacritic option following each other (āēīōūžčņļķš)

OBSERVED RESULT
`āč` can be seen

EXPECTED RESULT
`āc` only seen

SOFTWARE/OS VERSIONS
Operating System: Fedora Linux 43
KDE Plasma Version: 6.5.4
KDE Frameworks Version: 6.21.0
Qt Version: 6.10.1
Kernel Version: 6.17.11-300.fc43.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 16 × 12th Gen Intel® Core™ i5-12600K
Memory: 32 GiB of RAM (31.1 GiB usable)
Graphics Processor 1: NVIDIA GeForce RTX 4080 SUPER
Graphics Processor 2: Intel® UHD Graphics 770

ADDITIONAL INFORMATION
First I want to say that this creates a lot of grammar errors which should not be there and so the typing becomes very infuriating having to always re-read everything and fix the issues.

I have ruled out hardware issue with other keyboard and OS.
There are two Latvian kb layouts which use apostrophe - 1. Latvian (apostrophe) and 2. Latvian (apostrophe, dead quotes). Both have the same issue. There is no alternative apostrophe layout.
I could not reproduce this on some other language layouts that use dead keys e.g. German.
Reproduced on both Wayland and X11.
Comment 1 Jānis Locāns 2025-12-19 12:50:02 UTC
Found "the same" bug being reported in GNOME two years ago https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7236 which apparently got fixed. It looks almost the same, but it appears that typing fast was not a requirement in that case.
Comment 2 Nate Graham 2025-12-19 16:36:18 UTC
From that bug report, it looks like IBus was implicated? Are you using IBus?
Comment 3 Jānis Locāns 2025-12-19 16:45:21 UTC
(In reply to Nate Graham from comment #2)
> From that bug report, it looks like IBus was implicated? Are you using IBus?

No.
Comment 4 Jānis Locāns 2026-05-10 15:00:50 UTC
Hello.
Is there some way to prioritize this?
Comment 5 Wismill 2026-05-11 07:16:43 UTC
Since IBus is not involved, the key point is probably the first sentence: “When typing FAST”.

The `lv(apostrophe)` layout uses a *latch* modifier – the “apostrophe” modifier, but it is really a latch AltGr – which behave slightly differently than a real dead key:
- Dead key is a Compose feature handled by your IM (input method: IBus, toolkit default, etc.). A dead key starts a compose sequence only for the next key press.
- A Latch modifier *remains active while pressed*: for slow typers it would not make a difference, but if you type *fast* then chances are that you are still pressing the latch modifier while pressing “c”.

@Jānis could you try reproducing the issue, at various typing speeds, ensuring the following sequence:
1. Press *and* release ‹'›
2. Type ‹a›
3. Type ‹c›

Since changing typing habits is hard, you may be interested to simulate the dead key behavior with the following change. Note that it requires libxkbcommon 1.11+ package and is incompatible with *X11 session* (XWayland is fine, see the note hereinafter). It is a *user-space* change so it is safe; see https://xkbcommon.org/doc/current/custom-configuration.html for further details.

Create the file `~/.config/xkb/compat/iso9995` (create directories if needed) with the following content:

default partial xkb_compatibility "default" {

    include "%S/iso9995" // include system defaults

    virtual_modifiers  LevelThree;

    interpret.repeat= False;
    latchMods.clearLocks= True;
    latchMods.latchToLock= True;

    interpret ISO_Level3_Latch+Any {
	useModMapMods= level1;
	virtualModifier= LevelThree;
	action= LatchMods(modifiers=LevelThree, latchOnPress); // dead key behavior
    };
};

Note to KDE devs: the keymap will be automatically converted to X11-compatible format when sent to clients as long as you use the explicit `XKB_KEYMAP_FORMAT_TEXT_V1` with `xkb_keymap_get_as_string()`. So XWayland is fine.
Comment 6 Jānis Locāns 2026-05-11 17:08:54 UTC
@Wismill I added the customization you provided and typing now works as I had used to on a Windows machine.

You are probably right that I had the apostrophe key still pressed. But then if I understand this correctly, the default behavior is working as expected? 

Thanks for the quick answer and solution!
Comment 7 Wismill 2026-05-11 17:41:08 UTC
(In reply to Jānis Locāns from comment #6)
> @Wismill I added the customization you provided and typing now works as I
> had used to on a Windows machine.

Great!

> You are probably right that I had the apostrophe key still pressed. But then
> if I understand this correctly, the default behavior is working as expected? 

Yes, it is expected. The latch modifiers were initially designed for *accessibility*, so not exactly your typing speed. 

> Thanks for the quick answer and solution!

You are welcome!