how to catch keystroke in clipman menu?
Gaël Bonithon
trash.paradise at protonmail.com
Fri Sep 3 10:49:39 CEST 2021
You can just connect `my_keypress_function()` when the menu is shown (GtkWidget's "show" signal), then, when a key is pressed, you look at which key it is, which menu item is active, and act (or not) accordingly.
No need to bother with what you say in the first part, it should work by itself in this case.
Don't forget to disconnect `my_keypress_function()` when the menu disappears though (GtkMenuShell's "selection-done" signal should be fine).
Cheers,
Gaël
‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Thursday, September 2nd, 2021 at 6:20 AM, Sylvain Viart <sylvain at opensource-expert.com> wrote:
> Hi,
>
> I would like to add 2 new key binding in clipman menu, in order to swap Secure Item as Clear Text, and also to delete any them directly from menu hitting del key.
>
> [image.png]
>
> I lack gtk knowledge, what I found is that:
>
> the app seems to do a g_application_register
>
> https://docs.gtk.org/gio/method.Application.register.html
>
> but, I think the sole purpose of this is to avoid duplicate running clipman.
>
> I also found, that I should add a keyboard mask somewhere GDK_KEY_PRESS_MASK
>
> https://stackoverflow.com/questions/44098084/how-do-i-handle-keyboard-events-in-gtk3
>
> may be their in panel_plugin_register() ?
>
> https://gitlab.xfce.org/Sylvain/xfce4-clipman-plugin/-/blob/secure_item_dbus/panel-plugin/main-panel-plugin.c#L71
>
> Then I may be able to add a callback
>
> g_signal_connect (G_OBJECT (window),
>
> "key_press_event"
>
> ,
> G_CALLBACK (my_keypress_function),
>
> NULL
>
> );
>
> to my own keyboard handler, and then dispatch on which keystroke I receive, right?
> What about "activate" callback on enter key, should I call them after I introduce a keyboard handler?
>
> If you have code example, I would love to discover how it works. 😁
>
> Regards,
> Sylvain.
>
> --
> Sylvain Viart - GNU/Linux Sysadmin/Developer/DevOps - France
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.xfce.org/pipermail/xfce4-dev/attachments/20210903/cae9be24/attachment.html>
More information about the Xfce4-dev
mailing list