If I remember correctly, Wayland forbids to listen to keyboard inputs for security reasons. Each software receives its input, but there is no global listening.
So, in my understanding, this could mean that it's not possible.
From Wikipedia, the free encyclopedia
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.
Community icon by Alpár-Etele Méder, licensed under CC BY 3.0
If I remember correctly, Wayland forbids to listen to keyboard inputs for security reasons. Each software receives its input, but there is no global listening.
So, in my understanding, this could mean that it's not possible.
Wayland supports global shortcuts using the global shortcuts portal, so it should be possible. There's an app called espanso that automatically expands text on Wayland, I imagine similar methods could be used for this.
I didn't know about global shortcut portal, that's interesting.
Thank you for your input, I've learned something today.
For X11 it could be possible. And Implementing it into the Compositor could be possible too
It looks like this works by following accessibility standards. I'm not sure if an accessibility standard for input fields on Linux, but if it does it should be possible.