aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands/seat
diff options
context:
space:
mode:
authorLibravatar Brian Ashworth <bosrsf04@gmail.com>2019-11-03 14:20:05 -0500
committerLibravatar Drew DeVault <sir@cmpwn.com>2019-11-21 10:42:10 -0500
commit5d882cb5fc2d9d9fd68439021e48a90aa2e50e79 (patch)
treec519449aebb2fa15406407eee5af3cd4164e1b62 /sway/commands/seat
parentinput_cmd_xkb_file: allow shell path expansion (diff)
downloadsway-5d882cb5fc2d9d9fd68439021e48a90aa2e50e79.tar.gz
sway-5d882cb5fc2d9d9fd68439021e48a90aa2e50e79.tar.zst
sway-5d882cb5fc2d9d9fd68439021e48a90aa2e50e79.zip
Add support for wlr_keyboard_group
A wlr_keyboard_group allows for multiple keyboard devices to be combined into one logical keyboard. This is useful for keyboards that are split into multiple input devices despite appearing as one physical keyboard in the user's mind. This adds support for wlr_keyboard_groups to sway. There are two keyboard groupings currently supported, which can be set on a per-seat basis. The first keyboard grouping is none, which disables all grouping and provides no functional change. The second is keymap, which groups the keyboard devices in the seat by their keymap. With this grouping, the effective layout and repeat info is also synced across keyboard devices in the seat. Device specific bindings will still be executed as normal, but everything else related to key and modifier events will be handled by the keyboard group's keyboard.
Diffstat (limited to 'sway/commands/seat')
-rw-r--r--sway/commands/seat/keyboard_grouping.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/sway/commands/seat/keyboard_grouping.c b/sway/commands/seat/keyboard_grouping.c
new file mode 100644
index 00000000..959c6f94
--- /dev/null
+++ b/sway/commands/seat/keyboard_grouping.c
@@ -0,0 +1,26 @@
1#include <string.h>
2#include "sway/commands.h"
3#include "sway/config.h"
4#include "stringop.h"
5
6struct cmd_results *seat_cmd_keyboard_grouping(int argc, char **argv) {
7 struct cmd_results *error = NULL;
8 if ((error = checkarg(argc, "keyboard_grouping", EXPECTED_EQUAL_TO, 1))) {
9 return error;
10 }
11 if (!config->handler_context.seat_config) {
12 return cmd_results_new(CMD_INVALID, "No seat defined");
13 }
14
15 struct seat_config *seat_config = config->handler_context.seat_config;
16 if (strcmp(argv[0], "none") == 0) {
17 seat_config->keyboard_grouping = KEYBOARD_GROUP_NONE;
18 } else if (strcmp(argv[0], "keymap") == 0) {
19 seat_config->keyboard_grouping = KEYBOARD_GROUP_KEYMAP;
20 } else {
21 return cmd_results_new(CMD_INVALID,
22 "Expected syntax `keyboard_grouping none|keymap`");
23 }
24
25 return cmd_results_new(CMD_SUCCESS, NULL);
26}