This repository has been archived by the owner on Jul 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfig.h
257 lines (211 loc) · 5.98 KB
/
config.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
#pragma once
#include <stdint.h>
#include <stdbool.h>
#include <tllist.h>
#include "terminal.h"
#include "user-notification.h"
#include "wayland.h"
#ifdef HAVE_TERMINFO
#define DEFAULT_TERM "foot"
#else
#define DEFAULT_TERM "xterm-256color"
#endif
enum conf_size_type {CONF_SIZE_PX, CONF_SIZE_CELLS};
struct config_font {
char *pattern;
double pt_size;
int px_size;
};
typedef tll(struct config_font) config_font_list_t;
struct config_key_modifiers {
bool shift;
bool alt;
bool ctrl;
bool meta;
};
struct config_binding_pipe {
char *cmd;
char **argv;
bool master_copy;
};
struct config_key_binding {
int action; /* One of the varios bind_action_* enums from wayland.h */
struct config_key_modifiers modifiers;
xkb_keysym_t sym;
struct config_binding_pipe pipe;
};
typedef tll(struct config_key_binding) config_key_binding_list_t;
struct config_mouse_binding {
enum bind_action_normal action;
struct config_key_modifiers modifiers;
int button;
int count;
struct config_binding_pipe pipe;
};
typedef tll(struct config_mouse_binding) config_mouse_binding_list_t;
typedef tll(char *) config_override_t;
struct config_spawn_template {
char *raw_cmd;
char **argv;
};
struct config {
char *term;
char *shell;
char *title;
char *app_id;
wchar_t *word_delimiters;
bool login_shell;
bool no_wait;
struct {
enum conf_size_type type;
unsigned width;
unsigned height;
} size;
unsigned pad_x;
unsigned pad_y;
bool center;
uint16_t resize_delay_ms;
struct {
bool enabled;
bool palette_based;
} bold_in_bright;
enum { STARTUP_WINDOWED, STARTUP_MAXIMIZED, STARTUP_FULLSCREEN } startup_mode;
enum {DPI_AWARE_AUTO, DPI_AWARE_YES, DPI_AWARE_NO} dpi_aware;
config_font_list_t fonts[4];
/* Custom font metrics (-1 = use real font metrics) */
struct pt_or_px line_height;
struct pt_or_px letter_spacing;
/* Adjusted letter x/y offsets */
struct pt_or_px horizontal_letter_offset;
struct pt_or_px vertical_letter_offset;
bool box_drawings_uses_font_glyphs;
struct {
bool urgent;
bool notify;
struct config_spawn_template command;
bool command_focused;
} bell;
struct {
int lines;
struct {
enum {
SCROLLBACK_INDICATOR_POSITION_NONE,
SCROLLBACK_INDICATOR_POSITION_FIXED,
SCROLLBACK_INDICATOR_POSITION_RELATIVE
} position;
enum {
SCROLLBACK_INDICATOR_FORMAT_PERCENTAGE,
SCROLLBACK_INDICATOR_FORMAT_LINENO,
SCROLLBACK_INDICATOR_FORMAT_TEXT,
} format;
wchar_t *text;
} indicator;
double multiplier;
} scrollback;
struct {
wchar_t *label_letters;
struct config_spawn_template launch;
enum {
OSC8_UNDERLINE_URL_MODE,
OSC8_UNDERLINE_ALWAYS,
} osc8_underline;
wchar_t **protocols;
size_t prot_count;
size_t max_prot_len;
} url;
struct {
uint32_t fg;
uint32_t bg;
uint32_t table[256];
uint16_t alpha;
uint32_t selection_fg;
uint32_t selection_bg;
uint32_t url;
struct {
uint32_t fg;
uint32_t bg;
} jump_label;
struct {
bool selection:1;
bool jump_label:1;
bool url:1;
} use_custom;
} colors;
struct {
enum cursor_style style;
bool blink;
struct {
uint32_t text;
uint32_t cursor;
} color;
struct pt_or_px beam_thickness;
struct pt_or_px underline_thickness;
} cursor;
struct {
bool hide_when_typing;
bool alternate_scroll_mode;
} mouse;
struct {
/* Bindings for "normal" mode */
config_key_binding_list_t key;
config_mouse_binding_list_t mouse;
/*
* Special modes
*/
/* While searching (not - action to *start* a search is in the
* 'key' bindings above */
config_key_binding_list_t search;
/* While showing URL jump labels */
config_key_binding_list_t url;
} bindings;
struct {
enum { CONF_CSD_PREFER_NONE, CONF_CSD_PREFER_SERVER, CONF_CSD_PREFER_CLIENT } preferred;
int title_height;
int border_width;
int button_width;
struct {
bool title_set:1;
bool minimize_set:1;
bool maximize_set:1;
bool close_set:1;
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;
enum {
SELECTION_TARGET_NONE,
SELECTION_TARGET_PRIMARY,
SELECTION_TARGET_CLIPBOARD,
SELECTION_TARGET_BOTH
} selection_target;
struct config_spawn_template notify;
struct {
enum fcft_scaling_filter fcft_filter;
bool allow_overflowing_double_width_glyphs;
bool render_timer_osd;
bool render_timer_log;
bool damage_whole_window;
uint64_t delayed_render_lower_ns;
uint64_t delayed_render_upper_ns;
off_t max_shm_pool_size;
float box_drawing_base_thickness;
bool box_drawing_solid_shades;
bool pua_double_width;
} tweak;
user_notifications_t notifications;
};
bool config_override_apply(struct config *conf, config_override_t *overrides,
bool errors_are_fatal);
bool config_load(
struct config *conf, const char *path,
user_notifications_t *initial_user_notifications,
config_override_t *overrides, bool errors_are_fatal);
void config_free(struct config conf);
bool config_font_parse(const char *pattern, struct config_font *font);
void config_font_destroy(struct config_font *font);