Any way to globally remap keyboard?


Is it possible to remap my keyboard so the remapping works for all apps?
I want “f” key to send backslash (\), so I tried with xmodmap:

xmodmap -e "keycode 41 = backslash"

And in general it works, except for stadia running in google chrome/chromium. Is there any way to globally remap my keyboard?

If it matters I use XFCE, Manjaro 20.2, kernel 5.4.80-2

Have you studied this already?

Now I did, thank you. I changed “f” to “\” using configuration exported by xkbcomp by replacing existing “AC04” definition with:

    key <AC04> {
        type= "FOUR_LEVEL",
        symbols[Group1]= [       backslash,             bar,      dead_grave,      dead_breve ]

but the same problem exists - new key works in most apps, except stadia on chrome. But i noticed one more thing: after changing keymap I need to restart chrome/chromium and then new key definition actually works in some stadia games, but not Cyberpunk 2077 (the same case with xmodmap). Anybody else has any more tips?