Add mode 2031 support (automatic dark/light mode).

Co-Author: Nicholas Marriott <nicholas.marriott@gmail.com>
This commit is contained in:
Jonathan Slenders
2024-12-11 21:56:28 +00:00
parent ef68debc8d
commit e536f48d0e
11 changed files with 338 additions and 93 deletions

View File

@@ -1544,6 +1544,23 @@ format_cb_client_written(struct format_tree *ft)
return (NULL);
}
/* Callback for client_theme. */
static void *
format_cb_client_theme(struct format_tree *ft)
{
if (ft->c != NULL) {
switch (ft->c->theme) {
case THEME_DARK:
return (xstrdup("dark"));
case THEME_LIGHT:
return (xstrdup("light"));
case THEME_UNKNOWN:
return (NULL);
}
}
return (NULL);
}
/* Callback for config_files. */
static void *
format_cb_config_files(__unused struct format_tree *ft)
@@ -2881,6 +2898,9 @@ static const struct format_table_entry format_table[] = {
{ "client_termtype", FORMAT_TABLE_STRING,
format_cb_client_termtype
},
{ "client_theme", FORMAT_TABLE_STRING,
format_cb_client_theme
},
{ "client_tty", FORMAT_TABLE_STRING,
format_cb_client_tty
},