[Geany-Devel] Shortcut to plugin menu
Steven Blatnick
steve8track at xxxxx
Tue Dec 3 16:25:41 UTC 2013
For mapping a keyboard shortcut to an action, look for some code like
this (see my plugin
<https://github.com/sblatnick/geany-plugins/blob/master/quick-line/src/quick-line.c>):
GeanyKeyGroup *key_group;
key_group = plugin_set_key_group(geany_plugin,
"quick_line_keyboard_shortcut", KB_GROUP, NULL);
keybindings_set_item(key_group, KB_QUICK_LINE, quick_line, 0,
0,"quick_line", _("Quick Line..."), NULL);
Each call to keybindings_set_itemadds an entry in the
Preferences->Keybindings for you to map any way that you or others using
your plugin want to.
To open the menu using a keybinding, I would look at manually calling
the appropriate event (perhaps gtk-menu-popup
<https://developer.gnome.org/gtk3/3.4/GtkMenu.html#gtk-menu-popup>) from
within the callback you set up in the keybindings_set_item. In the code
above, quick_line is the callback.
I hope this helps.
Steve
On 12/03/2013 09:10 AM, Francesco OpenCode Apruzzese wrote:
> Yes. Sorry.
>
> I've developed this plugin:
> https://github.com/OpenCode/geany-python-good-code
> I want to call the menu (my menu) "Python Good Code" with a shortcut
> like CTRL+SOME_CHAR or ALT+SOME_CHAR or key like F1-F12
>
> Il 03/12/2013 16:28, Frank Lanitz ha scritto:
>> Am 03.12.2013 15:39, schrieb Francesco OpenCode Apruzzese:
>>> Hi all,
>>>
>>> It's possible to associate a shortcut to a menu item created by a plugin?
>> Yes, it's possible. Can you go a little deeper?
>>
>> Cheers,
>> Frank
>>
>>
>>
>>
>> _______________________________________________
>> Devel mailing list
>> Devel at lists.geany.org
>> https://lists.geany.org/cgi-bin/mailman/listinfo/devel
>
>
>
> _______________________________________________
> Devel mailing list
> Devel at lists.geany.org
> https://lists.geany.org/cgi-bin/mailman/listinfo/devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.geany.org/pipermail/devel/attachments/20131203/690b1deb/attachment.html>
More information about the Devel
mailing list