1

I tried using the xdotool commandline on a Chrome window in Debian, typically by doing:

sleep 2 && xdotool type "2"
# Switch to the Chrome window and focus on the relevant text field
# before the 2 seconds timer above runs out; "2" should be auto-written.

This mostly works, except in certain fields that do special event handling. A good example for this is the Google Search timer:

  • Doing the procedure above to write 2 in the Google Search bar works, but
  • When I search "timer" on google.com, I get the special timer answer, which contains a special field allowing users to change the timer values (numbers only). timer field on google Search While typing "2" with my regular keyboard works just fine, using xdotool as above (which should use XTEST) does not work (nothing happens). Sending Tab instead of 2 does work though (the field loses focus).

Note: I noticed that this happened on other number fields as well, all of which have the same other specificity that they do not work with e.g. the French AZERTY keyboard layout that requires pressing Shift to get numbers. I thus tried "xdotool key 2" in US layout and also "xdotool key shift+2" in FR layout, none of which worked.

UPDATE: I tried on 3 laptops:

  1. Google Chrome on Debian, FR layout by default,
  2. Firefox on Ubuntu, FR layout by default,
  3. Firefox on Ubuntu, US layout by default (no other layout ever used)

and the bug reproduces on 1. and 2. but not 3., thus suggesting that even when I switch the layout back to US in 1. and 2., the default layout or keyboard configuration still messes up with xdotool's ability to simulate text being typed.

3
  • 1
    FWIW, it works fine for me with both firefox and chromium (I didn't try google chrome) on Ubuntu 19.10 and a UK keyboard Commented Feb 19, 2020 at 20:53
  • I just tried and reproduced the same behavior on another laptop running Firefox 73.0 (64-bit) in Ubuntu 18.04.4 LTS. I doubt it, since I did try and change the keyboard layout to US, but could that be related to my default layout being FR?
    – cymbaz
    Commented Feb 20, 2020 at 4:18
  • Oh that might indeed be it; I just tried on Firefox with yet another Ubuntu laptop - which has always been US layout this time - and it worked just fine.
    – cymbaz
    Commented Feb 20, 2020 at 4:44

1 Answer 1

0

While changing the current keyboard layout doesn't solve the issue, changing the default keyboard layout to US does solve it. This doesn't look like it's WAI, but I'll still mark this question as solved given this workaround.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .