foot/config.h
Daniel Eklöf b22bb30976
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.
2020-03-08 12:08:46 +01:00

79 lines
1.6 KiB
C

#pragma once
#include <stdint.h>
#include <stdbool.h>
#include <tllist.h>
#include "terminal.h"
struct config {
char *term;
char *shell;
bool login_shell;
unsigned width;
unsigned height;
unsigned pad_x;
unsigned pad_y;
tll(char *) fonts;
int scrollback_lines;
struct {
uint32_t fg;
uint32_t bg;
uint32_t regular[8];
uint32_t bright[8];
uint16_t alpha;
} colors;
struct {
enum cursor_style style;
struct {
uint32_t text;
uint32_t cursor;
} color;
} cursor;
struct {
/* Bindings for "normal" mode */
char *key[BIND_ACTION_COUNT];
char *mouse[BIND_ACTION_COUNT];
/*
* Special modes
*/
/* While searching (not - action to *start* a search is in the
* 'key' bindings above */
char *search[BIND_ACTION_COUNT];
} bindings;
struct {
enum { CONF_CSD_PREFER_SERVER, CONF_CSD_PREFER_CLIENT } preferred;
int title_height;
int border_width;
int button_width;
struct {
bool title_set;
bool minimize_set;
bool maximize_set;
bool close_set;
uint32_t title;
uint32_t minimize;
uint32_t maximize;
uint32_t close;
} color;
} csd;
size_t render_worker_count;
char *server_socket_path;
bool presentation_timings;
bool hold_at_exit;
};
bool config_load(struct config *conf, const char *path);
void config_free(struct config conf);