mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-29 07:58:01 -04:00
main: do a theme toggle upon receiving SIGUSR1
Caveat: in server mode, *all* instances toggle their themes.
This commit is contained in:
parent
33eefa7b45
commit
d9675a7140
2 changed files with 19 additions and 0 deletions
|
|
@ -73,6 +73,8 @@
|
||||||
`key-bindings.color-theme-toggle` key bindings. These can be used to
|
`key-bindings.color-theme-toggle` key bindings. These can be used to
|
||||||
switch between the primary and alternative color themes. They are
|
switch between the primary and alternative color themes. They are
|
||||||
not bound by default.
|
not bound by default.
|
||||||
|
* Sending `SIGUSR1` to the foot process now triggers a theme switch
|
||||||
|
(in server mode, **all** instances toggles their themes).
|
||||||
* Support for private mode 2031 - [_Dark and Light Mode
|
* Support for private mode 2031 - [_Dark and Light Mode
|
||||||
Detection_](https://contour-terminal.org/vt-extensions/color-palette-update-notifications/)
|
Detection_](https://contour-terminal.org/vt-extensions/color-palette-update-notifications/)
|
||||||
([#2025][2025])
|
([#2025][2025])
|
||||||
|
|
|
||||||
17
main.c
17
main.c
|
|
@ -45,6 +45,19 @@ fdm_sigint(struct fdm *fdm, int signo, void *data)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool
|
||||||
|
fdm_sigusr1(struct fdm *fdm, int signo, void *data)
|
||||||
|
{
|
||||||
|
struct wayland *wayl = data;
|
||||||
|
|
||||||
|
tll_foreach(wayl->terms, it) {
|
||||||
|
struct terminal *term = it->item;
|
||||||
|
term_theme_toggle(term);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_usage(const char *prog_name)
|
print_usage(const char *prog_name)
|
||||||
{
|
{
|
||||||
|
|
@ -608,6 +621,9 @@ main(int argc, char *const *argv)
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!fdm_signal_add(fdm, SIGUSR1, &fdm_sigusr1, wayl))
|
||||||
|
goto out;
|
||||||
|
|
||||||
struct sigaction sig_ign = {.sa_handler = SIG_IGN};
|
struct sigaction sig_ign = {.sa_handler = SIG_IGN};
|
||||||
sigemptyset(&sig_ign.sa_mask);
|
sigemptyset(&sig_ign.sa_mask);
|
||||||
if (sigaction(SIGHUP, &sig_ign, NULL) < 0 ||
|
if (sigaction(SIGHUP, &sig_ign, NULL) < 0 ||
|
||||||
|
|
@ -643,6 +659,7 @@ out:
|
||||||
wayl_destroy(wayl);
|
wayl_destroy(wayl);
|
||||||
key_binding_manager_destroy(key_binding_manager);
|
key_binding_manager_destroy(key_binding_manager);
|
||||||
reaper_destroy(reaper);
|
reaper_destroy(reaper);
|
||||||
|
fdm_signal_del(fdm, SIGUSR1);
|
||||||
fdm_signal_del(fdm, SIGTERM);
|
fdm_signal_del(fdm, SIGTERM);
|
||||||
fdm_signal_del(fdm, SIGINT);
|
fdm_signal_del(fdm, SIGINT);
|
||||||
fdm_destroy(fdm);
|
fdm_destroy(fdm);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue