charpicker
charpicker copied to clipboard
Some characters are corrupted (with possible fix)
The selected unicode character is inserted using xdotool, but xdotool may corrupt some characters (this is ackowledged in its man page, see BUGS section). I also tried xte, from the xautomation package. No more corruption, but then xte silently fails if the Unicode character is not part of the current keymap... In the end I found this trick that works for me (so far):
echo -n "$selected_symbol" | xclip -i
xdotool click 2
The first line put the selected Unicode character in the primary selection clipboard using xclip. The second line insert a middle click, pasting the selection in the current window. This way the complexity of going from a character to X keyboard events is not needed, it's just like a cut and paste.
This works on X11, not tested under Wayland (is middle click paste supported now?). So it may be X11 only, TBC.