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>
|
fcft: adapt to API changes in fcft-3.x
Fcft no longer uses wchar_t, but plain uint32_t to represent
codepoints.
Since we do a fair amount of string operations in foot, it still makes
sense to use something that actually _is_ a string (or character),
rather than an array of uint32_t.
For this reason, we switch out all wchar_t usage in foot to
char32_t. We also verify, at compile-time, that char32_t used
UTF-32 (which is what fcft expects).
Unfortunately, there are no string functions for char32_t. To avoid
having to re-implement all wcs*() functions, we add a small wrapper
layer of c32*() functions.
These wrapper functions take char32_t arguments, but then simply call
the corresponding wcs*() function.
For this to work, wcs*() must _also_ be UTF-32 compatible. We can
check for the presence of the __STDC_ISO_10646__ macro. If set,
wchar_t is at least 4 bytes and its internal representation is UTF-32.
FreeBSD does *not* define this macro, because its internal wchar_t
representation depends on the current locale. It _does_ use UTF-32
_if_ the current locale is UTF-8.
Since foot enforces UTF-8, we simply need to check if __FreeBSD__ is
defined.
Other fcft API changes:
* fcft_glyph_rasterize() -> fcft_codepoint_rasterize()
* font.space_advance has been removed
* ‘tags’ have been removed from fcft_grapheme_rasterize()
* ‘fcft_log_init()’ removed
* ‘fcft_init()’ and ‘fcft_fini()’ must be explicitly called
2021-08-21 14:50:42 +02:00
|
|
|
#include <uchar.h>
|
2019-07-17 10:12:14 +02:00
|
|
|
|
2022-02-07 19:35:52 +01:00
|
|
|
#include <xkbcommon/xkbcommon.h>
|
2019-12-01 13:43:51 +01:00
|
|
|
#include <tllist.h>
|
2022-02-07 19:35:52 +01:00
|
|
|
#include <fcft/fcft.h>
|
2019-12-01 13:43:51 +01:00
|
|
|
|
2020-07-30 18:57:21 +02:00
|
|
|
#include "user-notification.h"
|
2019-07-22 20:15:14 +02:00
|
|
|
|
2021-06-17 18:15:29 +02:00
|
|
|
#define DEFINE_LIST(type) \
|
|
|
|
|
type##_list { \
|
|
|
|
|
size_t count; \
|
|
|
|
|
type *arr; \
|
|
|
|
|
}
|
|
|
|
|
|
2022-02-07 19:35:52 +01:00
|
|
|
/* If px != 0 then px is valid, otherwise pt is valid */
|
|
|
|
|
struct pt_or_px {
|
|
|
|
|
int16_t px;
|
|
|
|
|
float pt;
|
|
|
|
|
};
|
|
|
|
|
|
2022-12-15 11:10:32 +01:00
|
|
|
struct font_size_adjustment {
|
|
|
|
|
struct pt_or_px pt_or_px;
|
|
|
|
|
float percent;
|
|
|
|
|
};
|
|
|
|
|
|
2022-02-07 19:35:52 +01:00
|
|
|
enum cursor_style { CURSOR_BLOCK, CURSOR_UNDERLINE, CURSOR_BEAM };
|
2024-04-09 16:28:54 +02:00
|
|
|
enum cursor_unfocused_style {
|
|
|
|
|
CURSOR_UNFOCUSED_UNCHANGED,
|
|
|
|
|
CURSOR_UNFOCUSED_HOLLOW,
|
|
|
|
|
CURSOR_UNFOCUSED_NONE
|
|
|
|
|
};
|
2022-02-07 19:35:52 +01:00
|
|
|
|
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;
|
2021-11-06 12:01:57 +01:00
|
|
|
float pt_size;
|
2020-07-07 10:44:55 +02:00
|
|
|
int px_size;
|
|
|
|
|
};
|
2021-06-17 18:15:29 +02:00
|
|
|
DEFINE_LIST(struct config_font);
|
2020-07-07 10:44:55 +02:00
|
|
|
|
input/config: support *all* modifier names
That is, allow custom modifiers (i.e. other than ctrl/shift/alt etc)
in key bindings.
This is done by no longer validating/translating modifier names to
booleans for a pre-configured set of modifiers (ctrl, shift, alt,
super).
Instead, we keep the modifier *names* in a list, in the key binding
struct.
When a keymap is loaded, and we "convert" the key binding, _then_ we
do modifier translation. For invalid modifier names, we print an
error, and then ignore it. I.e. we no longer fail to load a config due
to invalid modifier names.
We also need to update how we determine the set of significant
modifiers. Any modifier not in this list will be ignored when matching
key bindings.
Before this patch, we hardcoded this to shift/alt/ctrl/super. Now, to
handle custom modifiers as well, we simply treat *all* modifiers
defined by the current layout as significant.
Typically, the only unwanted modifiers are "locked" modifiers. We are
already filtering these out.
2023-05-06 11:39:38 +02:00
|
|
|
#if 0
|
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;
|
2021-12-05 16:30:01 +01:00
|
|
|
bool super;
|
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
|
|
|
};
|
input/config: support *all* modifier names
That is, allow custom modifiers (i.e. other than ctrl/shift/alt etc)
in key bindings.
This is done by no longer validating/translating modifier names to
booleans for a pre-configured set of modifiers (ctrl, shift, alt,
super).
Instead, we keep the modifier *names* in a list, in the key binding
struct.
When a keymap is loaded, and we "convert" the key binding, _then_ we
do modifier translation. For invalid modifier names, we print an
error, and then ignore it. I.e. we no longer fail to load a config due
to invalid modifier names.
We also need to update how we determine the set of significant
modifiers. Any modifier not in this list will be ignored when matching
key bindings.
Before this patch, we hardcoded this to shift/alt/ctrl/super. Now, to
handle custom modifiers as well, we simply treat *all* modifiers
defined by the current layout as significant.
Typically, the only unwanted modifiers are "locked" modifiers. We are
already filtering these out.
2023-05-06 11:39:38 +02:00
|
|
|
#endif
|
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-06-18 16:18:41 +02:00
|
|
|
struct argv {
|
|
|
|
|
char **args;
|
|
|
|
|
};
|
|
|
|
|
|
2022-02-08 19:35:41 +01:00
|
|
|
enum binding_aux_type {
|
|
|
|
|
BINDING_AUX_NONE,
|
|
|
|
|
BINDING_AUX_PIPE,
|
2022-02-06 19:36:44 +01:00
|
|
|
BINDING_AUX_TEXT,
|
2022-02-08 19:35:41 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct binding_aux {
|
|
|
|
|
enum binding_aux_type type;
|
2021-02-07 14:46:29 +01:00
|
|
|
bool master_copy;
|
2022-02-08 19:35:41 +01:00
|
|
|
|
|
|
|
|
union {
|
|
|
|
|
struct argv pipe;
|
2022-02-06 19:36:44 +01:00
|
|
|
|
|
|
|
|
struct {
|
|
|
|
|
uint8_t *data;
|
|
|
|
|
size_t len;
|
|
|
|
|
} text;
|
2022-02-08 19:35:41 +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
|
|
|
};
|
|
|
|
|
|
2022-02-08 19:02:28 +01:00
|
|
|
enum key_binding_type {
|
2021-12-06 21:04:38 +01:00
|
|
|
KEY_BINDING,
|
|
|
|
|
MOUSE_BINDING,
|
|
|
|
|
};
|
|
|
|
|
|
input/config: support *all* modifier names
That is, allow custom modifiers (i.e. other than ctrl/shift/alt etc)
in key bindings.
This is done by no longer validating/translating modifier names to
booleans for a pre-configured set of modifiers (ctrl, shift, alt,
super).
Instead, we keep the modifier *names* in a list, in the key binding
struct.
When a keymap is loaded, and we "convert" the key binding, _then_ we
do modifier translation. For invalid modifier names, we print an
error, and then ignore it. I.e. we no longer fail to load a config due
to invalid modifier names.
We also need to update how we determine the set of significant
modifiers. Any modifier not in this list will be ignored when matching
key bindings.
Before this patch, we hardcoded this to shift/alt/ctrl/super. Now, to
handle custom modifiers as well, we simply treat *all* modifiers
defined by the current layout as significant.
Typically, the only unwanted modifiers are "locked" modifiers. We are
already filtering these out.
2023-05-06 11:39:38 +02:00
|
|
|
typedef tll(char *) config_modifier_list_t;
|
|
|
|
|
|
2021-02-07 14:46:29 +01:00
|
|
|
struct config_key_binding {
|
|
|
|
|
int action; /* One of the varios bind_action_* enums from wayland.h */
|
input/config: support *all* modifier names
That is, allow custom modifiers (i.e. other than ctrl/shift/alt etc)
in key bindings.
This is done by no longer validating/translating modifier names to
booleans for a pre-configured set of modifiers (ctrl, shift, alt,
super).
Instead, we keep the modifier *names* in a list, in the key binding
struct.
When a keymap is loaded, and we "convert" the key binding, _then_ we
do modifier translation. For invalid modifier names, we print an
error, and then ignore it. I.e. we no longer fail to load a config due
to invalid modifier names.
We also need to update how we determine the set of significant
modifiers. Any modifier not in this list will be ignored when matching
key bindings.
Before this patch, we hardcoded this to shift/alt/ctrl/super. Now, to
handle custom modifiers as well, we simply treat *all* modifiers
defined by the current layout as significant.
Typically, the only unwanted modifiers are "locked" modifiers. We are
already filtering these out.
2023-05-06 11:39:38 +02:00
|
|
|
//struct config_key_modifiers modifiers;
|
|
|
|
|
config_modifier_list_t modifiers;
|
2021-12-06 21:04:38 +01:00
|
|
|
union {
|
|
|
|
|
/* Key bindings */
|
|
|
|
|
struct {
|
|
|
|
|
xkb_keysym_t sym;
|
|
|
|
|
} k;
|
|
|
|
|
|
|
|
|
|
/* Mouse bindings */
|
|
|
|
|
struct {
|
|
|
|
|
int button;
|
|
|
|
|
int count;
|
|
|
|
|
} m;
|
|
|
|
|
};
|
|
|
|
|
|
2022-02-08 19:35:41 +01:00
|
|
|
struct binding_aux aux;
|
2021-12-05 15:19:22 +01:00
|
|
|
|
|
|
|
|
/* For error messages in collision handling */
|
|
|
|
|
const char *path;
|
|
|
|
|
int lineno;
|
2021-01-30 12:43:59 +01:00
|
|
|
};
|
2021-06-17 18:15:29 +02:00
|
|
|
DEFINE_LIST(struct config_key_binding);
|
2021-01-30 12:43:59 +01:00
|
|
|
|
2021-06-11 04:40:08 -05:00
|
|
|
typedef tll(char *) config_override_t;
|
|
|
|
|
|
2021-01-31 14:27:13 +01:00
|
|
|
struct config_spawn_template {
|
2021-06-18 16:18:41 +02:00
|
|
|
struct argv argv;
|
2021-01-31 14:27:13 +01:00
|
|
|
};
|
|
|
|
|
|
2022-05-28 19:27:29 +02:00
|
|
|
struct env_var {
|
|
|
|
|
char *name;
|
|
|
|
|
char *value;
|
|
|
|
|
};
|
|
|
|
|
typedef tll(struct env_var) env_var_list_t;
|
|
|
|
|
|
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;
|
fcft: adapt to API changes in fcft-3.x
Fcft no longer uses wchar_t, but plain uint32_t to represent
codepoints.
Since we do a fair amount of string operations in foot, it still makes
sense to use something that actually _is_ a string (or character),
rather than an array of uint32_t.
For this reason, we switch out all wchar_t usage in foot to
char32_t. We also verify, at compile-time, that char32_t used
UTF-32 (which is what fcft expects).
Unfortunately, there are no string functions for char32_t. To avoid
having to re-implement all wcs*() functions, we add a small wrapper
layer of c32*() functions.
These wrapper functions take char32_t arguments, but then simply call
the corresponding wcs*() function.
For this to work, wcs*() must _also_ be UTF-32 compatible. We can
check for the presence of the __STDC_ISO_10646__ macro. If set,
wchar_t is at least 4 bytes and its internal representation is UTF-32.
FreeBSD does *not* define this macro, because its internal wchar_t
representation depends on the current locale. It _does_ use UTF-32
_if_ the current locale is UTF-8.
Since foot enforces UTF-8, we simply need to check if __FreeBSD__ is
defined.
Other fcft API changes:
* fcft_glyph_rasterize() -> fcft_codepoint_rasterize()
* font.space_advance has been removed
* ‘tags’ have been removed from fcft_grapheme_rasterize()
* ‘fcft_log_init()’ removed
* ‘fcft_init()’ and ‘fcft_fini()’ must be explicitly called
2021-08-21 14:50:42 +02:00
|
|
|
char32_t *word_delimiters;
|
2020-02-20 18:35:10 +01:00
|
|
|
bool login_shell;
|
2021-07-04 17:59:40 +02:00
|
|
|
bool locked_title;
|
2020-09-08 19:17:29 +02:00
|
|
|
|
|
|
|
|
struct {
|
|
|
|
|
enum conf_size_type type;
|
2021-11-06 12:32:20 +01:00
|
|
|
uint32_t width;
|
|
|
|
|
uint32_t 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;
|
2024-01-17 15:00:14 -05:00
|
|
|
|
|
|
|
|
bool resize_by_cells;
|
|
|
|
|
|
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;
|
2023-07-26 16:12:36 +02:00
|
|
|
float amount;
|
2021-04-17 21:57:08 +02:00
|
|
|
} 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
|
|
|
|
2023-06-26 17:55:04 +02:00
|
|
|
bool dpi_aware;
|
2021-06-17 18:15:29 +02:00
|
|
|
struct config_font_list fonts[4];
|
2022-12-15 11:10:32 +01:00
|
|
|
struct font_size_adjustment font_size_adjustment;
|
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-06-17 17:52:38 +02:00
|
|
|
bool use_custom_underline_offset;
|
|
|
|
|
struct pt_or_px underline_offset;
|
2022-08-19 02:54:49 +02:00
|
|
|
struct pt_or_px underline_thickness;
|
2021-06-17 17:52:38 +02:00
|
|
|
|
2021-04-09 23:19:20 +02:00
|
|
|
bool box_drawings_uses_font_glyphs;
|
2020-08-20 19:25:35 +02:00
|
|
|
bool can_shape_grapheme;
|
2021-04-09 23:19:20 +02:00
|
|
|
|
2021-04-29 04:12:55 -05:00
|
|
|
struct {
|
|
|
|
|
bool urgent;
|
|
|
|
|
bool notify;
|
2023-10-07 19:37:04 +02:00
|
|
|
bool flash;
|
2021-04-29 04:12:55 -05:00
|
|
|
struct config_spawn_template command;
|
|
|
|
|
bool command_focused;
|
|
|
|
|
} bell;
|
|
|
|
|
|
2020-07-25 14:31:45 +02:00
|
|
|
struct {
|
2021-11-06 12:01:57 +01:00
|
|
|
uint32_t lines;
|
2020-07-25 14:31:45 +02:00
|
|
|
|
|
|
|
|
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
|
|
|
|
fcft: adapt to API changes in fcft-3.x
Fcft no longer uses wchar_t, but plain uint32_t to represent
codepoints.
Since we do a fair amount of string operations in foot, it still makes
sense to use something that actually _is_ a string (or character),
rather than an array of uint32_t.
For this reason, we switch out all wchar_t usage in foot to
char32_t. We also verify, at compile-time, that char32_t used
UTF-32 (which is what fcft expects).
Unfortunately, there are no string functions for char32_t. To avoid
having to re-implement all wcs*() functions, we add a small wrapper
layer of c32*() functions.
These wrapper functions take char32_t arguments, but then simply call
the corresponding wcs*() function.
For this to work, wcs*() must _also_ be UTF-32 compatible. We can
check for the presence of the __STDC_ISO_10646__ macro. If set,
wchar_t is at least 4 bytes and its internal representation is UTF-32.
FreeBSD does *not* define this macro, because its internal wchar_t
representation depends on the current locale. It _does_ use UTF-32
_if_ the current locale is UTF-8.
Since foot enforces UTF-8, we simply need to check if __FreeBSD__ is
defined.
Other fcft API changes:
* fcft_glyph_rasterize() -> fcft_codepoint_rasterize()
* font.space_advance has been removed
* ‘tags’ have been removed from fcft_grapheme_rasterize()
* ‘fcft_log_init()’ removed
* ‘fcft_init()’ and ‘fcft_fini()’ must be explicitly called
2021-08-21 14:50:42 +02:00
|
|
|
char32_t *text;
|
2020-07-25 14:31:45 +02:00
|
|
|
} indicator;
|
2021-11-06 12:01:57 +01:00
|
|
|
float multiplier;
|
2020-07-25 14:31:45 +02:00
|
|
|
} scrollback;
|
2019-08-01 19:28:14 +02:00
|
|
|
|
2021-05-20 17:56:56 +02:00
|
|
|
struct {
|
fcft: adapt to API changes in fcft-3.x
Fcft no longer uses wchar_t, but plain uint32_t to represent
codepoints.
Since we do a fair amount of string operations in foot, it still makes
sense to use something that actually _is_ a string (or character),
rather than an array of uint32_t.
For this reason, we switch out all wchar_t usage in foot to
char32_t. We also verify, at compile-time, that char32_t used
UTF-32 (which is what fcft expects).
Unfortunately, there are no string functions for char32_t. To avoid
having to re-implement all wcs*() functions, we add a small wrapper
layer of c32*() functions.
These wrapper functions take char32_t arguments, but then simply call
the corresponding wcs*() function.
For this to work, wcs*() must _also_ be UTF-32 compatible. We can
check for the presence of the __STDC_ISO_10646__ macro. If set,
wchar_t is at least 4 bytes and its internal representation is UTF-32.
FreeBSD does *not* define this macro, because its internal wchar_t
representation depends on the current locale. It _does_ use UTF-32
_if_ the current locale is UTF-8.
Since foot enforces UTF-8, we simply need to check if __FreeBSD__ is
defined.
Other fcft API changes:
* fcft_glyph_rasterize() -> fcft_codepoint_rasterize()
* font.space_advance has been removed
* ‘tags’ have been removed from fcft_grapheme_rasterize()
* ‘fcft_log_init()’ removed
* ‘fcft_init()’ and ‘fcft_fini()’ must be explicitly called
2021-08-21 14:50:42 +02:00
|
|
|
char32_t *label_letters;
|
2021-05-20 17:56:56 +02:00
|
|
|
struct config_spawn_template launch;
|
|
|
|
|
enum {
|
|
|
|
|
OSC8_UNDERLINE_URL_MODE,
|
|
|
|
|
OSC8_UNDERLINE_ALWAYS,
|
|
|
|
|
} osc8_underline;
|
|
|
|
|
|
fcft: adapt to API changes in fcft-3.x
Fcft no longer uses wchar_t, but plain uint32_t to represent
codepoints.
Since we do a fair amount of string operations in foot, it still makes
sense to use something that actually _is_ a string (or character),
rather than an array of uint32_t.
For this reason, we switch out all wchar_t usage in foot to
char32_t. We also verify, at compile-time, that char32_t used
UTF-32 (which is what fcft expects).
Unfortunately, there are no string functions for char32_t. To avoid
having to re-implement all wcs*() functions, we add a small wrapper
layer of c32*() functions.
These wrapper functions take char32_t arguments, but then simply call
the corresponding wcs*() function.
For this to work, wcs*() must _also_ be UTF-32 compatible. We can
check for the presence of the __STDC_ISO_10646__ macro. If set,
wchar_t is at least 4 bytes and its internal representation is UTF-32.
FreeBSD does *not* define this macro, because its internal wchar_t
representation depends on the current locale. It _does_ use UTF-32
_if_ the current locale is UTF-8.
Since foot enforces UTF-8, we simply need to check if __FreeBSD__ is
defined.
Other fcft API changes:
* fcft_glyph_rasterize() -> fcft_codepoint_rasterize()
* font.space_advance has been removed
* ‘tags’ have been removed from fcft_grapheme_rasterize()
* ‘fcft_log_init()’ removed
* ‘fcft_init()’ and ‘fcft_fini()’ must be explicitly called
2021-08-21 14:50:42 +02:00
|
|
|
char32_t **protocols;
|
|
|
|
|
char32_t *uri_characters;
|
2021-05-20 17:58:06 +02:00
|
|
|
size_t prot_count;
|
|
|
|
|
size_t max_prot_len;
|
2021-05-20 17:56:56 +02:00
|
|
|
} url;
|
|
|
|
|
|
2019-07-21 11:06:28 +02:00
|
|
|
struct {
|
|
|
|
|
uint32_t fg;
|
|
|
|
|
uint32_t bg;
|
2023-10-07 19:37:04 +02:00
|
|
|
uint32_t flash;
|
|
|
|
|
uint32_t flash_alpha;
|
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;
|
|
|
|
|
|
2021-11-03 14:25:38 +01:00
|
|
|
uint32_t dim[8];
|
|
|
|
|
|
2021-02-06 11:10:40 +01:00
|
|
|
struct {
|
|
|
|
|
uint32_t fg;
|
|
|
|
|
uint32_t bg;
|
|
|
|
|
} jump_label;
|
2021-02-06 10:35:48 +01:00
|
|
|
|
2021-09-27 19:05:40 +00:00
|
|
|
struct {
|
|
|
|
|
uint32_t fg;
|
|
|
|
|
uint32_t bg;
|
|
|
|
|
} scrollback_indicator;
|
|
|
|
|
|
2022-07-27 19:14:27 +02:00
|
|
|
struct {
|
|
|
|
|
struct {
|
|
|
|
|
uint32_t fg;
|
|
|
|
|
uint32_t bg;
|
|
|
|
|
} no_match;
|
|
|
|
|
|
|
|
|
|
struct {
|
|
|
|
|
uint32_t fg;
|
|
|
|
|
uint32_t bg;
|
|
|
|
|
} match;
|
|
|
|
|
} search_box;
|
|
|
|
|
|
2021-02-06 10:35:48 +01:00
|
|
|
struct {
|
|
|
|
|
bool selection:1;
|
2021-02-06 11:10:40 +01:00
|
|
|
bool jump_label:1;
|
2021-09-27 19:05:40 +00:00
|
|
|
bool scrollback_indicator:1;
|
2021-02-06 11:10:40 +01:00
|
|
|
bool url:1;
|
2022-07-27 19:14:27 +02:00
|
|
|
bool search_box_no_match:1;
|
|
|
|
|
bool search_box_match:1;
|
2021-11-03 14:25:38 +01:00
|
|
|
uint8_t dim;
|
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;
|
2024-04-09 16:28:54 +02:00
|
|
|
enum cursor_unfocused_style unfocused_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;
|
2021-05-18 18:52:10 +02:00
|
|
|
struct pt_or_px underline_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;
|
input/config: support *all* modifier names
That is, allow custom modifiers (i.e. other than ctrl/shift/alt etc)
in key bindings.
This is done by no longer validating/translating modifier names to
booleans for a pre-configured set of modifiers (ctrl, shift, alt,
super).
Instead, we keep the modifier *names* in a list, in the key binding
struct.
When a keymap is loaded, and we "convert" the key binding, _then_ we
do modifier translation. For invalid modifier names, we print an
error, and then ignore it. I.e. we no longer fail to load a config due
to invalid modifier names.
We also need to update how we determine the set of significant
modifiers. Any modifier not in this list will be ignored when matching
key bindings.
Before this patch, we hardcoded this to shift/alt/ctrl/super. Now, to
handle custom modifiers as well, we simply treat *all* modifiers
defined by the current layout as significant.
Typically, the only unwanted modifiers are "locked" modifiers. We are
already filtering these out.
2023-05-06 11:39:38 +02:00
|
|
|
//struct config_key_modifiers selection_override_modifiers;
|
|
|
|
|
config_modifier_list_t selection_override_modifiers;
|
2020-08-04 07:33:15 +02:00
|
|
|
} mouse;
|
|
|
|
|
|
2020-03-08 12:08:46 +01:00
|
|
|
struct {
|
|
|
|
|
/* Bindings for "normal" mode */
|
2021-06-17 18:15:29 +02:00
|
|
|
struct config_key_binding_list key;
|
2021-12-06 21:04:38 +01:00
|
|
|
struct config_key_binding_list 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-06-17 18:15:29 +02:00
|
|
|
struct config_key_binding_list search;
|
2021-01-30 12:43:59 +01:00
|
|
|
|
|
|
|
|
/* While showing URL jump labels */
|
2021-06-17 18:15:29 +02:00
|
|
|
struct config_key_binding_list 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
|
|
|
|
2021-11-06 12:01:57 +01:00
|
|
|
uint16_t title_height;
|
|
|
|
|
uint16_t border_width;
|
|
|
|
|
uint16_t border_width_visible;
|
|
|
|
|
uint16_t button_width;
|
2020-03-02 18:42:49 +01:00
|
|
|
|
2022-04-15 20:12:34 +02:00
|
|
|
bool hide_when_maximized;
|
2023-07-14 12:03:35 +02:00
|
|
|
bool double_click_to_maximize;
|
2022-04-15 20:12:34 +02:00
|
|
|
|
2020-03-02 18:42:49 +01:00
|
|
|
struct {
|
2021-02-06 11:12:22 +01:00
|
|
|
bool title_set:1;
|
2021-06-20 10:44:50 +02:00
|
|
|
bool buttons_set:1;
|
2021-02-06 11:12:22 +01:00
|
|
|
bool minimize_set:1;
|
|
|
|
|
bool maximize_set:1;
|
|
|
|
|
bool close_set:1;
|
2021-10-27 18:27:08 +02:00
|
|
|
bool border_set:1;
|
2020-03-02 18:42:49 +01:00
|
|
|
uint32_t title;
|
2021-06-20 10:44:50 +02:00
|
|
|
uint32_t buttons;
|
2020-03-02 20:29:28 +01:00
|
|
|
uint32_t minimize;
|
|
|
|
|
uint32_t maximize;
|
2024-02-06 12:36:45 +01:00
|
|
|
uint32_t quit; /* 'close' collides with #define in epoll-shim */
|
2021-10-27 18:27:08 +02:00
|
|
|
uint32_t border;
|
2020-03-02 18:42:49 +01:00
|
|
|
} color;
|
2021-07-22 23:21:31 +02:00
|
|
|
|
|
|
|
|
struct config_font_list font;
|
2020-03-02 18:42:49 +01:00
|
|
|
} csd;
|
|
|
|
|
|
2021-11-06 12:01:57 +01:00
|
|
|
uint16_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;
|
2021-10-05 23:07:01 +02:00
|
|
|
bool notify_focus_inhibit;
|
2021-02-14 21:29:22 +01:00
|
|
|
|
2022-05-28 19:27:29 +02:00
|
|
|
env_var_list_t env_vars;
|
|
|
|
|
|
2023-05-17 20:51:40 +02:00
|
|
|
char *utmp_helper_path;
|
2022-09-23 20:24:04 +02:00
|
|
|
|
2020-03-17 16:46:54 +01:00
|
|
|
struct {
|
2020-09-13 17:59:56 +02:00
|
|
|
enum fcft_scaling_filter fcft_filter;
|
2021-06-15 11:45:27 +02:00
|
|
|
bool overflowing_glyphs;
|
2020-08-20 19:25:35 +02:00
|
|
|
bool grapheme_shaping;
|
2021-11-22 23:02:25 +01:00
|
|
|
enum {
|
|
|
|
|
GRAPHEME_WIDTH_WCSWIDTH,
|
|
|
|
|
GRAPHEME_WIDTH_DOUBLE,
|
|
|
|
|
GRAPHEME_WIDTH_MAX,
|
|
|
|
|
} grapheme_width_method;
|
2022-01-13 12:08:20 +01:00
|
|
|
enum {
|
|
|
|
|
RENDER_TIMER_NONE,
|
|
|
|
|
RENDER_TIMER_OSD,
|
|
|
|
|
RENDER_TIMER_LOG,
|
|
|
|
|
RENDER_TIMER_BOTH
|
|
|
|
|
} render_timer;
|
2020-09-06 17:52:07 +02:00
|
|
|
bool damage_whole_window;
|
2021-11-06 12:01:57 +01:00
|
|
|
uint32_t delayed_render_lower_ns;
|
|
|
|
|
uint32_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;
|
2021-08-31 19:42:22 +02:00
|
|
|
bool font_monospace_warn;
|
2022-02-27 16:29:35 +01:00
|
|
|
bool sixel;
|
2020-03-17 16:46:54 +01:00
|
|
|
} tweak;
|
2020-07-29 19:42:12 +02:00
|
|
|
|
2023-07-05 00:19:21 +08:00
|
|
|
struct {
|
|
|
|
|
uint32_t long_press_delay;
|
|
|
|
|
} touch;
|
|
|
|
|
|
2020-07-30 18:57:21 +02:00
|
|
|
user_notifications_t notifications;
|
2019-07-16 11:52:22 +02:00
|
|
|
};
|
|
|
|
|
|
2021-06-11 04:40:08 -05:00
|
|
|
bool config_override_apply(struct config *conf, config_override_t *overrides,
|
|
|
|
|
bool errors_are_fatal);
|
2020-09-08 19:17:29 +02:00
|
|
|
bool config_load(
|
|
|
|
|
struct config *conf, const char *path,
|
2021-06-11 04:40:08 -05:00
|
|
|
user_notifications_t *initial_user_notifications,
|
2023-05-02 01:53:01 +10:00
|
|
|
config_override_t *overrides, bool errors_are_fatal,
|
|
|
|
|
bool as_server);
|
2022-04-12 13:01:56 +02:00
|
|
|
void config_free(struct config *conf);
|
2021-06-18 16:18:41 +02:00
|
|
|
struct config *config_clone(const struct config *old);
|
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);
|
2021-06-17 18:15:29 +02:00
|
|
|
void config_font_list_destroy(struct config_font_list *font_list);
|
2021-08-31 19:42:22 +02:00
|
|
|
|
input/config: support *all* modifier names
That is, allow custom modifiers (i.e. other than ctrl/shift/alt etc)
in key bindings.
This is done by no longer validating/translating modifier names to
booleans for a pre-configured set of modifiers (ctrl, shift, alt,
super).
Instead, we keep the modifier *names* in a list, in the key binding
struct.
When a keymap is loaded, and we "convert" the key binding, _then_ we
do modifier translation. For invalid modifier names, we print an
error, and then ignore it. I.e. we no longer fail to load a config due
to invalid modifier names.
We also need to update how we determine the set of significant
modifiers. Any modifier not in this list will be ignored when matching
key bindings.
Before this patch, we hardcoded this to shift/alt/ctrl/super. Now, to
handle custom modifiers as well, we simply treat *all* modifiers
defined by the current layout as significant.
Typically, the only unwanted modifiers are "locked" modifiers. We are
already filtering these out.
2023-05-06 11:39:38 +02:00
|
|
|
#if 0
|
key-binding: new API, for handling sets of key bindings
Up until now, our Wayland seats have been tracking key bindings. This
makes sense, since the seat’s keymap determines how the key bindings
are resolved.
However, tying bindings to the seat/keymap alone isn’t enough, since
we also depend on the current configuration (i.e. user settings) when
resolving a key binding.
This means configurations that doesn’t match the wayland object’s
configuration, currently don’t resolve key bindings correctly. This
applies to footclients where the user has overridden key bindings on
the command line (e.g. --override key-bindings.foo=bar).
Thus, to correctly resolve key bindings, each set of key bindings must
be tied *both* to a seat/keymap, *and* a configuration.
This patch introduces a key-binding manager, with an API to
add/remove/lookup, and load/unload keymaps from sets of key bindings.
In the API, sets are tied to a seat and terminal instance, since this
makes the most sense (we need to instantiate, or incref a set whenever
a new terminal instance is created). Internally, the set is tied to a
seat and the terminal’s configuration.
Sets are *added* when a new seat is added, and when a new terminal
instance is created. Since there can only be one instance of each
seat, sets are always removed when a seat is removed.
Terminals on the other hand can re-use the same configuration (and
typically do). Thus, sets ref-count the configuration. In other words,
when instantiating a new terminal, we may not have to instantiate a
new set of key bindings, but can often be incref:ed instead.
Whenever the keymap changes on a seat, all key bindings sets
associated with that seat reloads (re-resolves) their key bindings.
Closes #931
2022-04-17 15:39:51 +02:00
|
|
|
struct seat;
|
|
|
|
|
xkb_mod_mask_t
|
|
|
|
|
conf_modifiers_to_mask(
|
|
|
|
|
const struct seat *seat, const struct config_key_modifiers *modifiers);
|
input/config: support *all* modifier names
That is, allow custom modifiers (i.e. other than ctrl/shift/alt etc)
in key bindings.
This is done by no longer validating/translating modifier names to
booleans for a pre-configured set of modifiers (ctrl, shift, alt,
super).
Instead, we keep the modifier *names* in a list, in the key binding
struct.
When a keymap is loaded, and we "convert" the key binding, _then_ we
do modifier translation. For invalid modifier names, we print an
error, and then ignore it. I.e. we no longer fail to load a config due
to invalid modifier names.
We also need to update how we determine the set of significant
modifiers. Any modifier not in this list will be ignored when matching
key bindings.
Before this patch, we hardcoded this to shift/alt/ctrl/super. Now, to
handle custom modifiers as well, we simply treat *all* modifiers
defined by the current layout as significant.
Typically, the only unwanted modifiers are "locked" modifiers. We are
already filtering these out.
2023-05-06 11:39:38 +02:00
|
|
|
#endif
|
2021-08-31 19:42:22 +02:00
|
|
|
bool check_if_font_is_monospaced(
|
|
|
|
|
const char *pattern, user_notifications_t *notifications);
|