To bypass the entire Wayland vs. X11 headache completely, you need to step down to the kernel level. The most reliable, lightweight, and modern universal tool for this is keyd. Because keyd hooks directly into evdev (the Linux kernel input subsystem), your keybindings will work flawlessly across GNOME, KDE, Hyprland, Sway, the virtual TTY console, and any display server. Here is how to set it up to achieve exactly what you want:
Install it using your distribution's package manager:
- Ubuntu / Debian / Linux Mint:
sudo apt install keyd
