Start by installing the xdotool package
On Debian/Ubuntu/etc simply run:
sudo apt-get install xdotool keepass2
Next find out where the keepass2 executable is installed on your system
The easiest way to do this is to run:
which keepass2
On my system this returns
/usr/bin/keepass2
This file is actually not the program itself but a script that bootstraps the program. So to find out where the real executable run:
cat /usr/bin/keepass2
On my system this returns
#!/bin/sh
exec /usr/bin/cli /usr/lib/keepass2/KeePass.exe "$@"
So the program itself is actually located at
/usr/lib/keepass2/KeePass.exe
Create a custom keyboard shortcut
The process for this will differ depending on which distribution you’re running but it’s usually under the Keyboard settings. For the command enter the following:
mono /usr/lib/keepass2/KeePass.exe --auto-type