I'm on Ubuntu 20, Firefox 84.0 (64-bit).
I've been trying to use xbindkeys and xdotool to create custom keyboard shortcuts for special characters like '→' or '«' (in brief, I hate compose key and ctrl+shift+u methods, I have always prefered windowish style shortcuts with alt key and I decided to achieve this on my own).
After a lot of time it works pretty well... Except for Firefox !
Say I want alt+1 to type '«'
Here is my .xbindkeysrc.scm (I use the guile config file rather than the standard .xbindkeysrc file because I have other more complex shortcuts dealing with mouse scroll for volume for example, but it really does the same thing):
(xbindkey '(alt KP_1) "xset r off; xdotool keyup --window 0 KP_1 key --clearmodifiers --window 0 U00AB; xset r on")
(See https://askubuntu.com/questions/455762/xbindkeys-wont-work-properly for more details on why xset r off
and keyup
parts)
This works perfectly fine on my terminal, on a gedit window, on a LibreOffice writer doc... Only Firefox won't type the right sign. Actually, it doesn't type any sign, after a short delay it acts as if I had only pressed the alt key, which shows the menu (File, Edit, ...) on the top of the Firefox window.
Any idea ? :)
EDIT
The problem is not specific to the use of alt key (which is already mapped to some shortcuts in Firefox): changing to control key doesn't change much (does nothing, instead of showing the menu like the alt key)
It is actually possible to send xdotool events to Firefox. I got Firefox window's id (here, 37749011), and then tried manually on the terminal:
xdotool windowfocus --sync 37749011 key --clearmodifiers --window 0 U00AB
which correctly typed '«'. But still does not work when I try keyboard shortcut