Xbindkeys won't work properly

As documented in similar questions (Why do these xte commands work in terminal, but not when bound with xbindkeys?), you can ask xbindkeys to trigger events on release (on key up):

"xdotool key braceleft"
   Release+Control+Alt + 7

In this way, there is no conflict between the keys used for the shortcut and those sent.


The problem with xdotool is while real keys are pressed Xorg repeatedly sends keypress events (look at xev output). To overcome this you need to temporarily turn off repeat feature, then generate KeyRelease event on key that were down.

Instead of

"sleep 0.2 && xdotool type --delay 15 '{'"
  Control+Alt + 7

try the following:

"xset r off; xdotool keyup --window 0 7 type --clearmodifiers --window 0 '{'; xset r on"
  Control+Alt + 7

As I tried another several things, i noticed that xdotool seems to trigger too soon. I altered the config like this:

"sleep 1 && xdotool type --delay 15 '{'"
Control+Alt + 7

NOW it sends the correct { sign to the active window. Now the only thing left is to reduce the sleep and delay to a workable value, because 1 second seems a bit too long :)

** Addition Info ** Well, now I managed to find suitable values. HOWEVER this only works if you release the keys until the sleep duration is over. If you are too slow if won't work.

This is my current config for all unconvenient german AltGr characters

"sleep 0.2 && xdotool type --delay 15 '{'"
Control+Alt + 7

"sleep 0.2 && xdotool key --delay 15 at"
Control+Alt + q

"sleep 0.2 && xdotool type --delay 15 '€'"
Control+Alt + e

"sleep 0.2 && xdotool type --delay 15 '['"
Control+Alt + 8

"sleep 0.2 && xdotool type --delay 15 ']'"
Control+Alt + 9

"sleep 0.2 && xdotool type --delay 15 '}'"
Control+Alt + 0

"sleep 0.2 && xdotool type --delay 15 '~'"
Control+Alt + plus

However if you want to type multiple @ signs (for example) you have to press Ctrl+Alt+Q as intended, but release all keys and then press it again. This, however is much, much better than not having the option Control+Alt instead of AltGr but it is not that effective as I was used too. Maybe I will find a solution for this too.