mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-22 05:33:45 -04:00
wip: initial framework for dealing with key/mouse bindings in different modes
This adds initial support for defining key and mouse bindings that are applied in different terminal modes/states. For example, there are two arrays dealing with key and mouse bindings in the "normal" mode. Most bindings will go here. There's also an array for "search" mode. These bindings will be used when the user has started a scrollback search. In the future, there may be a model selection mode as well. Or maybe "search" and "modal selection" will be combined into a single "keyboard" mode. We'll see. Since the keyboard bindings depend on the current XKB keymap, translation from the user specified key combination string cannot be done when loading the configuration, but must be done when we've received a keymap from the wayland server. We should explore if it's possible to load some kind of default keymap just to be able to verify the validity of the key combination strings at configuration load time, to be able to reject the configuration at startup. A couple of key bindings have been added as proof of concept. Mouse bindings aren't handled at all yet, and is likely to be re-written. For example, we can probably translate the configuration strings at configuration load time.
This commit is contained in:
parent
8cf3cec920
commit
b22bb30976
5 changed files with 130 additions and 17 deletions
19
config.c
19
config.c
|
|
@ -619,6 +619,19 @@ config_load(struct config *conf, const char *conf_path)
|
|||
},
|
||||
},
|
||||
|
||||
.bindings = {
|
||||
.key = {
|
||||
[BIND_ACTION_CLIPBOARD_COPY] = strdup("Control+Shift+C"),
|
||||
[BIND_ACTION_CLIPBOARD_PASTE] = strdup("Control+Shift+V"),
|
||||
[BIND_ACTION_SEARCH_START] = strdup("Control+Shift+R"),
|
||||
},
|
||||
.mouse = {
|
||||
[BIND_ACTION_PRIMARY_PASTE] = strdup("BTN_MIDDLE"),
|
||||
},
|
||||
.search = {
|
||||
},
|
||||
},
|
||||
|
||||
.csd = {
|
||||
.preferred = CONF_CSD_PREFER_SERVER,
|
||||
.title_height = 26,
|
||||
|
|
@ -671,4 +684,10 @@ config_free(struct config conf)
|
|||
free(conf.shell);
|
||||
tll_free_and_free(conf.fonts, free);
|
||||
free(conf.server_socket_path);
|
||||
|
||||
for (size_t i = 0; i < BIND_ACTION_COUNT; i++) {
|
||||
free(conf.bindings.key[i]);
|
||||
free(conf.bindings.mouse[i]);
|
||||
free(conf.bindings.search[i]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue