mirror of
https://github.com/Raymo111/i3lock-color.git
synced 2024-12-02 14:05:43 -05:00
commit
e30f18fec1
2 changed files with 16 additions and 1 deletions
2
i3lock.c
2
i3lock.c
|
@ -894,6 +894,8 @@ static void process_xkb_event(xcb_generic_event_t *gevent) {
|
|||
event->state_notify.baseGroup,
|
||||
event->state_notify.latchedGroup,
|
||||
event->state_notify.lockedGroup);
|
||||
layout_text = get_keylayoutname(keylayout_mode, conn);
|
||||
redraw_screen();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
15
xcb.c
15
xcb.c
|
@ -537,6 +537,17 @@ static char * get_atom_name(xcb_connection_t* conn, xcb_atom_t atom) {
|
|||
}
|
||||
|
||||
|
||||
uint8_t xcb_get_key_group_index(xcb_connection_t *conn) {
|
||||
xcb_xkb_get_state_cookie_t cookie;
|
||||
xcb_xkb_get_state_reply_t* reply = NULL;
|
||||
cookie = xcb_xkb_get_state(conn, XCB_XKB_ID_USE_CORE_KBD);
|
||||
reply = xcb_xkb_get_state_reply(conn, cookie, NULL);
|
||||
uint8_t ans = reply->group;
|
||||
free(reply);
|
||||
return ans;
|
||||
}
|
||||
|
||||
|
||||
char* xcb_get_key_group_names(xcb_connection_t *conn) {
|
||||
uint8_t xkb_base_event;
|
||||
uint8_t xkb_base_error;
|
||||
|
@ -585,15 +596,17 @@ char* xcb_get_key_group_names(xcb_connection_t *conn) {
|
|||
|
||||
int length;
|
||||
xcb_atom_t *iter;
|
||||
uint8_t index;
|
||||
char* answer = NULL;
|
||||
length = xcb_xkb_get_names_value_list_groups_length(reply, &list);
|
||||
iter = xcb_xkb_get_names_value_list_groups(&list);
|
||||
index = xcb_get_key_group_index(conn);
|
||||
|
||||
for (int i = 0; i < length; i++) {
|
||||
xcb_atom_t group_name = *iter;
|
||||
char* name = get_atom_name(conn, group_name);
|
||||
DEBUG("group_name %d: %s\n", i, name);
|
||||
if (i == 0) {
|
||||
if (i == index) {
|
||||
answer = name;
|
||||
} else {
|
||||
free(name);
|
||||
|
|
Loading…
Reference in a new issue