mattydebie / bitwarden-rofi

Wrapper for Bitwarden https://github.com/bitwarden/cli and Rofi
GNU General Public License v3.0
353 stars 57 forks source link

Fix xdotool typing issue #65

Open TanguyHerbron opened 3 years ago

TanguyHerbron commented 3 years ago

Problem encountered

A user with multiple keyboard layouts may encounter an error when auto typing its password depending on the layouts.

On my machine, I have two layouts set at the same time, and I switch between them using the Caps lock key.

$ setxkbmap -query
rules:      evdev
model:      pc105
layout:     us,fr
options:    grp:caps_toggle

It seems like xdotool has an issue when picking its typing layout, it takes the last layout instead of the currently active one (problem with xdotool and Xorg as I read on other forums).

An easy way to fix it would be to reverse the layout order as follows :

$ setxkbmap -query
rules:      evdev
model:      pc105
layout:     fr,us
options:    grp:caps_toggle

It would fix the problem for me but I guess it might not be the case for everyone.

Solution

The fix I currently suggest is as follows :

On the second step, the layout can be anything as long as it is a single layout. Xdotool 'misstypes' the string only when two conflicting layouts are set at the same time.

Mange commented 3 years ago

This would reset any customization made using xmodmap, among others, as the keyboard would be reset back to an initial layout.


NOTE: I'm not the maintainer, just a contributor. This is just my own personal opinion and does not necessarily reflect the maintainer's wishes.

I would consider this to be part of your particular setup and is probably something you should wrap this script in before you call it, rather than adding it upstream. I think more users will have their setups broken by this than fixed by this.