I created a Gedit 2 plugin which adds an item to a menu as described here. How could I bind a keyboard shortcut / accel key / accelerator key to this menu item?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Following the given tutorial, your plugin have some lines like the ones below somewhere:
Just replace the second
Noneargument inby your desired keyboard shortcut – let us say, ControlR:
You may have used a manually constructed action as well (this is at least my favorite way of working with it):
In this case, just replace
action_group.add_action()byaction_group.add_action_with_accel():(Asked and aswered by myself because of this and this; I lost some real time looking for it and I thought it will be a good reference.)