in reply to X11::GUITest and Umlauts

Confirmed. Not even encoding the keys helps.

BUT, if I change the input method (via Keyboard Layout Handler) for the window started by the script, it starts typing the accented characters instead of normal ones. Not sure whether I can set the input method from within the script, though.

Update: I use LeftShift + RightShift to change the input method. The following worked for me:

PressKey($_), WaitSeconds(0.1) for qw( LSH RSH ); ReleaseKey($_) for qw( LSH RSH ); SendKeys("echo 123\n"); # Sends +ěš instead.

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

Replies are listed 'Best First'.
Re^2: X11::GUITest and Umlauts
by LanX (Saint) on Oct 17, 2025 at 13:28 UTC
    So your theory is that I have to change the Keyboard Language Settings for the receiving window?

    And why does "echo 123\n" result in +ěš ?

    (And did you mean ě instead of š ?)

    Actually X11::GUITest is so unreliable that I will probably resort to shelling out to xte.

    It's also sobering that I can't seem to use all of this with Wayland.

    DISCLAIMER: I have DeskFlow installed, an opensource variant of Synergy to share my keyboard over various machines. Anyway deactivating doesn't make a difference. Though can't rule out that there are side effects.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    see Wikisyntax for the Monastery

      > So your theory is

      Theory? It works for me, it's more than just a theory!

      > why does "echo 123\n" result in +ěš ?

      On the Czech QWERTY keyboard, pressing 123 produces +ěš.

      map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
        > Theory? It works for me

        I was trying to figure out what you mean. s/theory/approach/

        > On the Czech QWERTY keyboard, pressing 123 produces +ěš.

        why "echo"?

        seems like you are simulating the AltGr modifier, there is a syntax with &(.) for that

        perl -MX11::GUITest=:ALL -E'SendKeys(q{&(e)}) or say "FAILED"' €

        unfortunately there is no alternative for umlauts in German keyboard settings and configuring the COMPOSE key doesn't help inside X11::GUITest either.

        perl -MX11::GUITest=:ALL -E'SendKeys(q({CAP " a})) or say "FAILED"' FAILED

        I also briefly tested the output with the xev tool, which shows the failing request

        "   XLookupString gives 1 bytes: (0d) "

        Cheers Rolf
        (addicted to the Perl Programming Language :)
        see Wikisyntax for the Monastery

      It's been years since i used it, but you could potentially use Net::VNC as a workaround for sending key codes.

      There's also the venerable X11::Xlib for a bit of low level access. Function XSendEvent() is potentially what you are looking for to send a XKeyEvent. You might also have to look at load_keymap() to look up how to translate Text strings into key codes, because X11 at this level handles row button presses, not text input.

      PerlMonks XP is useless? Not anymore: XPD - Do more with your PerlMonks XP
      Also check out my sisters artwork and my weekly webcomics
        > workaround for sending key codes.

        Thanks, but as I already said, shelling out to xte from xautomation to send strings does the trick for me.

        Cheers Rolf
        (addicted to the Perl Programming Language :)
        see Wikisyntax for the Monastery

      It's also sobering that I can't seem to use all of this with Wayland.

      Despite all the fanfare, Wayland is really not yet ready for production. I've no doubt that it will get there but that won't be for another few years at the current rate of fixes.

      Stick with X in the meantime - it's had four decades to get things right and at this point is basically rock solid.


      🦛