The shortcut code would look something like this:
    enum
    {
        KB_PLUGIN,
        KB_GROUP
    };
...
    key_group = plugin_set_key_group(geany_plugin, "plugin_name_keyboard_shortcut", KB_GROUP, NULL);
    keybindings_set_item(key_group, KB_PLUGIN, shortcut_callback, 0, 0,
        "plugin_name", _("Shortcut Name"), NULL);

Here is a simple plugin that uses that structure:
    https://github.com/sblatnick/geany-plugins/blob/quick-search/quick-search/src/quick-search.c
Here is another plugin that allows dynamically adding shortcuts (as opposed to a fixed number):
    https://github.com/sblatnick/geany-plugins/blob/external-tools/external-tools/src/tool.c line 64

I hope this helps,

Steve

On 03/25/2014 05:12 PM, Lex Trotman wrote:
On 26 March 2014 09:33, Shankhoneer Chakrovarty <shankhoneer@gmail.com> wrote:
Hi,

'shiftcolumn' is one of the orphaned plugin which I have decided to work on.
shiftcolumn's default shortcut key to move the selected text to right is
<Primary>0 which conflicts with "Zoom reset", making the plugin useless to
move the text right unless for every move the user clicks Tools->Shift
Right. Shift left is done by <Primary>9 key which is working fine.

Also, this plugin doesnt have its plugin preferences dialog box.

I was planning to change the default shortcut key for the aforementioned
behavior of the plugin to <Primary>8 which AFAIK doesnt conflict with
anything.

Do you guys think its a good idea? What should I do to prevent such problems
to arise in future?
It is actually preferable that plugins do not have default keybindings.

It is not known what combination plugins will be loaded and so it is
not known what combination of keybindings might clash, and it is not
known what keybindings a user might define themselves that can clash.

So I would recommend that default keybindings be removed from plugins.

Cheers
Lex

Thanks,
Shankhoneer Chakrovarty

_______________________________________________
Devel mailing list
Devel@lists.geany.org
https://lists.geany.org/cgi-bin/mailman/listinfo/devel

_______________________________________________
Devel mailing list
Devel@lists.geany.org
https://lists.geany.org/cgi-bin/mailman/listinfo/devel