mirror of
https://github.com/weechat/weechat.git
synced 2026-06-12 14:14:48 +02:00
core: add weechat.look.theme option and theme_applying guard
Add a new string option "weechat.look.theme" holding the name of the last theme applied via the upcoming /theme command. It is set automatically by /theme apply and persisted on disk for /theme info to display after restart; it is NOT re-applied at startup (the user's saved color values win to avoid clobbering manual post-apply tweaks). Amend config_change_color so it skips the gui_color_init_weechat () and gui_window_ask_refresh (1) calls when theme_applying is set. /theme apply will set this flag while iterating overrides so the N individual option changes do not trigger N redundant screen refreshes; the apply path then performs a single refresh at the end.
This commit is contained in:
+11
-1
@@ -50,6 +50,7 @@
|
||||
#include "core-proxy.h"
|
||||
#include "core-string.h"
|
||||
#include "core-sys.h"
|
||||
#include "core-theme.h"
|
||||
#include "core-util.h"
|
||||
#include "core-version.h"
|
||||
#include "../gui/gui-bar.h"
|
||||
@@ -222,6 +223,7 @@ struct t_config_option *config_look_separator_horizontal = NULL;
|
||||
struct t_config_option *config_look_separator_vertical = NULL;
|
||||
struct t_config_option *config_look_tab_whitespace_char = NULL;
|
||||
struct t_config_option *config_look_tab_width = NULL;
|
||||
struct t_config_option *config_look_theme = NULL;
|
||||
struct t_config_option *config_look_time_format = NULL;
|
||||
struct t_config_option *config_look_whitespace_char = NULL;
|
||||
struct t_config_option *config_look_window_auto_zoom = NULL;
|
||||
@@ -1381,7 +1383,7 @@ config_change_color (const void *pointer, void *data,
|
||||
(void) data;
|
||||
(void) option;
|
||||
|
||||
if (gui_init_ok)
|
||||
if (gui_init_ok && !theme_applying)
|
||||
{
|
||||
gui_color_init_weechat ();
|
||||
gui_window_ask_refresh (1);
|
||||
@@ -4423,6 +4425,14 @@ config_weechat_init_options (void)
|
||||
NULL, NULL, NULL,
|
||||
&config_change_tab, NULL, NULL,
|
||||
NULL, NULL, NULL);
|
||||
config_look_theme = config_file_new_option (
|
||||
weechat_config_file, weechat_config_section_look,
|
||||
"theme", "string",
|
||||
N_("name of the last theme applied with command /theme "
|
||||
"(set automatically, do not change manually); informational "
|
||||
"only, the theme is not re-applied at startup"),
|
||||
NULL, 0, 0, "", NULL, 0,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
config_look_time_format = config_file_new_option (
|
||||
weechat_config_file, weechat_config_section_look,
|
||||
"time_format", "string",
|
||||
|
||||
@@ -277,6 +277,7 @@ extern struct t_config_option *config_look_separator_horizontal;
|
||||
extern struct t_config_option *config_look_separator_vertical;
|
||||
extern struct t_config_option *config_look_tab_whitespace_char;
|
||||
extern struct t_config_option *config_look_tab_width;
|
||||
extern struct t_config_option *config_look_theme;
|
||||
extern struct t_config_option *config_look_time_format;
|
||||
extern struct t_config_option *config_look_whitespace_char;
|
||||
extern struct t_config_option *config_look_window_auto_zoom;
|
||||
|
||||
Reference in New Issue
Block a user