2019-07-16 11:52:22 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
2019-07-21 11:06:28 +02:00
|
|
|
#include <stdint.h>
|
2019-07-17 10:12:14 +02:00
|
|
|
#include <stdbool.h>
|
|
|
|
|
|
2019-12-01 13:43:51 +01:00
|
|
|
#include <tllist.h>
|
|
|
|
|
|
2019-07-22 20:15:14 +02:00
|
|
|
#include "terminal.h"
|
2020-07-30 18:57:21 +02:00
|
|
|
#include "user-notification.h"
|
2020-07-15 16:39:07 +02:00
|
|
|
#include "wayland.h"
|
2019-07-22 20:15:14 +02:00
|
|
|
|
2021-02-26 16:23:43 -05:00
|
|
|
#ifdef HAVE_TERMINFO
|
|
|
|
|
#define DEFAULT_TERM "foot"
|
|
|
|
|
#else
|
|
|
|
|
#define DEFAULT_TERM "xterm-256color"
|
|
|
|
|
#endif
|
|
|
|
|
|
2020-09-08 19:17:29 +02:00
|
|
|
enum conf_size_type {CONF_SIZE_PX, CONF_SIZE_CELLS};
|
|
|
|
|
|
2020-07-07 10:44:55 +02:00
|
|
|
struct config_font {
|
|
|
|
|
char *pattern;
|
|
|
|
|
double pt_size;
|
|
|
|
|
int px_size;
|
|
|
|
|
};
|
2020-10-20 21:04:47 +02:00
|
|
|
typedef tll(struct config_font) config_font_list_t;
|
2020-07-07 10:44:55 +02:00
|
|
|
|
config: key/mouse bindings: refactor: less parsing in keyboard_enter()
This simplifies the handling of mouse and keyboard bindings.
Before, the bindings where parsed *both* when loading the
configuration, and then on every keyboard enter event. This was done
since keys require a keymap to be decoded. Something we don't have at
configuration time. The idea was that at config time, we used a
default keymap just to verify the key combo strings were valid.
The following has changed:
* The bindings in the config struct is now *one* key combo per
entry. Previously, it was one *action* per entry, and each entry
had one or more key combos.
Doing it this way makes it easier when converting the binding in the
keyboard enter event (which previously had to expand the combos
anyway).
* The bindings in the config struct no longer contains any unparsed
strings.
A key binding contains a decoded 'modifier' struct (which specifies
whether e.g. ctrl, or shift, or ctrl+shift must be pressed for the
binding to be used).
It also contains a decoded XKB keysym.
* A mouse binding in the config struct is similar to a key binding,
except it contains the button, and click count instead of the XKB
key sym.
* The modifiers in the user-specified key combo is decoded at config
time, by using the pre-defined XKB constants
XKB_MOD_NAME_<modifier>.
The result is stored in a 'modifiers' struct, which is just a
collection of booleans; one for each supported modifier.
The supported modifiers are: shift, ctrl, alt and meta/super.
* The key sym is decoded at config time using
xkb_keysym_from_name(). This call does *not* depend on a keymap.
* The mouse button is decoded at config time using a hardcoded mapping
table (just like before).
* The click count is currently hard-coded to 1.
* In the keyboard enter event, all we need to do is pre-compute the
xkb_mod_mask_t variable for each key/mouse binding, and find all the
*key codes* that map to the (already decoded) symbol.
For mouse bindings, the modifiers are the *only* reason we convert
the mouse bindings at all.
In fact, on button events, we check if the seat has a keyboard. If
not, we use the mouse bindings from the configuration directly, and
simply filter out those with a non-empty set of modifiers.
2020-08-10 19:00:03 +02:00
|
|
|
struct config_key_modifiers {
|
|
|
|
|
bool shift;
|
|
|
|
|
bool alt;
|
|
|
|
|
bool ctrl;
|
|
|
|
|
bool meta;
|
|
|
|
|
};
|
|
|
|
|
|
2021-02-07 14:46:29 +01:00
|
|
|
struct config_binding_pipe {
|
|
|
|
|
char *cmd;
|
|
|
|
|
char **argv;
|
|
|
|
|
bool master_copy;
|
config: key/mouse bindings: refactor: less parsing in keyboard_enter()
This simplifies the handling of mouse and keyboard bindings.
Before, the bindings where parsed *both* when loading the
configuration, and then on every keyboard enter event. This was done
since keys require a keymap to be decoded. Something we don't have at
configuration time. The idea was that at config time, we used a
default keymap just to verify the key combo strings were valid.
The following has changed:
* The bindings in the config struct is now *one* key combo per
entry. Previously, it was one *action* per entry, and each entry
had one or more key combos.
Doing it this way makes it easier when converting the binding in the
keyboard enter event (which previously had to expand the combos
anyway).
* The bindings in the config struct no longer contains any unparsed
strings.
A key binding contains a decoded 'modifier' struct (which specifies
whether e.g. ctrl, or shift, or ctrl+shift must be pressed for the
binding to be used).
It also contains a decoded XKB keysym.
* A mouse binding in the config struct is similar to a key binding,
except it contains the button, and click count instead of the XKB
key sym.
* The modifiers in the user-specified key combo is decoded at config
time, by using the pre-defined XKB constants
XKB_MOD_NAME_<modifier>.
The result is stored in a 'modifiers' struct, which is just a
collection of booleans; one for each supported modifier.
The supported modifiers are: shift, ctrl, alt and meta/super.
* The key sym is decoded at config time using
xkb_keysym_from_name(). This call does *not* depend on a keymap.
* The mouse button is decoded at config time using a hardcoded mapping
table (just like before).
* The click count is currently hard-coded to 1.
* In the keyboard enter event, all we need to do is pre-compute the
xkb_mod_mask_t variable for each key/mouse binding, and find all the
*key codes* that map to the (already decoded) symbol.
For mouse bindings, the modifiers are the *only* reason we convert
the mouse bindings at all.
In fact, on button events, we check if the seat has a keyboard. If
not, we use the mouse bindings from the configuration directly, and
simply filter out those with a non-empty set of modifiers.
2020-08-10 19:00:03 +02:00
|
|
|
};
|
|
|
|
|
|
2021-02-07 14:46:29 +01:00
|
|
|
struct config_key_binding {
|
|
|
|
|
int action; /* One of the varios bind_action_* enums from wayland.h */
|
2021-01-30 12:43:59 +01:00
|
|
|
struct config_key_modifiers modifiers;
|
|
|
|
|
xkb_keysym_t sym;
|
2021-02-07 14:46:29 +01:00
|
|
|
struct config_binding_pipe pipe;
|
2021-01-30 12:43:59 +01:00
|
|
|
};
|
2021-02-07 14:46:29 +01:00
|
|
|
typedef tll(struct config_key_binding) config_key_binding_list_t;
|
2021-01-30 12:43:59 +01:00
|
|
|
|
config: key/mouse bindings: refactor: less parsing in keyboard_enter()
This simplifies the handling of mouse and keyboard bindings.
Before, the bindings where parsed *both* when loading the
configuration, and then on every keyboard enter event. This was done
since keys require a keymap to be decoded. Something we don't have at
configuration time. The idea was that at config time, we used a
default keymap just to verify the key combo strings were valid.
The following has changed:
* The bindings in the config struct is now *one* key combo per
entry. Previously, it was one *action* per entry, and each entry
had one or more key combos.
Doing it this way makes it easier when converting the binding in the
keyboard enter event (which previously had to expand the combos
anyway).
* The bindings in the config struct no longer contains any unparsed
strings.
A key binding contains a decoded 'modifier' struct (which specifies
whether e.g. ctrl, or shift, or ctrl+shift must be pressed for the
binding to be used).
It also contains a decoded XKB keysym.
* A mouse binding in the config struct is similar to a key binding,
except it contains the button, and click count instead of the XKB
key sym.
* The modifiers in the user-specified key combo is decoded at config
time, by using the pre-defined XKB constants
XKB_MOD_NAME_<modifier>.
The result is stored in a 'modifiers' struct, which is just a
collection of booleans; one for each supported modifier.
The supported modifiers are: shift, ctrl, alt and meta/super.
* The key sym is decoded at config time using
xkb_keysym_from_name(). This call does *not* depend on a keymap.
* The mouse button is decoded at config time using a hardcoded mapping
table (just like before).
* The click count is currently hard-coded to 1.
* In the keyboard enter event, all we need to do is pre-compute the
xkb_mod_mask_t variable for each key/mouse binding, and find all the
*key codes* that map to the (already decoded) symbol.
For mouse bindings, the modifiers are the *only* reason we convert
the mouse bindings at all.
In fact, on button events, we check if the seat has a keyboard. If
not, we use the mouse bindings from the configuration directly, and
simply filter out those with a non-empty set of modifiers.
2020-08-10 19:00:03 +02:00
|
|
|
struct config_mouse_binding {
|
|
|
|
|
enum bind_action_normal action;
|
|
|
|
|
struct config_key_modifiers modifiers;
|
|
|
|
|
int button;
|
|
|
|
|
int count;
|
2021-02-07 14:46:29 +01:00
|
|
|
struct config_binding_pipe pipe;
|
2020-07-15 16:39:07 +02:00
|
|
|
};
|
2021-05-07 17:18:46 +02:00
|
|
|
typedef tll(struct config_mouse_binding) config_mouse_binding_list_t;
|
2020-07-15 16:39:07 +02:00
|
|
|
|
2021-01-31 14:27:13 +01:00
|
|
|
struct config_spawn_template {
|
|
|
|
|
char *raw_cmd;
|
|
|
|
|
char **argv;
|
|
|
|
|
};
|
|
|
|
|
|
2019-07-16 11:52:22 +02:00
|
|
|
struct config {
|
2019-07-18 14:29:40 +02:00
|
|
|
char *term;
|
2019-07-17 09:29:56 +02:00
|
|
|
char *shell;
|
2020-04-01 19:59:47 +02:00
|
|
|
char *title;
|
2020-04-01 18:40:51 +02:00
|
|
|
char *app_id;
|
2020-10-09 19:44:23 +02:00
|
|
|
wchar_t *word_delimiters;
|
2021-02-13 11:42:40 +01:00
|
|
|
wchar_t *jump_label_letters;
|
2020-02-20 18:35:10 +01:00
|
|
|
bool login_shell;
|
2021-03-12 20:46:55 -03:00
|
|
|
bool no_wait;
|
2020-09-08 19:17:29 +02:00
|
|
|
|
|
|
|
|
struct {
|
|
|
|
|
enum conf_size_type type;
|
2020-11-30 02:24:38 +00:00
|
|
|
unsigned width;
|
|
|
|
|
unsigned height;
|
2020-09-08 19:17:29 +02:00
|
|
|
} size;
|
|
|
|
|
|
2020-02-15 19:00:56 +01:00
|
|
|
unsigned pad_x;
|
|
|
|
|
unsigned pad_y;
|
2021-01-06 11:17:29 +01:00
|
|
|
bool center;
|
2021-01-21 15:14:43 +01:00
|
|
|
uint16_t resize_delay_ms;
|
2020-09-08 19:17:29 +02:00
|
|
|
|
2021-04-17 21:57:08 +02:00
|
|
|
struct {
|
|
|
|
|
bool enabled;
|
|
|
|
|
bool palette_based;
|
|
|
|
|
} bold_in_bright;
|
|
|
|
|
|
2020-03-26 19:39:12 +01:00
|
|
|
enum { STARTUP_WINDOWED, STARTUP_MAXIMIZED, STARTUP_FULLSCREEN } startup_mode;
|
2019-08-23 17:26:41 +02:00
|
|
|
|
2020-12-17 12:05:22 +01:00
|
|
|
enum {DPI_AWARE_AUTO, DPI_AWARE_YES, DPI_AWARE_NO} dpi_aware;
|
2020-10-20 21:04:47 +02:00
|
|
|
config_font_list_t fonts[4];
|
2019-07-21 11:06:28 +02:00
|
|
|
|
2021-01-07 11:16:02 +01:00
|
|
|
/* Custom font metrics (-1 = use real font metrics) */
|
2021-01-11 19:37:05 +01:00
|
|
|
struct pt_or_px line_height;
|
|
|
|
|
struct pt_or_px letter_spacing;
|
2021-01-07 11:16:02 +01:00
|
|
|
|
|
|
|
|
/* Adjusted letter x/y offsets */
|
2021-01-11 19:37:05 +01:00
|
|
|
struct pt_or_px horizontal_letter_offset;
|
|
|
|
|
struct pt_or_px vertical_letter_offset;
|
2021-01-07 11:16:02 +01:00
|
|
|
|
2021-04-09 23:19:20 +02:00
|
|
|
bool box_drawings_uses_font_glyphs;
|
|
|
|
|
|
2021-04-29 04:12:55 -05:00
|
|
|
struct {
|
|
|
|
|
bool urgent;
|
|
|
|
|
bool notify;
|
|
|
|
|
struct config_spawn_template command;
|
|
|
|
|
bool command_focused;
|
|
|
|
|
} bell;
|
|
|
|
|
|
2020-07-25 14:31:45 +02:00
|
|
|
struct {
|
|
|
|
|
int lines;
|
|
|
|
|
|
|
|
|
|
struct {
|
|
|
|
|
enum {
|
2020-07-27 20:02:51 +02:00
|
|
|
SCROLLBACK_INDICATOR_POSITION_NONE,
|
|
|
|
|
SCROLLBACK_INDICATOR_POSITION_FIXED,
|
|
|
|
|
SCROLLBACK_INDICATOR_POSITION_RELATIVE
|
|
|
|
|
} position;
|
2020-07-25 14:31:45 +02:00
|
|
|
|
|
|
|
|
enum {
|
2020-07-26 11:39:02 +02:00
|
|
|
SCROLLBACK_INDICATOR_FORMAT_PERCENTAGE,
|
2020-07-28 19:56:53 +02:00
|
|
|
SCROLLBACK_INDICATOR_FORMAT_LINENO,
|
|
|
|
|
SCROLLBACK_INDICATOR_FORMAT_TEXT,
|
2020-07-25 14:31:45 +02:00
|
|
|
} format;
|
2020-07-28 19:56:53 +02:00
|
|
|
|
|
|
|
|
wchar_t *text;
|
2020-07-25 14:31:45 +02:00
|
|
|
} indicator;
|
2020-08-03 19:43:06 +02:00
|
|
|
double multiplier;
|
2020-07-25 14:31:45 +02:00
|
|
|
} scrollback;
|
2019-08-01 19:28:14 +02:00
|
|
|
|
2019-07-21 11:06:28 +02:00
|
|
|
struct {
|
|
|
|
|
uint32_t fg;
|
|
|
|
|
uint32_t bg;
|
2021-04-07 08:07:43 +02:00
|
|
|
uint32_t table[256];
|
2019-08-16 22:06:06 +02:00
|
|
|
uint16_t alpha;
|
2020-08-12 18:53:32 +02:00
|
|
|
uint32_t selection_fg;
|
|
|
|
|
uint32_t selection_bg;
|
2021-02-06 11:10:40 +01:00
|
|
|
uint32_t url;
|
|
|
|
|
|
|
|
|
|
struct {
|
|
|
|
|
uint32_t fg;
|
|
|
|
|
uint32_t bg;
|
|
|
|
|
} jump_label;
|
2021-02-06 10:35:48 +01:00
|
|
|
|
|
|
|
|
struct {
|
|
|
|
|
bool selection:1;
|
2021-02-06 11:10:40 +01:00
|
|
|
bool jump_label:1;
|
|
|
|
|
bool url:1;
|
2021-02-06 10:35:48 +01:00
|
|
|
} use_custom;
|
2019-07-21 11:06:28 +02:00
|
|
|
} colors;
|
2019-07-22 20:15:14 +02:00
|
|
|
|
|
|
|
|
struct {
|
|
|
|
|
enum cursor_style style;
|
2020-06-30 17:45:34 +02:00
|
|
|
bool blink;
|
2019-07-23 18:54:58 +02:00
|
|
|
struct {
|
|
|
|
|
uint32_t text;
|
|
|
|
|
uint32_t cursor;
|
|
|
|
|
} color;
|
2021-04-30 20:31:47 +02:00
|
|
|
struct pt_or_px beam_thickness;
|
2019-07-22 20:15:14 +02:00
|
|
|
} cursor;
|
2019-07-29 20:13:26 +02:00
|
|
|
|
2020-08-04 07:33:15 +02:00
|
|
|
struct {
|
|
|
|
|
bool hide_when_typing;
|
2020-09-15 19:09:00 +02:00
|
|
|
bool alternate_scroll_mode;
|
2020-08-04 07:33:15 +02:00
|
|
|
} mouse;
|
|
|
|
|
|
2020-03-08 12:08:46 +01:00
|
|
|
struct {
|
|
|
|
|
/* Bindings for "normal" mode */
|
2021-02-07 14:46:29 +01:00
|
|
|
config_key_binding_list_t key;
|
2021-05-07 17:18:46 +02:00
|
|
|
config_mouse_binding_list_t mouse;
|
2020-03-08 12:08:46 +01:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Special modes
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/* While searching (not - action to *start* a search is in the
|
|
|
|
|
* 'key' bindings above */
|
2021-02-07 14:46:29 +01:00
|
|
|
config_key_binding_list_t search;
|
2021-01-30 12:43:59 +01:00
|
|
|
|
|
|
|
|
/* While showing URL jump labels */
|
2021-02-07 14:46:29 +01:00
|
|
|
config_key_binding_list_t url;
|
2020-03-08 12:08:46 +01:00
|
|
|
} bindings;
|
|
|
|
|
|
2020-03-02 18:42:49 +01:00
|
|
|
struct {
|
2020-10-10 11:04:17 +02:00
|
|
|
enum { CONF_CSD_PREFER_NONE, CONF_CSD_PREFER_SERVER, CONF_CSD_PREFER_CLIENT } preferred;
|
2020-03-02 18:42:49 +01:00
|
|
|
|
|
|
|
|
int title_height;
|
|
|
|
|
int border_width;
|
2020-03-02 20:29:28 +01:00
|
|
|
int button_width;
|
2020-03-02 18:42:49 +01:00
|
|
|
|
|
|
|
|
struct {
|
2021-02-06 11:12:22 +01:00
|
|
|
bool title_set:1;
|
|
|
|
|
bool minimize_set:1;
|
|
|
|
|
bool maximize_set:1;
|
|
|
|
|
bool close_set:1;
|
2020-03-02 18:42:49 +01:00
|
|
|
uint32_t title;
|
2020-03-02 20:29:28 +01:00
|
|
|
uint32_t minimize;
|
|
|
|
|
uint32_t maximize;
|
|
|
|
|
uint32_t close;
|
2020-03-02 18:42:49 +01:00
|
|
|
} color;
|
|
|
|
|
} csd;
|
|
|
|
|
|
2019-07-29 20:13:26 +02:00
|
|
|
size_t render_worker_count;
|
2019-12-14 12:59:06 +01:00
|
|
|
char *server_socket_path;
|
2019-12-31 15:39:40 +01:00
|
|
|
bool presentation_timings;
|
2020-02-03 19:58:32 +01:00
|
|
|
bool hold_at_exit;
|
2021-01-16 11:26:03 +01:00
|
|
|
enum {
|
2021-01-16 15:39:44 +01:00
|
|
|
SELECTION_TARGET_NONE,
|
2021-01-16 11:26:03 +01:00
|
|
|
SELECTION_TARGET_PRIMARY,
|
|
|
|
|
SELECTION_TARGET_CLIPBOARD,
|
|
|
|
|
SELECTION_TARGET_BOTH
|
|
|
|
|
} selection_target;
|
2020-03-17 16:46:54 +01:00
|
|
|
|
2021-01-31 14:27:13 +01:00
|
|
|
struct config_spawn_template notify;
|
|
|
|
|
struct config_spawn_template url_launch;
|
2020-12-08 19:19:55 +01:00
|
|
|
|
2021-02-14 21:29:22 +01:00
|
|
|
enum {
|
|
|
|
|
OSC8_UNDERLINE_URL_MODE,
|
|
|
|
|
OSC8_UNDERLINE_ALWAYS,
|
|
|
|
|
} osc8_underline;
|
|
|
|
|
|
2020-03-17 16:46:54 +01:00
|
|
|
struct {
|
2020-09-13 17:59:56 +02:00
|
|
|
enum fcft_scaling_filter fcft_filter;
|
2020-09-03 17:37:44 +02:00
|
|
|
bool allow_overflowing_double_width_glyphs;
|
2020-08-13 18:35:17 +02:00
|
|
|
bool render_timer_osd;
|
|
|
|
|
bool render_timer_log;
|
2020-09-06 17:52:07 +02:00
|
|
|
bool damage_whole_window;
|
2020-03-17 16:46:54 +01:00
|
|
|
uint64_t delayed_render_lower_ns;
|
|
|
|
|
uint64_t delayed_render_upper_ns;
|
2020-03-25 20:48:02 +01:00
|
|
|
off_t max_shm_pool_size;
|
2021-01-08 10:27:35 +01:00
|
|
|
float box_drawing_base_thickness;
|
2021-05-05 22:24:25 +02:00
|
|
|
bool box_drawing_solid_shades;
|
2020-03-17 16:46:54 +01:00
|
|
|
} tweak;
|
2020-07-29 19:42:12 +02:00
|
|
|
|
2020-07-30 18:57:21 +02:00
|
|
|
user_notifications_t notifications;
|
2019-07-16 11:52:22 +02:00
|
|
|
};
|
|
|
|
|
|
2020-09-08 19:17:29 +02:00
|
|
|
bool config_load(
|
|
|
|
|
struct config *conf, const char *path,
|
|
|
|
|
user_notifications_t *initial_user_notifications, bool errors_are_fatal);
|
2019-07-16 11:52:22 +02:00
|
|
|
void config_free(struct config conf);
|
2020-07-07 10:44:55 +02:00
|
|
|
|
2020-12-15 18:55:27 +01:00
|
|
|
bool config_font_parse(const char *pattern, struct config_font *font);
|
2020-07-07 10:44:55 +02:00
|
|
|
void config_font_destroy(struct config_font *font);
|