0

I've got a Russian keyboard layout. This one doesn't have the acute sign which is used for stress mark in academic field.

I can do that by hand. After a character, for example, и:

ctrl+shift+u 301 space --> и́

I'm trying to use xdotool to make a shortcut to insert this stress:

I've already tried to use the same solution in How to make xdotool type Unicode characters, but for some reason, the acute sign is special (it's not a character by itself, it's adding itself to the previous one) and it's not working.

So, I want xdotool to type for me all the sequence ctrl+shift+u 301 space that I'm typing by hand.

What I've done is now:

sleep 0.2 &&
  xdotool key --delay 15 'ctrl+shift+u' &&
  sleep 0.2 &&
  xdotool type 301 &&
  xdotool key space

But when doing that, xdotool stops at "U", waiting for me to fill in the number

wjandrea
  • 14,504
ThePhi
  • 295

2 Answers2

2

U+301 is the combining acute accent (that is, it gets added onto the previous character). You want the non-combining acute accent, U+B4:

xdotool key UB4

There's also a sub-optimal solution, which is to have xdotool send the combining acute accent and a space, but it only renders properly in some programs:

xdotool key U301 space

Also, beside the point, but your code worked perfectly fine on my machine. I'm not sure why it didn't on yours.

wjandrea
  • 14,504
0

These are old questions but I'll share my experience in case it helps someone.

I found that the xdotool solutions were unreliable, and because its driving a C library that is ASCII only there were limited options for solving the problem.

In the end I used Linuxes ability to display and store unicode characters to store them on the clipboard. Xdotool is used to paste them into the active window. So the code is:

echo 'λ' | xclip -selection clipboard;  # save unicode char(s) on clipboard
sleep 0.5; 
xdotool key 'ctrl+shift+v';  # paste to active window
sleep 0.3;  
xdotool key ctrl+h  # backspace because I was getting an extra linefeed

I checked with xsel --clipboard and it also worked.

John 9631
  • 877