Ghidra: Allow Mouse Button binds in Tool Options

Created on 15 Mar 2019  路  4Comments  路  Source: NationalSecurityAgency/ghidra

Is your feature request related to a problem? Please describe.
I like to go forward and back with the forward/back mouse buttons.

Describe the solution you'd like
To be able to bind mouse buttons in the keybinding section

Enhancement wont fix

Most helpful comment

Particularly "Go to previous location" and "Go to next location" would be hot candidates to be configured in that dialog, so I can put them on my thumb buttons on the mouse (as other applications such as Web browsers or Visual Studio recognize as Back/Forward).

All 4 comments

Hey @LWSS ,

You can create keybindings by creating a new object that implements DockingAction, for example, NavigatableContextAction.

then set key binding to it

// Mouse Left: BUTTON1_DOWN_MASK 
// Mouse Right: BUTTON3_DOWN_MASK 
action.setKeyBindingData(new KeyBindingData(InputEvent.BUTTON1_DOWN_MASK, 0)));

and then add it to your existing PluginTool. Hope that helps.

What I mean is to change the dialog in Edit->Tool Options->Key Bindings so that it recognizes mouse buttons.

Particularly "Go to previous location" and "Go to next location" would be hot candidates to be configured in that dialog, so I can put them on my thumb buttons on the mouse (as other applications such as Web browsers or Visual Studio recognize as Back/Forward).

Java does not make application-level mouse handling easy. This is too much effort for us to do right now, considering the given demand. If there is much excitement for this in the future, then we can revisit this request.

For now, I am attaching a Ghidra Script that should provide the functionality you desire. The script will use a known Java testing mechanism to install a global mouse listener. When triggered, the listener will execute the back or forward button, depending on the mouse button pressed. You may have to modify this script to get it to work with your hardware.

The downside to this script is that it must be run each time you start Ghidra.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mumbel picture mumbel  路  29Comments

SocraticBliss picture SocraticBliss  路  26Comments

dalvarezperez picture dalvarezperez  路  19Comments

cattrace picture cattrace  路  20Comments

astrelsky picture astrelsky  路  21Comments