Re: how to catch keystroke in clipman menu?
Gaël Bonithon <[email protected]>
| Newsgroups | gmane.comp.desktop.xfce.devel.version4 |
|---|---|
| Message-ID | <LNsZ1-Rm3WjNz3xqacrwJiEQMSg7GWDtlRctpknXe7Wo_vH0ITW1ea4rcs-vIgGnr8y--6IwVJrskw3yrDk7zSyxMbnYWjjHn0BwYbhzSq0=@protonmail.com> |
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 <[email protected]> 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 _______________________________________________ Xfce4-dev mailing list [email protected] https://mail.xfce.org/mailman/listinfo/xfce4-dev