6

I like to trigger an AutoKey script by pressing middle mouse (restricted to a certain application via window filter). Unfortunately AutoKey only lets me set keyboard short-cuts while mouse buttons are completely ignored. It seems AutoKey does not at all allow mouse buttons as triggers. (See selection screen below.)

Is there any workaround that lets me run an AutoKey script via pressing a mouse button?

enter image description here

pykong
  • 231
  • 1
  • 11

2 Answers2

1

Take a look at xbindkeys. I use it to make single modifier keys to hotkeys (such as RCtrl), but I read it is also capable of using mouse buttons as trigger. https://www.linux.com/news/start-programs-pro-xbindkeys

Then you can assign a command like "bash -c 'xdotool key Ctrl+Shift+Super+Alt+1'" to the mouse button, and make a Hotkey-Script in Autokey waiting for this combination.

Theo
  • 26
  • 1
0

What Theo said will work, it might also be possible to use xev to get the scan code that the middle mouse click produces, and use that somewhat like he suggested above.

xev comes with every XFree86 distribution and is used to get your keyboard or mouse scancodes.

The default install location of this program is in /usr/X11R6/bin/xev. When you run this program you'll be looking at a white window with a black square in the middle. This program is used to record X11 Events such as mouse clicks, keyboard keys, etc.

Note that using xev is similar to playing an arcade game, expect it to take quite a few attempts to get the info you want--especially on a really fast computer.

I really wanted to post the output examples of the xev command and a lot of basic information about scancodes, Xmodmap, the XKeysymDB file and key press events--but the text box software would not let me do it.

Apparently it thought it was code instead of program output and said it had to be formatted with 4 spaces in front of the code--but since it wasn't code, neither of their "fix the problem" methods worked. I tried the Code link at the top of the edit box and Ctrl+K.

Sorry about that, it would have helped you lot. Next time I post I will stick to simple words and short explanations--it was entirely to time consuming and too much trouble trying to post my information.