|
General
For Unix-like systems with Wayland compositors, there is a plugin
called KPUInput, which allows KeePass to use the
/dev/uinput device
for sending keypresses to other windows.
KPUInput is distributed under the terms of the
GNU
General Public License v2.
With the KPUInput plugin, KeePass can auto-type the default sequence
(as specified on the 'Auto-Type' tab of the entry editing dialog)
of the currently selected entry (command 'Perform Auto-Type').
Furthermore, you can select an entry and auto-type fixed sequences
(via the context menu), if the option 'Show additional auto-type menu commands'
(in 'Tools' → 'Options' → tab 'Interface') is turned on.
Advanced auto-type features that need the title of the target window
(like window-sequence associations and a system-wide hot key)
are not supported, because Wayland does not seem to provide
any way to get the title of the currently active window
(in contrast to X11 and Windows).
If an API is added to Wayland for getting the title of the currently
active window or if a layer/library (between Wayland and desktop environments)
is developed, we will consider using this.
Some desktop environments provide own APIs, but we are not planning
to use these directly, due to the large number of desktop environments (more than 30).
It does not make sense that every application has to use custom code
for each desktop environment; one common API
(like the ones provided by X11 and Windows) is much more reasonable.
On some systems, physically pressed keys cannot be released programmatically.
Therefore, if you press Ctrl+V
(in order to invoke the 'Perform Auto-Type' command),
please release both keys within 1 second after pressing the
V key.
Furthermore, make sure that Caps Lock is off
when invoking auto-type.
Due to the complicated setup of the KPUInput plugin,
the potential security issues and the limitations,
we recommend to use X11 instead of Wayland, if possible.
Security
Wayland does not seem to provide any API for sending
keypresses to other windows.
Therefore, the KPUInput plugin uses an API from a lower level,
namely the /dev/uinput device (Linux kernel level).
For security reasons, this device by default is not accessible by regular users.
The setup steps make the device usable by regular users
(every user in the uinputg group).
On a system that is used by one user only, this typically is not a problem.
However, on a system with multiple users, it may be a security issue,
and we advise against this solution in this case.
On X11 and Windows, there is no such problem, because X11 and Windows
provide APIs for sending keypresses to other windows that are limited
to the current user, i.e. no access to devices on a lower level is required.
Compatibility
KPUInput is compatible with most modern Linux systems.
Especially, it has been tested successfully on the following systems:
Op. System | Desktop Env. | Wind. System |
Debian 10 | GNOME 3.30 | Wayland |
Debian 11 | GNOME 3.38 | Wayland |
Fedora 34 | KDE 5.22 | Wayland |
Fedora 35 | GNOME 41.5 | Wayland |
Fedora 36 | GNOME 42.4 | Wayland |
Kubuntu 21.04 | KDE 5.21 | Wayland |
Manjaro 21 | GNOME 40.3 | Wayland |
Ubuntu 21.04 | GNOME 3.38 | Wayland |
On some systems with KDE, the standard Unicode composition key sequence
(Shift+Ctrl+U,
hexadecimal code, Enter) does not work.
In this case, not all characters can be realized.
Setup
In order to install the KPUInput plugin and configure the system for it,
follow these steps:
- Make sure that the following packages are installed:
Prerequisite | Typical Package Name |
GNU C++ compiler | g++ / gcc-c++ |
Standard C++ library (static) | libstdc++-static |
Linux header files | linux-headers-ARCHITECTURE |
Systemd utility library - development files | libsystemd-dev |
XKB compiler - development files | libxkbcommon-dev |
Mono development tools and libraries | mono-complete |
- The following commands grant the current user the permission to
use
/dev/uinput :
sudo groupadd uinputg
sudo usermod -a -G uinputg $USER
echo "KERNEL==\"uinput\", GROUP=\"uinputg\", MODE=\"0660\", OPTIONS+=\"static_node=uinput\"" | sudo tee /etc/udev/rules.d/89-uinput-u.rules > /dev/null
If your system does not support sudo , log in as
administrator/root (with su ) and run the commands above
(without sudo , and replace $USER by the
name of your regular user account).
- Reboot your machine.
- Download the KPUInput plugin package:
KPUInput 1.4.
If you are a developer and want to have a look at the source code
of the KPUInput plugin, here it is:
KPUInput 1.4 Source Code.
- Unpack the KPUInput plugin ZIP file and run the
KPUInputN.sh script file. Example:
chmod +x KPUInputN.sh; ./KPUInputN.sh
If successful, a file called KPUInputN.so is generated.
- Move all plugin files (
KPUInput* ) into the KeePass application
directory (directly, i.e. the plugin files must be in the same folder as
the KeePass.exe file, not in any subfolder of it).
- If you are using the official portable ZIP package of KeePass
(
KeePass-X.YY.zip ), skip this step.
Otherwise (i.e. if you are using any other KeePass package, e.g. a
package provided by your Linux distribution), navigate to the KeePass
application directory (which contains the KPUInputN.so
file) and run this:
sudo cp -f KPUInputN.so /usr/lib/KPUInputN.so
(or with su , like above).
Please note that these steps are required on every machine
on which you want to use auto-type. The KPUInputN.so file
(generated by running the KPUInputN.sh script file)
is not portable, i.e. copying the file to a different machine
will not work in general.
Version History
Changes in the KPUInput plugin:
- 1.4
- Updated for KeePass ≥ 2.52.
- Minor other improvements.
- 1.3
- Added support for sending the following keys:
PrtSc/SysRq,
LWin/LMeta and
RWin/RMeta.
- Minor other improvements.
- 1.2
- Added delay between keypresses (for target applications with time-dependent
input processing).
- Some OEM virtual key codes are translated to Linux key codes now.
- KPUInput now registers only the keys that it really needs.
- Improved linking of
KPUInputN.so .
KPUInputN.cpp now explicitly includes the string
header file.
- Minor other improvements.
- 1.1
- Added support for event-based engine creation.
- Minor other improvements.
- 1.0
|
|