2

My middle mouse button (the scroll wheel pressed down), after turning off the gnome-tweak middle click is paste, shows as button 2 in xev:

ButtonPress event, serial 37, synthetic NO, window 0x3400001,
    root 0x4ee, subw 0x0, time 8879244, (79,71), root:(1759,879),
    state 0x10, button 2, same_screen YES

ButtonRelease event, serial 37, synthetic NO, window 0x3400001,
    root 0x4ee, subw 0x0, time 8879452, (79,71), root:(1759,879),
    state 0x210, button 2, same_screen YES

It now functions in browsers to open links in a new tab. I want it to show the desktop.

I installed wmctrl and can show desktop by typing into terminal wmctrl -k on. But I cannot figure out how to associate button 2 with that command.

In Settings > Keyboard > Shortcuts > Custom, adding the command works, but it is not possible to associate it with the button click.

In dconf editor, I tried using xautomation and the command xte 'mouseclick 2', but that didn't work either (nor did button 2 or 'button 2' or button2.

Any idea what the correct binding is for button 2 in dconf editor or how to get the Settings menu to accept it?

1
  • as the question got bumped to community I'm wondering if your question got answered?
    – Eric G
    Sep 10, 2017 at 8:19

1 Answer 1

1

If you didn't already, install xbindkeys:

sudo apt-get install xbindkeys

Then we'll need to find out whats you mouse-button called (usually Button2, but we'll want to be sure). write xev |grep button in terminal. A white window will appear. Do a middle click inside and read the output in terminal, eg:

 state 0x10, button 2, same_screen YES
state 0x210, button 2, same_screen YES

So for me its button 2.

Now write a default xbindkey-file with:

xbindkeys --defaults > $HOME/.xbindkeysrc 

Edit the file with scratch or: nano .xbindkeysrc

Look if there's allready an entry for your middle button, edit it or make a new one as following:

#show desktop
"wmctrl -k on"
   b:2

Save the file. (with nano it's Ctrl+O).

Run xbindkey in terminal. If it's working add xbindkey to your startup-applications.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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