KeePass Help Center KeePass Home | Downloads | Translations | Plugins | Donate 
Help Center Home | Forums | Awards | Links 







Auto-Type on Wayland

Details about auto-type on systems with Wayland.


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').

Auto-Type Context Menu

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. SystemDesktop Env.Wind. System
Debian 10GNOME 3.30Wayland
Debian 11GNOME 3.38Wayland
Fedora 34KDE 5.22Wayland
Fedora 35GNOME 41.5Wayland
Fedora 36GNOME 42.4Wayland
Kubuntu 21.04KDE 5.21Wayland
Manjaro 21GNOME 40.3Wayland
Ubuntu 21.04GNOME 3.38Wayland

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:

  1. Make sure that the following packages are installed:
    PrerequisiteTypical Package Name
    GNU C++ compilerg++ / gcc-c++
    Standard C++ library (static)libstdc++-static
    Linux header fileslinux-headers-ARCHITECTURE
    Systemd utility library - development fileslibsystemd-dev
    XKB compiler - development fileslibxkbcommon-dev
    Mono development tools and librariesmono-complete
  2. 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).
  3. Reboot your machine.
  4. 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.
  5. 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.
  6. 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).
  7. 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
    • Initial release.








Get KeePass