Auto-fill API
Currently there's no good way for password managers to have working autofill on Wayland. Afaiu on X11 that works something like this:
- the user pressed a global shortcut or opens the password manager manually
- the password manager looks at the currently focused window, its application name and window title (if it wasn't opened manually)
- the password manager offers a list of passwords to choose from
- once a password is selected, the password manager uses X11 to type in a password, potentially with tab and enter to jump between input fields
I think we can make that work in Wayland without too many issues, and we can make it work better than on X11. My idea is relatively similar to how input methods work:
- two protocols, one for password managers, one for applications
- for the password manager side:
- the compositor ensures that only trusted clients bind to this interface. The password manager could maybe be started by the compositor, like at least KWin does with input methods
- the compositor can ask the password manager to fill in some password - on global shortcut, or application request. It gives additional information like application name and window title, so that the password manager can show a curated list of logins to select from
- the password manager can create a surface with some special interface for positioning it close to the input field - like
zwp_input_panel_surface_v1
but in not terrible, and with the possibility for keyboard input (for searching through logins, or inputting a new one) - the password manager can send the login name (account, email, whatever) + password (or pin, or whatever) to the compositor, which will input it into the correct window through whatever means is appropriate. The compositor ensures that input never goes to the wrong window, even if focus is changed before the input happens
- for the client side:
- the client can advertise a login field to be selected, with additional information like
- the position and size of the input field
- the website or service the login is for
- what kind of login data needs to be filled in (username, email, password, credit card information, addresses)
- what login data is already filled in
- the compositor can give the client a list of key:value pairs to fill in
- if the client doesn't support the interface (or even if it does and just doesn't trigger it in some situation), the user can still manually press a keyboard shortcut to trigger the password manager's prompt. Input would happen through
wl_keyboard
ortext-input-v1/2/3
in that case
- the client can advertise a login field to be selected, with additional information like
Open questions:
- does this have to be in Wayland, or should it be a portal? I think it does belong here; doing this requires privileged information about windows, input into them, placement of overlay surfaces relative to app's windows / content in them, and the compositor is heavily involved in all of those
- do we need to support multiple password managers being active at once?
- what about passkeys? I don't know a lot about them tbh, they might require additional information exchange?
Some input from password manager developers would be nice; I can't comment on the keepassxc issue about this, but @vimpostor seems to be involved with it?
Edited by Xaver Hugl