mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-06-16 08:15:40 +02:00
modules/sway-xkb: new module, uses sway 'input' events to expose kbd layout
We subscribe to Sway's 'input' events, and use these to expose input devices' active XKB layout. The module is configured by specifying a list of 'identifiers'; these are the input devices (keyboards, typically), that we'll be monitoring. All other input devices are ignored. 'content' is a template, and the module will instantiate a dynlist with a 'content' for each *existing* input found in the 'identifiers' list. We also monitor for device 'added' and 'removed' events, and update our internal list of existing inputs. This means the user can configure a set of identifiers, and only those that are actually present will be displayed. If a device that is listed in the 'identifiers' list is added, it will be displayed. If it is removed, it will no longer be displayed.
This commit is contained in:
parent
1534e00236
commit
d576802e49
5 changed files with 381 additions and 0 deletions
|
@ -265,6 +265,10 @@ i3_receive_loop(int abort_fd, int sock,
|
|||
pkt_handler = cbs->reply_inputs;
|
||||
break;
|
||||
|
||||
/*
|
||||
* Events
|
||||
*/
|
||||
|
||||
case I3_IPC_EVENT_WORKSPACE:
|
||||
pkt_handler = cbs->event_workspace;
|
||||
break;
|
||||
|
@ -290,6 +294,11 @@ i3_receive_loop(int abort_fd, int sock,
|
|||
pkt_handler = cbs->event_tick;
|
||||
break;
|
||||
|
||||
/* Sway extensions */
|
||||
case ((1<<31) | 21): /* IPC_EVENT_INPUT */
|
||||
pkt_handler = cbs->event_input;
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG_ERR("unimplemented IPC reply type: %d", hdr->type);
|
||||
pkt_handler = NULL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue