Assigning actions to mouse buttons

Asked by Ari

I was thinking of assigning the "previous" and "next" buttons on my mouse to "jump backward" and "jump forward", but I wasn't able to find any documentation regarding this.

Is it possible to assign actions to mouse buttons? If so, what button descriptors do I have to use? Do the key sequences reported by `xev` work (e.g. in this case 'button8' and ''button9')?

Thanks a lot in advance.

Question information

English Edit question
qpdfview Edit question
No assignee Edit question
Solved by:
Adam Reichold
Last query:
Last reply:
Revision history for this message
Adam Reichold (adamreichold) said :

Hello Ari,

AFAIK, the actions system of Qt that we use of the various operations in the UI and its shortcuts mechanism does only operate with keyboard events. So I think you the best approach ATM would be to use helper programs like "btnx" or "xdotool" to turn the mouse button events into the corresponding keyboard events to trigger the actions you are interested in.

Best regards, Adam.

Revision history for this message
Best Adam Reichold (adamreichold) said :

Hello again,

looking this up again, Qt defines platform-independent "forward" and "back" mouse buttons, so I think this might be generic enough to warrant hard-coded inclusion into the code base. Could you try if trunk revision 1769 works as intended? (I cannot properly test this for a lack of mouse buttons and "xdotool" seems to be able to simulate only those buttons that are actually configured by the X pointer device driver.)

Best regards, Adam.

Revision history for this message
Ari (ari-lp) said :

Hi Adam,

the mouse navigation is working perfectly on my end. Thanks a lot for getting this in right away!


Revision history for this message
Ari (ari-lp) said :

Thanks Adam Reichold, that solved my question.