diff --git a/src/conky.cc b/src/conky.cc index 60e2bf4a..c7a0a177 100644 --- a/src/conky.cc +++ b/src/conky.cc @@ -2574,7 +2574,6 @@ static void set_default_configurations(void) #ifdef OWN_WINDOW window.type = TYPE_NORMAL; window.hints = 0; - sprintf(window.title, PACKAGE_NAME" (%s)", info.uname_s.nodename); #ifdef BUILD_ARGB use_argb_visual = 0; own_window_argb_value = 255; @@ -3242,12 +3241,6 @@ char load_config_file(const char *f) } #ifdef BUILD_X11 #ifdef OWN_WINDOW - CONF("own_window_title") { - if (value) { - memset(window.title, 0, sizeof(window.title)); - strncpy(window.title, value, sizeof(window.title) - 1); - } - } CONF("own_window_transparent") { if (value) { set_transparent = string_to_bool(value); diff --git a/src/x11.cc b/src/x11.cc index ece605eb..a6ae772b 100644 --- a/src/x11.cc +++ b/src/x11.cc @@ -378,7 +378,7 @@ void init_window(int w, int h, int set_trans, int back_colour, XmbSetWMProperties(display, window.window, NULL, NULL, argv, argc, NULL, &wmHint, &classHint); - XStoreName(display, window.window, window.title); + XStoreName(display, window.window, own_window_title.get(*state).c_str() ); /* Sets an empty WM_PROTOCOLS property */ XSetWMProtocols(display, window.window, NULL, 0); @@ -940,4 +940,12 @@ conky::config_setting out_to_x("out_to_x", conky::simple_accessors(f conky::config_setting own_window("own_window", conky::simple_accessors(false, false)); conky::config_setting own_window_class("own_window_class", conky::simple_accessors(PACKAGE_NAME, false)); + +namespace { + // used to set the default value for own_window_title + std::string gethostnamecxx() + { update_uname(); return info.uname_s.nodename; } +} +conky::config_setting own_window_title("own_window_title", + conky::simple_accessors(PACKAGE_NAME " (" + gethostnamecxx()+")", false)); #endif diff --git a/src/x11.h b/src/x11.h index a008033f..40a3c40e 100644 --- a/src/x11.h +++ b/src/x11.h @@ -83,7 +83,6 @@ struct conky_window { int width; int height; #ifdef OWN_WINDOW - char title[256]; int x; int y; unsigned int type; @@ -158,6 +157,7 @@ extern conky::config_setting out_to_x; #ifdef OWN_WINDOW extern conky::config_setting own_window; extern conky::config_setting own_window_class; +extern conky::config_setting own_window_title; #endif #endif /*X11_H_*/