Beginner project: OS wide key remap for Linux

TL:DR; How would one go about building a global key remapping tool for Linux in Rust?

I am fairly new to Rust. I am also new to Linux—moving from my love for many years; Mac OS—and trying to build something useful as part of my Rust learning.

One thing I miss in Linux is an easy to use tool for global remapping of keys. I, for example, want to remap Caps-Lock to Escape and make the change global for all apps.
How would this be built? What should I learn and understand before heading into such a project?

As a beginner project if you are interested in making a more user friendly key remapping tool for linux I assume you mean a more GUI oriented tool. I would suggest making a gui that wraps setxkbmap. https://linux.die.net/man/1/setxkbmap

Its already quite easy if you are comfortable with using a command line. setxkbmap -option caps:escape or if you also want escape to be caps setxkbmap -option caps:swapescape but it would be a fun project to make a GUI with toggles for commonly desired swaps/replacements.

Good luck!

PS this won't work if you are using wayland.

That’s a good idea. But then I would put that down as a GUI project.
Would be nice with profiles to switch things around. What would I need to learn for building a GUI app, for let’s say, GNOME.
Is it even a good idea building something like that in Rust?

Maybe that project will have to be further in the future when I am no longer fighting as much with the compiler:)

Building gui apps in Rust is currently awkward. All of the successful Rust gui projects I've seen have used gtk, but I admit that it can be somewhat ugly and difficult to use.

I'd love to see such a thing! I currently use https://github.com/matklad/config/blob/05a351e0a925f5db3e3c69b21d1e105208a6a9ea/home-row.xkb to remap CapsLock + ijkl to arrow keys, but it took me long time to come up with that file, and I am not sure how exactly it works. Having a user-friendlier solution here would be much appreciated!