mirror of
https://github.com/gwenhael-le-moine/sway-patched-tray-menu.git
synced 2024-12-26 21:58:08 +01:00
452a615bb8
This removes `seat <seat> keyboard_grouping keymap` and replaces it with `seat <seat> keyboard_grouping smart`. The smart keyboard grouping will group based on both the keymap and repeat info. The reasoning for this is that deciding what the repeat info should be for a group is either arbitrary or non-deterministic when multiple keyboards in the group have repeat info configured (unless somehow exposed to the user in a reproducible uniquely identifiable fashion).
26 lines
824 B
C
26 lines
824 B
C
#include <string.h>
|
|
#include "sway/commands.h"
|
|
#include "sway/config.h"
|
|
#include "stringop.h"
|
|
|
|
struct cmd_results *seat_cmd_keyboard_grouping(int argc, char **argv) {
|
|
struct cmd_results *error = NULL;
|
|
if ((error = checkarg(argc, "keyboard_grouping", EXPECTED_EQUAL_TO, 1))) {
|
|
return error;
|
|
}
|
|
if (!config->handler_context.seat_config) {
|
|
return cmd_results_new(CMD_INVALID, "No seat defined");
|
|
}
|
|
|
|
struct seat_config *seat_config = config->handler_context.seat_config;
|
|
if (strcmp(argv[0], "none") == 0) {
|
|
seat_config->keyboard_grouping = KEYBOARD_GROUP_NONE;
|
|
} else if (strcmp(argv[0], "smart") == 0) {
|
|
seat_config->keyboard_grouping = KEYBOARD_GROUP_SMART;
|
|
} else {
|
|
return cmd_results_new(CMD_INVALID,
|
|
"Expected syntax `keyboard_grouping none|smart`");
|
|
}
|
|
|
|
return cmd_results_new(CMD_SUCCESS, NULL);
|
|
}
|