I am running Ubuntu 18.04.2 and I want to assign a cstom action to middle click of my mouse. How that can be done? for example libinput-gestures (https://github.com/bulletmark/libinput-gestures) allows you to set custom actions to your trackpad gestures. Is there something like that for mouse also?

  • 1
    What exactly you want to do with middle mouse button? it will give you quick answers.. – UnKNOWn Aug 21 '19 at 4:26
  • middle click to show all windows or middle click simulates some key press like super (windows key). – dishendra mishra Aug 21 '19 at 5:43
  • If by any chance you're using a Corsair mouse, then you can use this Linux driver: github.com/ckb-next/ckb-next – Cynicus Rex Aug 21 '19 at 7:33
  • I found easystroke the most suitable for the purpose. sudo apt install easystoke – dishendra mishra Feb 13 '20 at 5:08

you can do that with two packages installed..

xbindkeys and xdotool

  1. sudo apt install xbindkeys
  2. sudo apt install xdotool

create a file name .xbindkeysrc in your home folder

  1. touch /home/user/.xbindkeysrc

  2. gedit /home/user/.xbindkesyrc

  3. paste the below content


"xdotool sleep 0.5 key Super_L"
  1. run xbindkeys -p

Please note that when you click mouse middle button which is b:2 It will simulate key press of Super_L only for once.. again if you press b:2 It don't do anything as opposed to pressing Super_L


pratap@i7-4770:~$ touch /home/pratap/.xbindkeysrc
pratap@i7-4770:~$ gedit .xbindkeysrc
pratap@i7-4770:~$ xbindkeys -p

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.