mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-17 22:05:22 -05:00
config: move cursor.hide-when-typing to mouse.hide-when-typing
This commit is contained in:
parent
8f04e898af
commit
d929862245
6 changed files with 38 additions and 10 deletions
|
|
@ -25,7 +25,7 @@
|
||||||
* **pipe-selected** key binding. Works like **pipe-visible** and
|
* **pipe-selected** key binding. Works like **pipe-visible** and
|
||||||
**pipe-scrollback**, but only pipes the currently selected text, if
|
**pipe-scrollback**, but only pipes the currently selected text, if
|
||||||
any (https://codeberg.org/dnkl/foot/issues/51).
|
any (https://codeberg.org/dnkl/foot/issues/51).
|
||||||
* **cursor.hide-when-typing** option to `footrc.
|
* **mouse.hide-when-typing** option to `footrc`.
|
||||||
* **scrollback.multiplier** option to `footrc`
|
* **scrollback.multiplier** option to `footrc`
|
||||||
(https://codeberg.org/dnkl/foot/issues/54).
|
(https://codeberg.org/dnkl/foot/issues/54).
|
||||||
|
|
||||||
|
|
|
||||||
24
config.c
24
config.c
|
|
@ -528,9 +528,6 @@ parse_section_cursor(const char *key, const char *value, struct config *conf,
|
||||||
else if (strcmp(key, "blink") == 0)
|
else if (strcmp(key, "blink") == 0)
|
||||||
conf->cursor.blink = str_to_bool(value);
|
conf->cursor.blink = str_to_bool(value);
|
||||||
|
|
||||||
else if (strcmp(key, "hide-when-typing") == 0)
|
|
||||||
conf->cursor.hide_when_typing = str_to_bool(value);
|
|
||||||
|
|
||||||
else if (strcmp(key, "color") == 0) {
|
else if (strcmp(key, "color") == 0) {
|
||||||
char *value_copy = strdup(value);
|
char *value_copy = strdup(value);
|
||||||
const char *text = strtok(value_copy, " ");
|
const char *text = strtok(value_copy, " ");
|
||||||
|
|
@ -559,6 +556,21 @@ parse_section_cursor(const char *key, const char *value, struct config *conf,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool
|
||||||
|
parse_section_mouse(const char *key, const char *value, struct config *conf,
|
||||||
|
const char *path, unsigned lineno)
|
||||||
|
{
|
||||||
|
if (strcmp(key, "hide-when-typing") == 0)
|
||||||
|
conf->mouse.hide_when_typing = str_to_bool(value);
|
||||||
|
|
||||||
|
else {
|
||||||
|
LOG_AND_NOTIFY_ERR("%s:%d: [mouse]: %s: invalid key", path, lineno, key);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
parse_section_csd(const char *key, const char *value, struct config *conf,
|
parse_section_csd(const char *key, const char *value, struct config *conf,
|
||||||
const char *path, unsigned lineno)
|
const char *path, unsigned lineno)
|
||||||
|
|
@ -1029,6 +1041,7 @@ parse_config_file(FILE *f, struct config *conf, const char *path, bool errors_ar
|
||||||
SECTION_SCROLLBACK,
|
SECTION_SCROLLBACK,
|
||||||
SECTION_COLORS,
|
SECTION_COLORS,
|
||||||
SECTION_CURSOR,
|
SECTION_CURSOR,
|
||||||
|
SECTION_MOUSE,
|
||||||
SECTION_CSD,
|
SECTION_CSD,
|
||||||
SECTION_KEY_BINDINGS,
|
SECTION_KEY_BINDINGS,
|
||||||
SECTION_SEARCH_BINDINGS,
|
SECTION_SEARCH_BINDINGS,
|
||||||
|
|
@ -1050,6 +1063,7 @@ parse_config_file(FILE *f, struct config *conf, const char *path, bool errors_ar
|
||||||
[SECTION_SCROLLBACK] = {&parse_section_scrollback, "scrollback"},
|
[SECTION_SCROLLBACK] = {&parse_section_scrollback, "scrollback"},
|
||||||
[SECTION_COLORS] = {&parse_section_colors, "colors"},
|
[SECTION_COLORS] = {&parse_section_colors, "colors"},
|
||||||
[SECTION_CURSOR] = {&parse_section_cursor, "cursor"},
|
[SECTION_CURSOR] = {&parse_section_cursor, "cursor"},
|
||||||
|
[SECTION_MOUSE] = {&parse_section_mouse, "mouse"},
|
||||||
[SECTION_CSD] = {&parse_section_csd, "csd"},
|
[SECTION_CSD] = {&parse_section_csd, "csd"},
|
||||||
[SECTION_KEY_BINDINGS] = {&parse_section_key_bindings, "key-bindings"},
|
[SECTION_KEY_BINDINGS] = {&parse_section_key_bindings, "key-bindings"},
|
||||||
[SECTION_SEARCH_BINDINGS] = {&parse_section_search_bindings, "search-bindings"},
|
[SECTION_SEARCH_BINDINGS] = {&parse_section_search_bindings, "search-bindings"},
|
||||||
|
|
@ -1260,12 +1274,14 @@ config_load(struct config *conf, const char *conf_path, bool errors_are_fatal)
|
||||||
.cursor = {
|
.cursor = {
|
||||||
.style = CURSOR_BLOCK,
|
.style = CURSOR_BLOCK,
|
||||||
.blink = false,
|
.blink = false,
|
||||||
.hide_when_typing = false,
|
|
||||||
.color = {
|
.color = {
|
||||||
.text = 0,
|
.text = 0,
|
||||||
.cursor = 0,
|
.cursor = 0,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
.mouse = {
|
||||||
|
.hide_when_typing = false,
|
||||||
|
},
|
||||||
.csd = {
|
.csd = {
|
||||||
.preferred = CONF_CSD_PREFER_SERVER,
|
.preferred = CONF_CSD_PREFER_SERVER,
|
||||||
.title_height = 26,
|
.title_height = 26,
|
||||||
|
|
|
||||||
5
config.h
5
config.h
|
|
@ -75,13 +75,16 @@ struct config {
|
||||||
struct {
|
struct {
|
||||||
enum cursor_style style;
|
enum cursor_style style;
|
||||||
bool blink;
|
bool blink;
|
||||||
bool hide_when_typing;
|
|
||||||
struct {
|
struct {
|
||||||
uint32_t text;
|
uint32_t text;
|
||||||
uint32_t cursor;
|
uint32_t cursor;
|
||||||
} color;
|
} color;
|
||||||
} cursor;
|
} cursor;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
bool hide_when_typing;
|
||||||
|
} mouse;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
/* Bindings for "normal" mode */
|
/* Bindings for "normal" mode */
|
||||||
tll(struct config_key_binding_normal) key;
|
tll(struct config_key_binding_normal) key;
|
||||||
|
|
|
||||||
|
|
@ -110,9 +110,6 @@ applications can change these at runtime.
|
||||||
Boolean. Enables blinking cursor. Note that this can be overridden
|
Boolean. Enables blinking cursor. Note that this can be overridden
|
||||||
by applications. Default: _no_.
|
by applications. Default: _no_.
|
||||||
|
|
||||||
*hide-when-typing*
|
|
||||||
Boolean. When enabled, the mouse cursor is hidden while typing.
|
|
||||||
|
|
||||||
*color*
|
*color*
|
||||||
Two RRGGBB values specifying the foreground (text) and background
|
Two RRGGBB values specifying the foreground (text) and background
|
||||||
(cursor) colors for the cursor. Default: inversed foreground and
|
(cursor) colors for the cursor. Default: inversed foreground and
|
||||||
|
|
@ -120,6 +117,13 @@ applications can change these at runtime.
|
||||||
cursor. The other cursor styles are always rendered with the
|
cursor. The other cursor styles are always rendered with the
|
||||||
foreground color.
|
foreground color.
|
||||||
|
|
||||||
|
|
||||||
|
# SECTION: mouse
|
||||||
|
|
||||||
|
*hide-when-typing*
|
||||||
|
Boolean. When enabled, the mouse cursor is hidden while typing.
|
||||||
|
|
||||||
|
|
||||||
# SECTION: colors
|
# SECTION: colors
|
||||||
|
|
||||||
This section controls the 16 ANSI colors and the default foreground
|
This section controls the 16 ANSI colors and the default foreground
|
||||||
|
|
@ -152,6 +156,7 @@ _alpha_ option.
|
||||||
Background translucency. A value in the range 0.0-1.0, where 0.0
|
Background translucency. A value in the range 0.0-1.0, where 0.0
|
||||||
means completely transparent, and 1.0 is opaque. Default: _1.0_.
|
means completely transparent, and 1.0 is opaque. Default: _1.0_.
|
||||||
|
|
||||||
|
|
||||||
# SECTION: csd
|
# SECTION: csd
|
||||||
|
|
||||||
This section controls the look of the _CSDs_ (Client Side
|
This section controls the look of the _CSDs_ (Client Side
|
||||||
|
|
@ -193,6 +198,7 @@ component.
|
||||||
Close button's AARRGGBB color. Default: use the default _regular1_
|
Close button's AARRGGBB color. Default: use the default _regular1_
|
||||||
color (red).
|
color (red).
|
||||||
|
|
||||||
|
|
||||||
# SECTION: key-bindings
|
# SECTION: key-bindings
|
||||||
|
|
||||||
This section lets you override the default key bindings.
|
This section lets you override the default key bindings.
|
||||||
|
|
@ -276,6 +282,7 @@ e.g. *search-start=none*.
|
||||||
|
|
||||||
Default: _not bound_
|
Default: _not bound_
|
||||||
|
|
||||||
|
|
||||||
# SECTION: search-bindings
|
# SECTION: search-bindings
|
||||||
|
|
||||||
This section lets you override the default key bindings used in
|
This section lets you override the default key bindings used in
|
||||||
|
|
|
||||||
2
footrc
2
footrc
|
|
@ -19,6 +19,8 @@
|
||||||
# style=block
|
# style=block
|
||||||
# color=111111 dcdccc
|
# color=111111 dcdccc
|
||||||
# blink=no
|
# blink=no
|
||||||
|
|
||||||
|
[mouse]
|
||||||
# hide-when-typing=no
|
# hide-when-typing=no
|
||||||
|
|
||||||
[colors]
|
[colors]
|
||||||
|
|
|
||||||
2
input.c
2
input.c
|
|
@ -700,7 +700,7 @@ keyboard_key(void *data, struct wl_keyboard *wl_keyboard, uint32_t serial,
|
||||||
bool should_repeat = xkb_keymap_key_repeats(seat->kbd.xkb_keymap, key);
|
bool should_repeat = xkb_keymap_key_repeats(seat->kbd.xkb_keymap, key);
|
||||||
xkb_keysym_t sym = xkb_state_key_get_one_sym(seat->kbd.xkb_state, key);
|
xkb_keysym_t sym = xkb_state_key_get_one_sym(seat->kbd.xkb_state, key);
|
||||||
|
|
||||||
if (state == XKB_KEY_DOWN && term->conf->cursor.hide_when_typing &&
|
if (state == XKB_KEY_DOWN && term->conf->mouse.hide_when_typing &&
|
||||||
/* TODO: better way to detect modifers */
|
/* TODO: better way to detect modifers */
|
||||||
sym != XKB_KEY_Shift_L && sym != XKB_KEY_Shift_R &&
|
sym != XKB_KEY_Shift_L && sym != XKB_KEY_Shift_R &&
|
||||||
sym != XKB_KEY_Control_L && sym != XKB_KEY_Control_R &&
|
sym != XKB_KEY_Control_L && sym != XKB_KEY_Control_R &&
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue