How to emulate the mouse mid-click with a keystroke?

Snap

I got a nice Logitech M600 mouse. Kinda pad meets a mouse. Great for aleviating hand straining. Lovely in that respect but it has no mid button. I want to use a keystroke to replace that missing button. All the guides I've found start by finding the code for that mid click with xev or whatever... but i don't have that button to beggin with. Any ideas?


misko_2083

You could bind some key or key combination with
xdotool click 2
Need to install Xbindkeys
sudo apt-get install xbindkeys
Now create a sample file
xbindkeys -d > ~/.xbindkeysrc
There are some good examples in that file
Edit the file
medit ~/.xbindkeysrc
add next
"xdotool click 2"
   F12

Start xbindkeys
xbindkeys &
Now test with F12

You can set some other key or key combo.
xbindkeys -k
A blank window will pop up. Press the key(s) to which you wish to assign a command and xbindkeys will output a handy snippet that can be entered into ~/.xbindkeysrc
Then edit the ~/.xbindkeysrc accordingly.
Now restart the xbinkeys daemon.
killall xbindkeys
xbindkeys -f ~/.xbindkeysrc


in case it doesn't work use -n to see why
xbindkeys -n

Remember to add "xbindkeys &" to your autostart.sh so it always runs when you start up.

You can also assign scroll up and down.
xdotool click 4
xdotool click 5
Scrolls just a bit but you could add a few clicks in the command
xdotool click 4 click 4 click 4 click4

Snap

Thanks, guys. I was trying xbindkeys without success. For some reason it doesn't work. I was using xte instead of xdotool

#Fake mid-click
"xte 'mouseclick 2'"
    m:0x5 + c:94
    Control+Shift + less


Gotta try xdotool instead, but it seems xbindkeys is not working. I've tried other things to test it and none worked.

@hackerdefo. The dependencies seem a lot at first instance, but checked it and only pulls two extra libs to the party. The rest are already in. So good to go. You know, I try to keep my system small and clean. Not for the size/bloat itself. I've learned (specially from Vsido) that simple systems have less chances to break, and if they break they are easier to fix.

Snap

Yup, not working.
xbindkeys -n

*** Warning ***
Please verify that there is not another program running
which captures one of the keys captured by xbindkeys.
It seems that there is a conflict, and xbindkeys can't
grab all the keys defined in its configuration file.


Need to find out the conflict. No idea of what it can be.

Tried gpointing-device-settings too... don't want that sucker.

misko_2083

Quote from: Snap on September 23, 2015, 07:54:55 PM
Yup, not working.
xbindkeys -n

*** Warning ***
Please verify that there is not another program running
which captures one of the keys captured by xbindkeys.
It seems that there is a conflict, and xbindkeys can't
grab all the keys defined in its configuration file.


Need to find out the conflict. No idea of what it can be.
Try some other key combo.
Setting F12 works for me.