keybinder icon indicating copy to clipboard operation
keybinder copied to clipboard

Gtk4 Support

Open alex-eri opened this issue 1 year ago • 1 comments

Test code

import gi
gi.require_version('Gtk', '4.0')
gi.require_version('Keybinder', '3.0')

from gi.repository import Gtk
from gi.repository import Keybinder

def callback(keystr, user_data):
	print( "Handling", keystr, user_data)
	print( "Event time:", Keybinder.get_current_event_time())
	Gtk.main_quit()

if __name__ == '__main__':
	keystr = "<Ctrl>A"
	Keybinder.init()
	Keybinder.bind(keystr, callback, "Keystring %s (user data)" % keystr)
	print( "Press", keystr, "to handle keybinding and quit")
	Gtk.main()

Exception

/mnt/home/eri/Projects/2024/AIS/kiosk-starter/~/Kiosk/test.py:15: Warning: cannot register existing type 'GdkDisplayManager'
  Keybinder.init()
/mnt/home/eri/Projects/2024/AIS/kiosk-starter/~/Kiosk/test.py:15: Warning: g_once_init_leave: assertion 'result != 0' failed
  Keybinder.init()
/mnt/home/eri/Projects/2024/AIS/kiosk-starter/~/Kiosk/test.py:15: Warning: g_object_new_with_properties: assertion 'G_TYPE_IS_OBJECT (object_type)' failed
  Keybinder.init()

Python 3.10 Ubuntu 22.04 libgtk-4-1 ver 4.6.9 libgtk-3-0 ver 3.24.33

alex-eri avatar Jan 24 '24 12:01 alex-eri

You can't load both Gtk3 and Gtk4 in the same process, so of course this will fail.

You have to modify keybinder to build against gtk4 if you want to test it: https://github.com/kupferlauncher/keybinder/blob/master/configure.ac#L61-L62

TingPing avatar Jan 24 '24 13:01 TingPing