Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AutoType not available when using Wayland #2281

Open
ganomi46 opened this issue Sep 11, 2018 · 112 comments · May be fixed by #10905
Open

AutoType not available when using Wayland #2281

ganomi46 opened this issue Sep 11, 2018 · 112 comments · May be fixed by #10905

Comments

@ganomi46
Copy link

ganomi46 commented Sep 11, 2018

Expected Behavior

AutoType should be available as under X.

Current Behavior

AutoType not available in Wayland

Steps to Reproduce (for bugs)

Login to Plasma Wayland
Open KeePassXC
You will there are no auto login options

Operating system: OS
Debian SID amd64

@droidmonkey
Copy link
Member

Are you referring to AutoType??

@ganomi46
Copy link
Author

ganomi46 commented Sep 11, 2018 via email

@droidmonkey droidmonkey changed the title Autologin option not available in KDE Wayland AutoType not available when using Wayland Sep 12, 2018
@Whompithian
Copy link

I can confirm lack of Auto-Type options using Plasma Wayland.

OS: 4.14.65-gentoo x86_64
plasma-5.46.0
wayland-1.15.0

@phoerious
Copy link
Member

Auto-Type cannot work on Wayland due to security restrictions for which we haven't found a solution yet.

@rockihack
Copy link
Contributor

I implemented autotype for wayland, still needs some work though.

https://github.com/rockihack/keepassx/blob/wayland-autotype/wayland.txt
https://github.com/rockihack/keepassx/tree/wayland-autotype/src/autotype/wayland

@apollo13
Copy link

apollo13 commented May 1, 2020

It might be worth to look what https://gitlab.gnome.org/ofourdan/gnome-ponytail-daemon does. I seems to allow writing arbritrary key sequences to windows.

@tmccombs
Copy link

tmccombs commented Jul 12, 2020

fwiw, there is a keepass plugin that supports this (https://keepass.info/help/kb/autotype_wayland.html), it does require access to /dev/uinput though.

For wlroots based compositors (such as sway) the input-method protocol (https://github.com/swaywm/wlroots/blob/master/protocol/input-method-unstable-v2.xml) or possibly the virtual-keyboard protocol (https://github.com/swaywm/wlroots/blob/master/protocol/virtual-keyboard-unstable-v1.xml) may allow implementing AutoType

@curiosityseeker
Copy link

I'm using KeePassXC on Arch Linux with Wayland (on KDE) in combination with ydotool, specifically ydotool-git in the AUR. And voilà - Autotype works flawlessly!

So perhaps it's possible to integrate ydotool's approach in KeePassXC directly?

@droidmonkey
Copy link
Member

Oh nice!!

@apollo13
Copy link

Mhm, seems like it has a client/server structure because it uses /dev/uinput which requires (usually) root permission. Still better than no autotype I guess :D

@curiosityseeker
Copy link

curiosityseeker commented Oct 23, 2020

Yes, it seems to be similar to how KeePass does it with KPUInput.

@apollo13
Copy link

https://gitlab.com/dogtail/dogtail/ seems to use the accessibility features in gnome and kde to send text to applications without the need of uinput and as such without any extra daemon.

@apollo13
Copy link

Ok, dogtail uses ponytail on wayland which I linked above already. Seems to be a rather heavy solution :/

@droidmonkey droidmonkey added this to the v2.7.0 milestone Oct 24, 2020
@droidmonkey
Copy link
Member

I think I'll opt for #2281 (comment) solution

@phoerious
Copy link
Member

phoerious commented Oct 26, 2020

Using the DE's accessibility features is the only correct way to implement it. I only wish there were some kind of standard interface and not several largely incompatible ones, like there always is on Linux.

@MAFLO321
Copy link

I'm not very familiar with Wayland in deep, but can text-input-v3 protocol be used to solve the virtual-input problem?
KDE Plasma's and Gnome's Compositors both support it.

already mentioned by #2281 (comment)

@phoerious
Copy link
Member

Perhaps, need to check. Thanks for the pointer.

@ztNFny
Copy link

ztNFny commented Apr 28, 2021

I'm using KeePassXC on Arch Linux with Wayland (on KDE) in combination with ydotool, specifically ydotool-git in the AUR. And voilà - Autotype works flawlessly!

So perhaps it's possible to integrate ydotool's approach in KeePassXC directly?

Could you elaborate on that? How can KeePassXC be configured to use ydotool? I thought to just use it with cmd://, but then the input just goes .. no idea where.

@sam9032
Copy link

sam9032 commented May 2, 2021

I don't have KDE Plasma to test right now, but under Gnome 40 with wayland it works ootb. Is this issue still present in plasma?

@vimpostor
Copy link
Contributor

I don't have KDE Plasma to test right now, but under Gnome 40 with wayland it works ootb. Is this issue still present in plasma?

I just tested in Plasma and it doesn't work there. Neither global autotype nor manually choosing autotype from Keepass itself are working.
I am curious, does anyone know how this is working in Gnome? As far as I can see in the codebase, there is no implementation merged for Wayland yet, so I don't get why this is working in Gnome ootb for you.

Tested on Plasma 5.21.4 on Arch btw.

@Zahrun
Copy link

Zahrun commented Jun 1, 2024

I’m offering $100 for a fix to this issue at gitpay https://gitpay.me/#/task/763/auto-type-not-available-when-using-wayland
If this issue is important to you, please feel free to add any amount to the bounty.

@TheConfuZzledDude
Copy link

Just learned that Goldwarden is using the libportal RemoteDesktop interface for auto-type. Unsure on the actual security of that, but here it is:

https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.RemoteDesktop.html

https://github.com/quexten/goldwarden/blob/main/cli/autotype/libportalautotype.go

I believe that using the RemoteDesktop portal interface is fine for that, it's really just for accessing emulated inputs. The ConnectToEIS would be used to get the fd for the compositor's EIS, and then libei can be used to actually send inputs.

See also https://libinput.pages.freedesktop.org/libei/api/index.html#sec-oeffis for liboeffis which handles the desktop portal access and just gets the libei fd.

As for window detection/focusing, ext-foreign-toplevel-list-v1 isn't really implemented anywhere yet, and activation of those foreign windows isn't close.

@zsteinmetz
Copy link

I’m offering $100 for a fix to this issue at gitpay https://gitpay.me/#/task/763/auto-type-not-available-when-using-wayland If this issue is important to you, please feel free to add any amount to the bounty.

Just added 50 bucks 💸

@zsteinmetz
Copy link

@droidmonkey, could you please add the bounty tag and the current amount to this issue to raise more awareness? Thank you!

@droidmonkey
Copy link
Member

We don't officially back bounties anymore, but I added the tag for sport.

@TheConfuZzledDude
Copy link

I am working at this currently, I'll have a WIP PR up soonish

@TheConfuZzledDude
Copy link

The PR is up now, still needs work

@reshadp
Copy link

reshadp commented Jul 22, 2024

When I run KeePassXC from the terminal using the command keepassxc -platform xcb I have get the auto type options enabled again (I know this is supposed to work).
I am on KDE Plasma 6 running Wayland and am able to use the autotype function when in this mode to type into even what should be Wayland windows (Konsole, Kate, Kwrite, Firefox) after accepting a dialogue box which asks me to accept a remote control request.
Screenshot_20240722_120525
The dialogue box only shows up once per Plasma session (which I think is fine).

This dialogue box is relatively new (maybe a month or so) auto-type would only work with X11 apps running in XWayland (I used to auto-type into Chromium) before I noticed this dialogue box.
Hope this workaround helps anyone while the PR to get this properly implemented.

@agowa
Copy link

agowa commented Jul 25, 2024

The documentation already coveres this: https://keepassxc.org/docs/KeePassXC_UserGuide#_auto_type

Auto-Type will be disabled when run with a Wayland compositor on Linux. To use Auto-Type in this environment, you must set QT_QPA_PLATFORM=xcb or start KeePassXC with the -platform xcb command-line flag.

After testing this right now I only see two minor issues remaining to be fixed regarding this ticket:

  • KeePass automatically detecting that it is running in Wayland mode and that it needs to use the features provided by this flag without requiring user action to specify it on startup.
  • The Auto-Type didn't wait for me to actually confirm the sharing and by the time I hit "Share" it already tried to type half of the credentials. And thereby the credentials it entered were incomplete. This isn't an issue for any following attempts though.

@vimpostor
Copy link
Contributor

I feel there is a need to explain why suddenly the XWayland -> Wayland client direction is working without changes from the Keepass side and why the problem is still only half solved:

The "Remote control requested" dialog you are seeing is a result of KDE implementing the Input Capture and Remote Desktop portal together with support for the ConnectToEIS method.

libei is a library for emulated input on Wayland and has support for a superset of the functionality that was available in the XTest extension, which KeepassXC uses to implement autotype on X11.

libei can be used as a drop-in replacement for XTest in XWayland and the README even illustrates this architecture.
Note that the comment about the implementations being in PoC state is outdated, full support was merged into XWayland a year ago.

This means that the fully working path from XWayland to Wayland clients is as follows:

As mentioned at the beginning, there are however some caveats with this:

  1. This only works if KeepassXC is running in XWayland mode, there is no native Wayland support yet (however there is a PR being worked on).
  2. It does not support filtering based on Window titles. This means it is not possible to hit a global key and show entries based on the currently active window, as is possible with Xorg. Instead the entry has to be manually selected. This caveat will also still be true for the pending native Wayland PR, there simply is no mechanism on Wayland to do that (and many compositors even refuse to implement ext-foreign-toplevel-list-v1)
  3. The dialog asking for input consent will silently swallow all sent input events until the dialog is accepted, so on the first time the target may receive only half or none of the intended keyboard events.

So while the situation is certainly better than before (support for basic autotype is working in XWayland and soon in Wayland), full support like on Xorg with autotype triggered on a hotkey and automatically filtering based on window title is still far from a reality.

@agowa
Copy link

agowa commented Jul 25, 2024

@vimpostor is https://wayland.app/protocols/ext-foreign-toplevel-list-v1#ext_foreign_toplevel_handle_v1:event:title part of the accessibility API? Getting information of running windows sounds like something almost every accessibility tool would need to function properly. And doesn't Wayland at least also have support for screen readers? How do they access such information then? Doesn't Orca Screen Reader already support Wayland? So aren't there already APIs that could be used?

Or is this all still a big work in progress mess?

@MRDGH2821
Copy link

This seems to be useful:
https://espanso.org/docs/install/linux/#adding-the-required-capabilities

@Ironwally
Copy link

I found this issue after installing keepassxc via snap. Up to now I used keepassxc via appimage. Here I did not have any issues or needed workarounds.

So maybe it would be interessting to know why this works with the appimage, but not with, I suppose, the rest?

@MRDGH2821
Copy link

I found this issue after installing keepassxc via snap. Up to now I used keepassxc via appimage. Here I did not have any issues or needed workarounds.

So maybe it would be interessting to know why this works with the appimage, but not with, I suppose, the rest?

You mean to say that Auto type works in wayland session when run as app image?
Because I tried & there is no Autotype option.

Can you confirm if you were in Wayland/X11 session?

@dasistwas
Copy link

dasistwas commented Aug 8, 2024

On Ubuntu 24.04 I used to start keepassxc with QT_QPA_PLATFORM=xcb /snap/bin/keepassxc -platform xcb %f That worked for a week and now AutoType is gone again. Snap version of keepassxc is 2.7.8, then I tried the AppImage, but here it is the same (2.7.9) - AutoType does not work.

Launching AppImage:

./KeePassXC-2.7.9-x86_64.AppImage 
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
QObject::startTimer: Timers cannot have negative intervals
qt.network.ssl: QSslSocket: cannot resolve EVP_PKEY_base_id
qt.network.ssl: QSslSocket: cannot resolve SSL_get_peer_certificate
qt.network.ssl: QSslSocket: cannot call unresolved function SSL_get_peer_certificate

Launching snap:


QT_QPA_PLATFORM=xcb /snap/bin/keepassxc -platform xcb %f
Qt: Session management error: Could not open network socket
MESA: warning: Driver does not support the 0x7d55 PCI ID.
libGL error: glx: failed to create dri3 screen
libGL error: failed to load driver: iris

@Ironwally
Copy link

Ironwally commented Aug 8, 2024

I found this issue after installing keepassxc via snap. Up to now I used keepassxc via appimage. Here I did not have any issues or needed workarounds.
So maybe it would be interessting to know why this works with the appimage, but not with, I suppose, the rest?

You mean to say that Auto type works in wayland session when run as app image? Because I tried & there is no Autotype option.

Can you confirm if you were in Wayland/X11 session?

Yes, I am using wayland.
I never specified any options like -platform or something. I just downloaded the app and started it. Out of the box it worked fine.

I'll check if theres some argument run automatically when starting via appimage.

@Ironwally
Copy link

Ironwally commented Aug 8, 2024

Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.

Interesting, your startup errors for the appimage.

Mine is slightly different and makes me think that mine is actually running with xcb.
qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in ""
But I don't know how to interprete this one.
It seems to want to load wayland, but doesn't give the same error as yours.

@ioogithub
Copy link

ioogithub commented Aug 18, 2024

When I run KeePassXC from the terminal using the command keepassxc -platform xcb I have get the auto type options enabled again (I know this is supposed to work). I am on KDE Plasma 6 running Wayland and am able to use the autotype function when in this mode to type into even what should be Wayland windows (Konsole, Kate, Kwrite, Firefox) after accepting a dialogue box which asks me to accept a remote control request. Screenshot_20240722_120525 The dialogue box only shows up once per Plasma session (which I think is fine).

This dialogue box is relatively new (maybe a month or so) auto-type would only work with X11 apps running in XWayland (I used to auto-type into Chromium) before I noticed this dialogue box. Hope this workaround helps anyone while the PR to get this properly implemented.

How exactly do you get this dialogue box to pop up? I have been trying to get autotype for wayland on plasma6 working for over a month.

If I start keepass with the -platform xcb argument as per the documentation then yes I can get the auto type tab however no apps, Wayland xwayland or otherwise actually work.

I never get any window asking for permission, When I press the global autotype shortcut in any window aside frim keepass itself, I don't see any errors it just does not work. If I try the Entry-Level Auto-Type, same result, I select the entry, keepassxc window minimizes then nothing previous window appears however it does not get any password.

I am currently on KDE Plasma 6.1.3. I would love to get this working it is perpahs the last major app that does not work with this environment.

@q-wertz
Copy link

q-wertz commented Aug 19, 2024

For me the Auto-Type started working "magically" a few weeks ago.

I first get a pop-up from keepass, then one from the OS asking for permission and after confirming I can use autotype.
I'm on Wayland with gnome 46 (gdm 46.2-3)

Other maybe relevant packages:

  • gnome-browser-connector 42.1-5
  • gnome-desktop 1:44.0-1
  • gnome-desktop-4 1:44.0-1
  • gnome-desktop-common 1:44.0-1
  • mutter 46.3.1-1.1
  • xdg-desktop-portal-gnome 46.2-2

KeepassXC is installed via yay (not as flatpak) and keepassxc is started without any command line parameters/arguments (as far as I know)

@arigit
Copy link

arigit commented Sep 2, 2024

When I run KeePassXC from the terminal using the command keepassxc -platform xcb I have get the auto type options enabled again (I know this is supposed to work). I am on KDE Plasma 6 running Wayland and am able to use the autotype function when in this mode to type into even what should be Wayland windows (Konsole, Kate, Kwrite, Firefox) after accepting a dialogue box which asks me to accept a remote control request. Screenshot_20240722_120525 The dialogue box only shows up once per Plasma session (which I think is fine).
This dialogue box is relatively new (maybe a month or so) auto-type would only work with X11 apps running in XWayland (I used to auto-type into Chromium) before I noticed this dialogue box. Hope this workaround helps anyone while the PR to get this properly implemented.

How exactly do you get this dialogue box to pop up? I have been trying to get autotype for wayland on plasma6 working for over a month.

If I start keepass with the -platform xcb argument as per the documentation then yes I can get the auto type tab however no apps, Wayland xwayland or otherwise actually work.

I never get any window asking for permission, When I press the global autotype shortcut in any window aside frim keepass itself, I don't see any errors it just does not work. If I try the Entry-Level Auto-Type, same result, I select the entry, keepassxc window minimizes then nothing previous window appears however it does not get any password.

I am currently on KDE Plasma 6.1.3. I would love to get this working it is perpahs the last major app that does not work with this environment.

Same experience on Ubuntu 24.04.1, both firefox and keepassxc (2.7.9) installed as flatpaks. I added "QT_QPA_PLATFORM=xcb" to keepassxc enviroment via flatseal. The Autotype tab shows, but autotype is not working at all, from either global key or triggered from the menu context when right-clicking a DB entry

@ag-gaphp
Copy link

ag-gaphp commented Sep 4, 2024

I'm on Arch, using KDE/Plasma

When installed via Discover/Flatpak, I can't get the auto-type tab to appear under any circumstance. Have tried setting the env var and adding the command flag to no avail.

When installed via pacman (kxc v2.7.9), the auto-type tab is already there by default, and when the database is locked it picks up the global hotkey I have set, asking to unlock the database. However, once unlocked, auto-type does nothing. I still tried adding -platform xcd to the command arguments, and setting QT_QPA_PLATFORM=xcb, but neither changes the behavior.

I get this log output when I start keepassxc (installed via pacman) without any arguments:

qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in ""

@q-wertz
Copy link

q-wertz commented Sep 5, 2024

I'm on Arch, using KDE/Plasma

On my Manjaro/Gnome installation via yay AutoType is working and I get

Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.

when starting keepassxc

It seems to run in Xwayland mode and the error (that also @dasistwas has) seems to be unrelated.

EDIT:
BTW: When I use keepassxc -platform xcb AutoType works directly without the OS asking beforehand for permission.

@agowa
Copy link

agowa commented Sep 5, 2024

BTW: When I use keepassxc -platform xcb AutoType works directly without the OS asking beforehand for permission

I had to grant permission. That's probably because you already granted it...

@q-wertz
Copy link

q-wertz commented Sep 6, 2024

I had to grant permission. That's probably because you already granted it...

No... After closing the permission is lost and I have to regrant it when using it without -xbc.
Also there is a "sharing" indication icon when the permission is granted (like with microphone and camera)

@arigit
Copy link

arigit commented Sep 6, 2024

When I run KeePassXC from the terminal using the command keepassxc -platform xcb I have get the auto type options enabled again (I know this is supposed to work). I am on KDE Plasma 6 running Wayland and am able to use the autotype function when in this mode to type into even what should be Wayland windows (Konsole, Kate, Kwrite, Firefox) after accepting a dialogue box which asks me to accept a remote control request. Screenshot_20240722_120525 The dialogue box only shows up once per Plasma session (which I think is fine).
This dialogue box is relatively new (maybe a month or so) auto-type would only work with X11 apps running in XWayland (I used to auto-type into Chromium) before I noticed this dialogue box. Hope this workaround helps anyone while the PR to get this properly implemented.

How exactly do you get this dialogue box to pop up? I have been trying to get autotype for wayland on plasma6 working for over a month.
If I start keepass with the -platform xcb argument as per the documentation then yes I can get the auto type tab however no apps, Wayland xwayland or otherwise actually work.
I never get any window asking for permission, When I press the global autotype shortcut in any window aside frim keepass itself, I don't see any errors it just does not work. If I try the Entry-Level Auto-Type, same result, I select the entry, keepassxc window minimizes then nothing previous window appears however it does not get any password.
I am currently on KDE Plasma 6.1.3. I would love to get this working it is perpahs the last major app that does not work with this environment.

Same experience on Ubuntu 24.04.1, both firefox and keepassxc (2.7.9) installed as flatpaks. I added "QT_QPA_PLATFORM=xcb" to keepassxc enviroment via flatseal. The Autotype tab shows, but autotype is not working at all, from either global key or triggered from the menu context when right-clicking a DB entry

An update on this: there is an ugly workaround that can be used in wayland for keepassxc (flatpak) and firefox (flatpak) autotype to work: running both on xwayland, this is easy to achieve using Flatseal and removing the "Wayland Socket" permission from both Firefox and KeepassXC. Global autotype works well, as expected. Ubuntu 22.04 / nvidia 555

Of course, doing that is bad specially for firefox, it's back to the past (not as smooth (noticeably) browsing pages, security implications etc). So truly hopeful we will get native wayland autotype via a portal working sometime soon. In my environment could not manage yet to get the "prompt" that some folks report above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.