rofi-rbw icon indicating copy to clipboard operation
rofi-rbw copied to clipboard

xdotool type wrong passwords most of the time.

Open nim65s opened this issue 2 years ago β€’ 7 comments

Hi,

When xdotool type my password, the 2 first characters get uppercased, maybe ~75% of the time.

Fidling with XDoToolTyper, I noticed that removing the --delay 0 arguments seems to prevent this: https://github.com/fdw/rofi-rbw/blob/05e1d4d2c7e97cbb328543859ea91a3c478a7495/src/rofi_rbw/typer.py#L54-L55

nim65s avatar Jan 16 '24 14:01 nim65s

--delay affects the time between keystrokes, so I guess when the typer starts you are releasing shift and it's only completely done after the second key was typed?

Removing the delay was added in #52, so I wouldn't want to remove it completely. We could make it configurable, but I'd prefer some solution that works around the problem. A xdotool keyup shift_l beforehand maybe?

fdw avatar Jan 16 '24 16:01 fdw

I should have mention that no, I clearly do not touch the Shift key at all: I run rofi-rbw -t password -a type --typer xdotool in a shell loop, only pressing Enter to select the first entry each time, and looking at the result.

xdotool keyup shift_l doesn't help, nor run(["xdotool", "keyup", "Shift_L", "Shift_R", "Alt_L", "Alt_R"]) before and after the main xdotool command in type_characters().

nim65s avatar Jan 16 '24 17:01 nim65s

Also, I did try with different delay settings, and in my case it looks like the issue is still triggered very often at 5, but I can't reproduce it at 6.

nim65s avatar Jan 16 '24 17:01 nim65s

That helps, thank you very much! πŸ™‚

Can you maybe share some "password" that triggers this for you? Which of the first letters should be capitalized and which should be lower case?

fdw avatar Jan 16 '24 18:01 fdw

Sure, IΒ ran pwgen, and got the first result with lower cases first: nei8daiK. Then, selecting this test one on rofi with for i in (seq 10); rofi-rbw -t password -a type --typer xdotool; end, I get:

nei8daiKNEI8daiKnei8daiKNEI8daiKnei8daiKnei8daiKNEI8daiKNEI8daiKNEI8daiKNEI8daiK

The first is OK, but the second is not.

(this is fish syntax)

nim65s avatar Jan 16 '24 19:01 nim65s

Oh, this might be because there is a digit after the 3 first lowercases (which gets wrongly uppercased sometimes here), and on my keyboard layout, shift is required for digits. After a setxkbmap us, I have a correct 10/10 nei8daiKnei8daiKnei8daiKnei8daiKnei8daiKnei8daiKnei8daiKnei8daiKnei8daiKnei8daiK.

So my usual layout is setxkbmap fr bepo, but setxkbmap fr also trigger the issue.

nim65s avatar Jan 16 '24 19:01 nim65s

Okay, that is interesting. I'm wondering if it's because of the number (but then shift would have to be applied too early) or because of the K at the end. Can you reproduce it without a number, just an upper case letter at the end?

What would your preferred solution be? I think the arguments from #52 are still valid, but rofi-rbw not working is also not acceptable. I'm leaning towards a small delay of 5 or 6, but what do you think?

fdw avatar Jan 17 '24 18:01 fdw

Changing it to 6 seems to have made a difference for me. There are still occasions where I have to retry pasting.

polyzen avatar Feb 13 '24 19:02 polyzen

You have the same problem of xdotool upper casing some characters? Do you also use a non-US keymap?

Does a larger delay than 6 work better for you?

fdw avatar Feb 13 '24 20:02 fdw

You have the same problem of xdotool upper casing some characters? Do you also use a non-US keymap?

Was that the issue? I use a US keymap.

Does a larger delay than 6 work better for you?

Have not tried yet.

polyzen avatar Feb 13 '24 20:02 polyzen

I thought the problem was related to the keymap, like @nim65s wrote:

After a setxkbmap us, I have a correct 10/10

At least, I have no other explanation why xdotool would reproducibly upper case the first letters characters by itself.

However, if you have the same problem, but with a US keymap, it has to be something different πŸ˜•

fdw avatar Feb 14 '24 18:02 fdw

I thought the problem was related to the keymap, like @nim65s wrote:

After a setxkbmap us, I have a correct 10/10

At least, I have no other explanation why xdotool would reproducibly upper case the first letters characters by itself.

However, if you have the same problem, but with a US keymap, it has to be something different πŸ˜•

Could just be human error on my part ┐('~`οΌ›)β”Œ

polyzen avatar Feb 21 '24 20:02 polyzen

Okay, so is the original problem (some letters are upper cased by rofi-rbw) still happening for someone? If so, is a delay of 5 or 6 enough?

Or is there some other solution?

fdw avatar Feb 27 '24 16:02 fdw

IIRC I had tried 5 and found 6 to work better.

polyzen avatar Feb 28 '24 23:02 polyzen

I've pushed something to main where you can define the delay with --typing-key-delay. It's still 0 by default, but you can change it if you experience problems.

Could you please test it and tell me if it works?

fdw avatar Mar 23 '24 18:03 fdw

I just removed the comments of lines "--delay" and "0" on the setup of mine that was having the issue, and I can't reproduce it anymore, so I can't properly test main, sorry. But I think 714e8fc24373e209857f9b0b9361b9bcd74bfdfb is a nice idea, and I will use it if I get this issue again, thanks a lot !

I think we can close this issue, then, unless somebody else currently can reproduce the issue, and report that 714e8fc24373e209857f9b0b9361b9bcd74bfdfb is not working.

nim65s avatar Mar 24 '24 20:03 nim65s