add an option to manage when keyboard layout is changed

This patch adds an option, but the actual functional for it to control
being added in next one.

To keep keyboard layout per window add in sway config:

    seat * keep_keyboard_layout per_window

To keep keyboard layout globally either do not add anything (it's the
default), or to explicitly enable it use the following:

    seat * keep_keyboard_layout global

Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
This commit is contained in:
Konstantin Kharlamov 2018-11-18 19:50:24 +03:00
parent 4925882920
commit 481accca2a
6 changed files with 42 additions and 0 deletions

View file

@ -277,6 +277,7 @@ sway_cmd seat_cmd_attach;
sway_cmd seat_cmd_cursor;
sway_cmd seat_cmd_fallback;
sway_cmd seat_cmd_hide_cursor;
sway_cmd seat_cmd_keep_keyboard_layout;
sway_cmd seat_cmd_pointer_constraint;
sway_cmd cmd_ipc_cmd;

View file

@ -41,6 +41,12 @@ enum binding_flags {
BINDING_CODE=32, // keyboard only; convert keysyms into keycodes
};
enum sway_keep_keyboard_layout {
KEYBOARD_LAYOUT_UNDEFINED = 0,
KEYBOARD_LAYOUT_GLOBAL,
KEYBOARD_LAYOUT_PER_WINDOW
};
/**
* A key binding and an associated command.
*/
@ -165,6 +171,7 @@ struct seat_config {
list_t *attachments; // list of seat_attachment configs
int hide_cursor_timeout;
enum seat_config_allow_constrain allow_constrain;
enum sway_keep_keyboard_layout keep_keyboard_layout;
};
enum config_dpms {