I have a problem with the Gtk Key Controller in Flatpak. When I ran my built test application that uses GTK and Libadwaita and Gtk Key Controller for keyboard shortcuts, I found that it doesn't work in Flatpak. When I pressed the Ctrl+S keyboard shortcut, it triggered the action. Unfortunately, however, I could not press the Ctrl+Z keyboard shortcut (exit action) while the action was in progress. Natively it works without any problems.
Permissions:
- --socket=wayland
- --socket=fallback-x11
- --talk-name=org.freedesktop.Notifications
- --share=ipc
- --socket=pulseaudio
- --device=dri
Python:
keycont = Gtk.EventControllerKey()
keycont.connect('key-pressed', self.keys, self)
self.add_controller(keycont)
def keys(self, keyval, keycode, state, user_data, win):
if keycode == ord('q'):
win.close()
if keycode == ord('s'):
self.start()
if keycode == ord('z'):
self.stop()
if keycode == ord('h'):
shortcuts_window = ShortcutsWindow(transient_for=app.get_active_window())
shortcuts_window.present()
Do I need to add additional permissions? Does exists another way to use keyboard shortcuts in Gtk apps?
Thanks in advance for your reply.