Closed QiangF closed 6 years ago
It's worth investigating whether it's because the string is not copied to clipboard, or the action of sending fake key failed. Actually we can use XELB to access clipboard directly.
The string is copied to clipboard, the paste key works. It will be cool if the sending paste key step can be bypassed. That is the key step for using emacs for text editing everywhere.
Many users need to send unicode code characters, so the author of the original function uses the clipboard.
The original discussion is at https://github.com/ch11ng/exwm/issues/258
Maybe it's a security feature of Chrome?
Fake key also doesn't work for Chromium. Isn't all keyboard input filtered by the window manager?
Fake key works, or simulation key won't. Perhaps Chromium has some restriction on clipboard.
"C-v" (typed on keyboard) does paste the clipboard into the input field.
I tried xdotool, it work sometimes.
(defun mysend ()
(interactive)
(start-process-shell-command "xdo" nil "xdotool key ctrl+v")
)
OK this one works 100% of the times.
(defun mysend ()
(interactive)
(start-process-shell-command "slock" nil "xdotool key --delay 40 ctrl+v")
)
Also some reference for simulating hardware keypress
https://github.com/boppreh/keyboard
https://vizible.wordpress.com/2009/08/15/linux-how-to-simulate-key-press/
Also stumpwm can send unicode! See https://gist.github.com/ahungry/d8be8dca688aae05824ddee4122e90cd
Both xdotool and the CLX code use the XTEST extension which is also available in XELB. But I highly doubt the possibility to send every unicode directly with XTEST.
The idea is to send a string to chrome's text input area with a command (exwmx-sendstring--send). It works very well for all other applications but google chrome. See https://github.com/tumashu/exwm-x/issues/8