diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2025-07-30 10:23:39 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2025-07-30 10:36:32 +0000 |
| commit | 6eedc88d70520456fbb89db2600e762e722fe313 (patch) | |
| tree | 0dbf5de4a27cc824fe8c22a907e6cdfb397c692f /main.c | |
| parent | slave: remove more environment variables set by other terminals (diff) | |
server: sigusr1/2: update conf object with the "new" theme
When sending SIGUSR1/SIGUSR2 to a server process, all currently
running client instances change their theme. But before this patch,
all future instances used the original theme. With this patch, the
server owned config object is updated with the selected theme, thus
making new instances use the same theme as well.
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 36 |
1 files changed, 23 insertions, 13 deletions
@@ -45,23 +45,28 @@ fdm_sigint(struct fdm *fdm, int signo, void *data) return true; } +struct sigusr_context { + struct terminal *term; + struct server *server; +}; + static bool fdm_sigusr(struct fdm *fdm, int signo, void *data) { - struct wayland *wayl = data; - xassert(signo == SIGUSR1 || signo == SIGUSR2); - if (signo == SIGUSR1) { - tll_foreach(wayl->terms, it) { - struct terminal *term = it->item; - term_theme_switch_to_1(term); - } + struct sigusr_context *ctx = data; + + if (ctx->server != NULL) { + if (signo == SIGUSR1) + server_global_theme_switch_to_1(ctx->server); + else + server_global_theme_switch_to_2(ctx->server); } else { - tll_foreach(wayl->terms, it) { - struct terminal *term = it->item; - term_theme_switch_to_2(term); - } + if (signo == SIGUSR1) + term_theme_switch_to_1(ctx->term); + else + term_theme_switch_to_2(ctx->term); } return true; @@ -630,8 +635,13 @@ main(int argc, char *const *argv) goto out; } - if (!fdm_signal_add(fdm, SIGUSR1, &fdm_sigusr, wayl) || - !fdm_signal_add(fdm, SIGUSR2, &fdm_sigusr, wayl)) + struct sigusr_context sigusr_context = { + .term = term, + .server = server, + }; + + if (!fdm_signal_add(fdm, SIGUSR1, &fdm_sigusr, &sigusr_context) || + !fdm_signal_add(fdm, SIGUSR2, &fdm_sigusr, &sigusr_context)) { goto out; } |
