1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-03 16:23:14 +02:00

core: add themable flag to configuration options

Add an "int themable" field on struct t_config_option. The flag is set
automatically for every CONFIG_OPTION_TYPE_COLOR option, and may be set
explicitly on any other type by suffixing the type argument with
"|themable" in the call to config_file_new_option (e.g. "string|themable"
for a string option whose value contains "${color:...}" references).

Opt in the relevant string options in core (buffer_time_format,
day_change_message_*, item_time_format, nick_color_force, prefix_*,
chat_nick_colors, eval_syntax_colors, color palette aliases) and in the
buflist, fset, irc, relay plugins.

The flag is exposed via hdata, infolist, and print_log so scripts and
/debug can read it. This is the foundation for an upcoming /theme
command that will only be allowed to modify themable options.
This commit is contained in:
Sébastien Helleu
2026-05-25 22:55:12 +02:00
parent 5a2c412ded
commit 65a772ca38
7 changed files with 74 additions and 39 deletions
+15 -15
View File
@@ -645,7 +645,7 @@ buflist_config_init (void)
{
buflist_config_format_buffer = weechat_config_new_option (
buflist_config_file, buflist_config_section_format,
"buffer", "string",
"buffer", "string|themable",
N_("format of each line with a buffer "
"(note: content is evaluated, see /help buflist); "
"example: standard format for bar item \"buflist\" and only the "
@@ -663,7 +663,7 @@ buflist_config_init (void)
NULL, NULL, NULL);
buflist_config_format_buffer_current = weechat_config_new_option (
buflist_config_file, buflist_config_section_format,
"buffer_current", "string",
"buffer_current", "string|themable",
N_("format for the line with current buffer "
"(note: content is evaluated, see /help buflist)"),
NULL, 0, 0, "${color:,17}${format_buffer}", NULL, 0,
@@ -672,7 +672,7 @@ buflist_config_init (void)
NULL, NULL, NULL);
buflist_config_format_hotlist = weechat_config_new_option (
buflist_config_file, buflist_config_section_format,
"hotlist", "string",
"hotlist", "string|themable",
N_("format for hotlist "
"(note: content is evaluated, see /help buflist)"),
NULL, 0, 0,
@@ -683,7 +683,7 @@ buflist_config_init (void)
NULL, NULL, NULL);
buflist_config_format_hotlist_level[3] = weechat_config_new_option (
buflist_config_file, buflist_config_section_format,
"hotlist_highlight", "string",
"hotlist_highlight", "string|themable",
N_("format for a buffer with hotlist level \"highlight\" "
"(note: content is evaluated, see /help buflist)"),
NULL, 0, 0, "${color:magenta}", NULL, 0,
@@ -692,7 +692,7 @@ buflist_config_init (void)
NULL, NULL, NULL);
buflist_config_format_hotlist_level[0] = weechat_config_new_option (
buflist_config_file, buflist_config_section_format,
"hotlist_low", "string",
"hotlist_low", "string|themable",
N_("format for a buffer with hotlist level \"low\" "
"(note: content is evaluated, see /help buflist)"),
NULL, 0, 0, "${color:white}", NULL, 0,
@@ -701,7 +701,7 @@ buflist_config_init (void)
NULL, NULL, NULL);
buflist_config_format_hotlist_level[1] = weechat_config_new_option (
buflist_config_file, buflist_config_section_format,
"hotlist_message", "string",
"hotlist_message", "string|themable",
N_("format for a buffer with hotlist level \"message\" "
"(note: content is evaluated, see /help buflist)"),
NULL, 0, 0, "${color:brown}", NULL, 0,
@@ -710,7 +710,7 @@ buflist_config_init (void)
NULL, NULL, NULL);
buflist_config_format_hotlist_level_none = weechat_config_new_option (
buflist_config_file, buflist_config_section_format,
"hotlist_none", "string",
"hotlist_none", "string|themable",
N_("format for a buffer not in hotlist "
"(note: content is evaluated, see /help buflist)"),
NULL, 0, 0, "${color:default}", NULL, 0,
@@ -719,7 +719,7 @@ buflist_config_init (void)
NULL, NULL, NULL);
buflist_config_format_hotlist_level[2] = weechat_config_new_option (
buflist_config_file, buflist_config_section_format,
"hotlist_private", "string",
"hotlist_private", "string|themable",
N_("format for a buffer with hotlist level \"private\" "
"(note: content is evaluated, see /help buflist)"),
NULL, 0, 0, "${color:green}", NULL, 0,
@@ -728,7 +728,7 @@ buflist_config_init (void)
NULL, NULL, NULL);
buflist_config_format_hotlist_separator = weechat_config_new_option (
buflist_config_file, buflist_config_section_format,
"hotlist_separator", "string",
"hotlist_separator", "string|themable",
N_("separator for counts in hotlist "
"(note: content is evaluated, see /help buflist)"),
NULL, 0, 0, "${color:default},", NULL, 0,
@@ -737,7 +737,7 @@ buflist_config_init (void)
NULL, NULL, NULL);
buflist_config_format_indent = weechat_config_new_option (
buflist_config_file, buflist_config_section_format,
"indent", "string",
"indent", "string|themable",
N_("string displayed to indent channel, private and list buffers "
"(note: content is evaluated, see /help buflist)"),
NULL, 0, 0, " ", NULL, 0,
@@ -746,7 +746,7 @@ buflist_config_init (void)
NULL, NULL, NULL);
buflist_config_format_lag = weechat_config_new_option (
buflist_config_file, buflist_config_section_format,
"lag", "string",
"lag", "string|themable",
N_("format for lag on an IRC server buffer "
"(note: content is evaluated, see /help buflist)"),
NULL, 0, 0,
@@ -757,7 +757,7 @@ buflist_config_init (void)
NULL, NULL, NULL);
buflist_config_format_name = weechat_config_new_option (
buflist_config_file, buflist_config_section_format,
"name", "string",
"name", "string|themable",
N_("format for buffer name "
"(note: content is evaluated, see /help buflist)"),
NULL, 0, 0, "${name}", NULL, 0,
@@ -766,7 +766,7 @@ buflist_config_init (void)
NULL, NULL, NULL);
buflist_config_format_nick_prefix = weechat_config_new_option (
buflist_config_file, buflist_config_section_format,
"nick_prefix", "string",
"nick_prefix", "string|themable",
N_("format for nick prefix on a channel "
"(note: content is evaluated, see /help buflist)"),
NULL, 0, 0, "${color_nick_prefix}${nick_prefix}", NULL, 0,
@@ -775,7 +775,7 @@ buflist_config_init (void)
NULL, NULL, NULL);
buflist_config_format_number = weechat_config_new_option (
buflist_config_file, buflist_config_section_format,
"number", "string",
"number", "string|themable",
N_("format for buffer number, ${number} is the indented number "
"(note: content is evaluated, see /help buflist)"),
NULL, 0, 0,
@@ -786,7 +786,7 @@ buflist_config_init (void)
NULL, NULL, NULL);
buflist_config_format_tls_version = weechat_config_new_option (
buflist_config_file, buflist_config_section_format,
"tls_version", "string",
"tls_version", "string|themable",
N_("format for TLS version on an IRC server buffer "
"(note: content is evaluated, see /help buflist)"),
NULL, 0, 0,
+1 -1
View File
@@ -572,7 +572,7 @@ fset_config_init (void)
NULL, NULL, NULL);
fset_config_format_option[1] = weechat_config_new_option (
fset_config_file, fset_config_section_format,
"option2", "string",
"option2", "string|themable",
N_("second format of each line, used when option "
"fset.look.format_number is set to 2 "
"(note: content is evaluated, see /help fset); "
+3 -3
View File
@@ -3957,7 +3957,7 @@ irc_config_init (void)
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_color_mirc_remap = weechat_config_new_option (
irc_config_file, irc_config_section_color,
"mirc_remap", "string",
"mirc_remap", "string|themable",
/* TRANSLATORS: please do not translate the list of WeeChat color names at the end of string */
N_("remap mirc colors in messages using a hashtable (used only "
"for standard colors, not RGB colors): keys are \"fg,bg\" as "
@@ -3975,7 +3975,7 @@ irc_config_init (void)
NULL, NULL, NULL);
irc_config_color_nick_prefixes = weechat_config_new_option (
irc_config_file, irc_config_section_color,
"nick_prefixes", "string",
"nick_prefixes", "string|themable",
N_("color for nick prefixes using mode char (o=op, h=halfop, "
"v=voice, ..), format is: \"o:color1;h:color2;v:color3\" (if a "
"mode is not found, WeeChat will try with next modes received "
@@ -4006,7 +4006,7 @@ irc_config_init (void)
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_color_term_remap = weechat_config_new_option (
irc_config_file, irc_config_section_color,
"term_remap", "string",
"term_remap", "string|themable",
N_("remap terminal color numbers in messages using a hashtable "
"(used only for RGB colors as hexadecimal, which are first "
"translated to terminal color numbers): keys are \"fg,bg\" as "
+2 -2
View File
@@ -1934,7 +1934,7 @@ relay_config_init (void)
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
relay_config_api_remote_input_cmd_local = weechat_config_new_option (
relay_config_file, relay_config_section_api,
"remote_input_cmd_local", "string",
"remote_input_cmd_local", "string|themable",
N_("text displayed after user input when the command would be "
"executed locally (NOT sent to the remote WeeChat) "
"(note: content is evaluated, see /help eval)"),
@@ -1942,7 +1942,7 @@ relay_config_init (void)
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
relay_config_api_remote_input_cmd_remote = weechat_config_new_option (
relay_config_file, relay_config_section_api,
"remote_input_cmd_remote", "string",
"remote_input_cmd_remote", "string|themable",
N_("text displayed after user input when the command would be "
"executed on the remote WeeChat (NOT executed locally) "
"(note: content is evaluated, see /help eval)"),