Keyboard/accelerator input in GTK3

I’m writing an application in which I want the user to be able to choose their own keybinds for certain actions. I couldn’t find anything in the documentation or elsewhere about how I would do this. Is there a widget I can use for this or do I have to write it from scratch? I’m thinking of a button that you click and them you press the desired keybind and it gets captured.

Not sure about GTK3, you shouldn’t be using it anymore. But for GTK4 I answered this question here.

Thank you for your response, but that doesn’t really help me.

you shouldn’t be using it anymore

With all due respect, I’ll make that call myself when the tooling is mature enough. Cambalache is not quite ready, and I like Glade.

All I’m saying is that the clock is ticking, I hope someone knows the GTK3 behavior.

I took a peek at the Cinnamon settings source code. It appears to capture the keyboard and then use translate_keyboard_state on the keyup event.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.