Add to Shortcut menu with custom plugin

Discussion about CodeLite development process and patches
User avatar
caibbor
CodeLite Veteran
Posts: 76
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 » Mon Jan 21, 2013 7:10 am

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.
Anal retentive C++98/11 programmer and game developer.

User avatar
caibbor
CodeLite Veteran
Posts: 76
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 » Tue Jan 22, 2013 11:54 am

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.
Anal retentive C++98/11 programmer and game developer.

User avatar
eranif
CodeLite Plugin
Posts: 5848
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 » Tue Jan 22, 2013 12:59 pm

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