inputmangler is a daemon that intercepts and transforms linux input events, depending on the active window.
It aims to be highly configurable, reliable and not too hard to use. You can use it to remap those extra mouse buttons, properly utilize a footswitch or even remap your second keyboard to trigger all kinds of shortcuts! If you are left-handed, you can switch left and right mouse buttons for applications that ignore your Desktops settings (like dosbox and fs-uae). And you can have a different configuration for each window!
It is also capable of translating Text from the network to key presses.

Source and packages

On github