sde1000 / python-xkbcommon

Python bindings for libxkbcommon using cffi
MIT License
19 stars 5 forks source link

setting up keyboard state from X11 #14

Open pfps opened 2 years ago

pfps commented 2 years ago

How can I use this library to set up the keyboard state under X11. The X11 interface methods do not appear to be implemented.

The regular documentation for libxkbcommon says:

#include <xkbcommon/xkbcommon-x11.h>

xcb_connection_t *conn = <...>;
int32_t device_id;

device_id = xkb_x11_get_core_keyboard_device_id(conn);
if (device_id == -1) <error>

keymap = xkb_x11_keymap_new_from_device(ctx, conn, device_id,
                                        XKB_KEYMAP_COMPILE_NO_FLAGS);
if (!keymap) <error>

but the xkb_x11 methods are not in this library as far as I can tell.

sde1000 commented 2 years ago

The libxkbcommon-x11 library is separate from the main libxkbcommon library. (In some distributions, like all the Debian derivatives, it's actually a separately installable package.) I don't want to depend on it from python-xkbcommon because then python-xkbcommon wouldn't be usable without the extra library being installed.

The right way to do this is to create another package (eg. "python-xkbcommon-x11") that has bindings to libxkbcommon-x11.