key-bindings: add bindings to switch between color themes

* color-theme-switch-1: select the primary color theme
* color-theme-switch-2: select the alternative color theme
* color-theme-toggle: toggle between the primary and alternative color themes
This commit is contained in:
Daniel Eklöf 2025-04-20 07:58:02 +02:00
parent 1423babc35
commit 6bc91b5e28
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
8 changed files with 102 additions and 11 deletions

45
input.c
View file

@ -484,6 +484,51 @@ execute_binding(struct seat *seat, struct terminal *term,
return true;
case BIND_ACTION_THEME_SWITCH_1:
if (term->colors.active_theme != COLOR_THEME1) {
term_theme_apply(term, &term->conf->colors);
term->colors.active_theme = COLOR_THEME1;
wayl_win_alpha_changed(term->window);
term_font_subpixel_changed(term);
term_damage_view(term);
term_damage_margins(term);
render_refresh(term);
}
return true;
case BIND_ACTION_THEME_SWITCH_2:
if (term->colors.active_theme != COLOR_THEME2) {
term_theme_apply(term, &term->conf->colors2);
term->colors.active_theme = COLOR_THEME2;
wayl_win_alpha_changed(term->window);
term_font_subpixel_changed(term);
term_damage_view(term);
term_damage_margins(term);
render_refresh(term);
}
return true;
case BIND_ACTION_THEME_TOGGLE:
if (term->colors.active_theme == COLOR_THEME1) {
term_theme_apply(term, &term->conf->colors2);
term->colors.active_theme = COLOR_THEME2;
} else {
term_theme_apply(term, &term->conf->colors);
term->colors.active_theme = COLOR_THEME1;
}
wayl_win_alpha_changed(term->window);
term_font_subpixel_changed(term);
term_damage_view(term);
term_damage_margins(term);
render_refresh(term);
return true;
case BIND_ACTION_SELECT_BEGIN:
selection_start(
term, seat->mouse.col, seat->mouse.row, SELECTION_CHAR_WISE, false);