This article is based on the public release of Ghidra 11.0.1.
Customising Ghidra to make it fit your workflow is a lot easier than one might assume! Ghidra scripts extend the framework to perform specific actions. The automation can be done for a variety of reasons: to avoid repetitive (manual) actions, to search for a given pattern, or for any other given reason. This tip focuses on adding hotkeys to Ghidra scripts, be it self written or stock scripts.
Within the Script Manager in the Code Browser, one can find scripts which have hotkeys by default, as can be seen in the image below.
When viewing the script’s source, one can find annotation at the top. Changing the hotkey in the script and saving it, will change the hotkey within Ghidra. These aren’t used within the code itself, but rather by Ghidra to obtain the optional description, hotkey, category, and menu path.
The hotkey matches the one shown in the screenshot from the Script Manager. One can also add a hotkey to a script without modifying the script itself. Within the Script Manager, upon selecting a given script, one can press the key icon to open a window, where a custom hotkey can be added or changed if a script already has one.
The window which will then open, allows you to press a combination of hotkeys, based on your preference.
Once satisfied with the hotkey, press OK to save it. If a hotkey is used for multiple things, Ghidra will ask you which action it should perform. By changing either (or both, if desired) hotkeys, the overlap is resolved.
To contact me, you can e-mail me at [info][at][maxkersten][dot][nl], or DM me on Twitter @Libranalysis.