Add to Shortcut menu with custom plugin

Discussion about CodeLite development process and patches
User avatar
caibbor
CodeLite Veteran
Posts: 78
Joined: Thu Jan 10, 2013 10:37 pm
Genuine User: Yes
IDE Question: c++
Contact:

Add to Shortcut menu with custom plugin

Post by caibbor »

I'm not sure where else to post this, so this section seems appropriate.

I've just finished making a plugin for CodeLite and I'm trying to figure out how to make a shortcut for it. I've searched the source for terms like "shortcut" and the plugins code doesn't even seem to do anything special. my plugin doesn't just show up in the keyboard shortcuts dialog automatically, so I'm not sure what to do.
User avatar
caibbor
CodeLite Veteran
Posts: 78
Joined: Thu Jan 10, 2013 10:37 pm
Genuine User: Yes
IDE Question: c++
Contact:

Re: Add to Shortcut menu with custom plugin

Post by caibbor »

after some more digging, it turns out keyboard shortcuts in CodeLite are called "Accelerators"

and they're stored in ~/.config/accelerators.conf

Adding a line is done manually, and manually only, I guess. doing so works.
User avatar
eranif
CodeLite Plugin
Posts: 6372
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Add to Shortcut menu with custom plugin

Post by eranif »

caibbor wrote:after some more digging, it turns out keyboard shortcuts in CodeLite are called "Accelerators"

and they're stored in ~/.config/accelerators.conf

Adding a line is done manually, and manually only, I guess. doing so works.

This is not the correct place for doing this. As this is a user settings which codelite writes into it
Note that overriding your change can easily be done from the UI by clicking on:
Settings -> Keyboard Shortcuts -> Defaults button

The correct way of this it is by making a new file named:

Code: Select all

<my-plugin>.accelerators


and place it under (Linux):

Code: Select all

/usr/lib/codelite/resources/
And in Windows it should be placed under:

Code: Select all

CODELITE_INSTALL_DIRECTORY\Plugins\resources
When codelite starts up, it will load this file along with other 'accelerators' files from that directory
Eran
Make sure you have read the HOW TO POST thread
Post Reply