How to programmatically toggle CapsLock on Wayland?


I’m trying to get ibus-engine-keyman to work on Wayland. Some of the Keyman keyboards require to toggle the CapsLock key (or at least the caps lock indicator). With X11 this can be done with XkbLockModifiers().

Any hints how to do that on Wayland, or suggestions where I can find information how to do that on Wayland?

It seems that XkbLockModifiers() doesn’t even work with XWayland which I find surprising.


There is no way for direct “Wayland” way to manipulate global compositor state like caps lock, so something like XkbLockModifiers() doesn’t exist. There appears to be a forward-key-event in IBus where you could forward the key event for caps-lock, but it appears to not be plumbed to the input backend in mutter so I don’t think it’ll affect the led state is it is now. Perhaps that can be changed though, I’m not sure, so maybe open an issue on GNOME / mutter · GitLab about it.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.