-
Notifications
You must be signed in to change notification settings - Fork 323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
xdotool is changing letters #97
Comments
Just to add:
This is likely how gconv works with the locale but I have no idea personally. |
seems xdotool reacts differently depending on keymap used.
|
But still fails with
|
I just noticed this too. It makes xdotool useless since I’m using it to type the name of a directory which of course does not exist in the lower case form. Is there any way around this? |
use : |
That doesn't help. |
Result is different and surprising here on Ubuntu 16.04 AMD64, keyboard layout "fr".
So, |
Just to add to this, even just running |
@Anachron No it really doesn't. This has even been suggested in this thread before, see #97 (comment) The test case of |
Confirming that xdotool result depends upon X keyboard layout as set by setxkbmap. |
Indeed
|
sigh. No, running just setxkbmap is not enough, as @Earnestly proved above. It will fix some cases, but not all. The only way to properly fix this, is by setting your actual keyboard layout with setxkbmap. |
@carnager What you write suggest (I might be wrong) that you have a clear understanding of what happens, which I clearly do not have. If anyone can write a summary, like:
PS: I'm not affected by the bug, just trying to put two cents of method. :-) |
@carnager Sadly no, not even setting your actual layout will fix it. The test case I've posted multiple times seems to be ignored. |
This is a long standing issue in xdotool, and I don’t know if anyone has a
solution yet. Sorry. I hope we find a solution — as the maintainer I would
love to see this bug resolved if we can find a way!
…On Sun, Mar 25, 2018 at 4:09 AM Earnestly ***@***.***> wrote:
@carnager <https://github.com/carnager> Sadly no, not even setting your
actual layout will fix it. The test case I've posted multiple times seems
to be ignored.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#97 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAIC6ghJZRAWj2Vm6ipQ1OD8nR9xHYReks5th3rWgaJpZM4HJEJO>
.
|
actually I believe this to be a XTEST bug. I tested all available alternatives back then and each had the same issue, so I don't think xdotool can do much about that. |
@carnager My hunch was more around how a client (xdotool) can query xkbcommon and the older XGetKeyboardMapping. Given users are typing correctly with their keyboard in their preferred locale, and given this problem is often resolved for xdotool by using |
The problem isn't resolved by setting |
@Earnestly - This problem of xdotool changing upper case Unicode characters to lower case has been a pain point for me for years, but I finally found a workaround. First I tried xvkbd and pynput, but both of them disappointed (xvkbd sends a different character altogether, while pynput works with lower codepoint characters only). I found xclip to be an acceptable workaround:
Running the above puts the string in X's primary clipboard (clarification here), then pastes the clipboard contents at the cursor. It results in the correct string: àáâãäçèéêëìíîïñòóôõöùúûüýÿÀÁÂÃÄÇÈÉÊËÌÍÎÏÑÒÓÔÕÖÙÚÛÜÝ Limitation of this workaround is that the mouse pointer needs to be inside the window (and, if in a GUI text editor, below the line) where user is typing. If someone has a cleaner workaround for entering Unicode characters (with correct case) into an X application via a script, please let me know. |
The even bigger limitation is that the application needs to support middle mouse click (think terminals with ncurses input dialog (which often needs the Shift key in addition) |
True, but this is the most "universal" solution I've been able to cook up with my limited knowledge of X. If I go with the xclip approach, we have primary (selection/middle mouse click), "clipboard" (MS-style), and secondary clipboards to work with. Does one of them have a truly universal way of pasting--preferably one that does so at cursor location instead of pointer location? "Clipboard" requires Control+v in some places and Shift+Control+v in others, so no-go. Secondary clipboard seems very hard to paste from unless I'm missing something. |
Nope, there is no universal solution. It all depends on the toolkit and implementation of the individual applications. |
Pity, but good to know. At least I won't chase my tail looking for a better clipboard-based workaround. |
I couldn't help myself and improved my workaround, anyway. All but one GUI application I tested accepted Control+v to paste from clipboard (mate-terminal is the one that didn't, but could be configured to accept it). So while this new version of the workaround may not be actually universal, it is nearly so--and the user does not have to worry about mouse pointer location because paste occurs at the cursor position:
|
Shift-insert is also what I use for pasting —
https://github.com/jordansissel/keynav/blob/master/keynavrc#L96
…On Fri, Mar 22, 2019 at 11:16 AM bdantas ***@***.***> wrote:
I couldn't help myself and improved it, anyway. All GUI apps I tested
accepted Shift+Insert to paste from clipboard. This workaround may not be
any more universal, but user does not need to worry about cursor location:
xclip -o -selection clipboard | xclip -selection secondary # save clipboard contents
printf 'àáâãäçèéêëìíîïñòóôõöùúûüýÿÀÁÂÃÄÇÈÉÊËÌÍÎÏÑÒÓÔÕÖÙÚÛÜÝ' | xclip -selection clipboard # put unicode characters in clipboard
xdotool key Shift+Insert # paste from clipboard
xclip -o -selection secondary | xclip -selection clipboard # restore clipboard contents
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#97 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAIC6hh8hp19ObwtcSDjZOF24zb0Wwtcks5vZR37gaJpZM4HJEJO>
.
|
Hi, I don't really know if it's the same issue but mine lead me here, and reading the discussion got me to a workaround (and maybe a solution ?). First observation is that the example from @Earnestly will behave differently if you hold the shift key:
so it seems that xdotool print accentuated letters based on the state of the shift key. Since I needed to make xdotool print only one letter in my script, I checked before hand the case I needed and set the shift key state accordingly:
|
also these four tests are interesting:
From those, I get that capitalized ascii letter 'protect' letters to their right from the effect of the shift key.
I don't know if the behavior for simple ascii characters is intended to be like that with the shift key but to get a similar behavior with accentuated characters, xdotool would only need to correctly detect the case of such characters. |
Not sure if this helps, Titouan, but you can try the --clearmodifiers flag
which will tell xdotool to clear any currently-held modifier keys like
shift/control/alt while it types.
…On Thu, May 21, 2020 at 10:45 AM Titouan Teyssier ***@***.***> wrote:
also these four tests are interesting:
$ xdotool type 'aàÀ'
aàà # no shift
AÀÀ # shift
$ xdotool type 'AàÀ'
Aàà # no shift
Aàà # shift
$ xdotool type 'àÀa'
ààa # no shift
ÀÀA # shift
$ xdotool type 'àÀA'
ààA # no shift
ÀÀA # shift
From those, I get that capitalized ascii letter 'protect' letters to their
right from the effect of the shift key.
See the next example to show that point:
$ xdotool type 'aAaàÀ'
aAaàà # no shift
AAaàà # shift
I don't know if the behavior for simple ascci characters is intended to be
like that with the shift key but to get a similar behavior with accentuated
characters, xdotool would only need to correctly detect the case of such
characters.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#97 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABAF2W75FJLXVGV6OET7LDRSVSCBANCNFSM4BZEIJHA>
.
|
Thanks @jordansissel but in this case it doesn't help to output capitalized accentuated characters. |
The bug is caused by the behavior of X:
Because xdotool always find a completely-empty key code for the scratch space, the bug will always happen for single characters not already present in the keyboard mapping with "both lowercase and uppercase forms". However, because xdotool only uses keysyms either in 0-0xff or those >= 0x01000000 (for Unicode characters), only the uppercase characters in ASCII range will cause the error. The ranges in the patch covers all the uppercase characters in 0-0xff, so it should be good, except in the corner case that some uppercase character is already defined but in the lowercase range.
outputs |
Trying to make sense of all this in layman's terms. Experiments after JuanPotato's patch #283.Tried current xdotool master. TL;DR: Ran cases mentioned above, they work here after running Before
|
See this comment for an in depth explanation of the issue: jordansissel/xdotool#97 (comment)
Same thing without xdotool piped to another application:
xdotool version:
The text was updated successfully, but these errors were encountered: