Table of Contents

Ubuntu - Mouse - Mouse shortcuts with xbindkeys - Emulate key presses

Emulate CTRL+F8

xte 'keydown Control_L' 'key F8' 'keyup Control_L'

NOTE: Control_R could be used instead of Control_L.


Associate an Emulation with a Mouse Click

Add the following to the $HOME/.xbindkeysrc file.

$HOME/.xbindkeysrc
"xte 'keydown Control_L' 'key F8' 'keyup Control_L'"
b:8

NOTE: There are some differences here than above.

  • The first line is within double quotes, which is mandatory.
  • The second line refers to a mouse button, in this case button 8.

Enhanced Options

$HOME/.xbindkeysrc
# History Back & Forward.
"xte 'keydown Alt_L' 'key Left' 'keyup Alt_L' "
  b:6 + Release
 
"xte 'keydown Alt_L' 'key Right' 'keyup Alt_L' "
  b:7 + Release
 
# Page down.
"xte 'key Next' "
  b:8
 
# Page up.
"xte 'key Prior' "
  b:9
 
# Open links in new tab.
"xte 'keydown Control_L' 'mouseclick 1' 'keyup Control_L' "

NOTE: A list of modifiers is used here.

List of modifier:

  • Release, Control, Shift, Mod1 (Alt), Mod2 (NumLock),
  • Mod3 (CapsLock), Mod4, Mod5 (Scroll).
  • The release modifier is used to catch release events instead of press events.
  • By default, xbindkeys ignores NumLock, CapsLock and ScrollLock.

Restart xbindkeys

If any changes are made to the config file then xbindkeys needs to be restarted:

killall xbindkeys
xbindkeys