Published: 22.05.2021 | Edited: 22.05.2021 | Tags: 100daystooffload

Make Auto-type work in kitty under Wayland

Being a big fan of KeePassXC project I am making use of virtually all the features it provides. One of the features I use really often is the global Auto-type feature. I use it for providing passwords into ssh sessions and into ansible when becoming a super user. The correct password is usually detected and promptly written, with just a single key combination.

The problem with Auto-type feature is that it still does not work on pure Wayland. I have noticed some time ago with Gnome Terminal. I have also tried XFCE4 Terminal but that was also already migrated to Wayland, meaning the Auto-type was not working there either.

I have thus started using kitty for my main terminal, as it is super hackable, but I still did not have time to learn most of it's features. It was still using XWayland, meaning the Auto-type worked there and I could focus on other things for the time being.

Kitty started using Wayland by default somewhere around version 0.20.0, and that again messed up with my Auto-type reliant workflow. I kept downgrading to version 0.19.3, but I did not wanted to do that for a prolonged time. Today, after another system upgrade, the Auto-type stopped working again I had a choice to make. Either I instructed package manager to ignore upgrades for kitty or I find some other solution.

Forcing kitty to use XWayland backend

After some searching I have found that other people try to force the x11 mode on kitty and it is possible to configure it by mupliple ways. The problem only was that I had no idea what XWayland is. I knew there is the trusty old X11 compositor and that there is the newer Wayland compositor. XWayland is an X server running under Wayland to make the migration smoother. Nice, but until there is a support for KeePassXC Auto-type on pure Wayland, I have to run my terminal emulator in X11 or XWayland mode.

For kitty, there are these options:

  • Use the environmental variable:

KITTY_DISABLE_WAYLAND=1

This obviously does not work for the first window when exported in .bashrc or .zshrc, as the variable is set after the first terminal is run.

kitty -o linux_display_server=x11

This is better than the environmental variable as the launcher or alias can be set to this, but requires some extra work.

  • Configure the setting in ~/.config/kitty/kitty.conf:

linux_display_server x11

This is the best option. As of kitty version 0.20.3, the setting has a default value of auto, detecting Wayland on GNOME and running in Wayland. Setting it to x11 runs kitty under XWayland and Auto-type is working properly there, no need for downgrading.

This is a 73th post of #100daystooffload.