mirror of
https://github.com/Llewellynvdm/conky.git
synced 2025-01-14 19:39:47 +00:00
make own_window_class a lua setting
This commit is contained in:
parent
efac83e814
commit
fad11cabe1
@ -2574,7 +2574,6 @@ static void set_default_configurations(void)
|
||||
#ifdef OWN_WINDOW
|
||||
window.type = TYPE_NORMAL;
|
||||
window.hints = 0;
|
||||
strcpy(window.class_name, PACKAGE_NAME);
|
||||
sprintf(window.title, PACKAGE_NAME" (%s)", info.uname_s.nodename);
|
||||
#ifdef BUILD_ARGB
|
||||
use_argb_visual = 0;
|
||||
@ -3243,13 +3242,6 @@ char load_config_file(const char *f)
|
||||
}
|
||||
#ifdef BUILD_X11
|
||||
#ifdef OWN_WINDOW
|
||||
CONF("own_window_class") {
|
||||
if (value) {
|
||||
memset(window.class_name, 0, sizeof(window.class_name));
|
||||
strncpy(window.class_name, value,
|
||||
sizeof(window.class_name) - 1);
|
||||
}
|
||||
}
|
||||
CONF("own_window_title") {
|
||||
if (value) {
|
||||
memset(window.title, 0, sizeof(window.title));
|
||||
|
11
src/x11.cc
11
src/x11.cc
@ -356,7 +356,14 @@ void init_window(int w, int h, int set_trans, int back_colour,
|
||||
window.y, w, h, 0, depth, InputOutput, visual,
|
||||
flags, &attrs);
|
||||
|
||||
classHint.res_name = window.class_name;
|
||||
// class_name must be a named local variable, so that c_str() remains valid until we
|
||||
// call XmbSetWMProperties(). We use const_cast because, for whatever reason,
|
||||
// res_name is not declared as const char *. XmbSetWMProperties hopefully doesn't
|
||||
// modify the value (hell, even their own example app assigns a literal string
|
||||
// constant to the field)
|
||||
const std::string &class_name = own_window_class.get(*state);
|
||||
|
||||
classHint.res_name = const_cast<char *>(class_name.c_str());
|
||||
classHint.res_class = classHint.res_name;
|
||||
|
||||
wmHint.flags = InputHint | StateHint;
|
||||
@ -931,4 +938,6 @@ conky::config_setting<bool> out_to_x("out_to_x", conky::simple_accessors<bool>(f
|
||||
|
||||
#ifdef OWN_WINDOW
|
||||
conky::config_setting<bool> own_window("own_window", conky::simple_accessors<bool>(false, false));
|
||||
conky::config_setting<std::string> own_window_class("own_window_class",
|
||||
conky::simple_accessors<std::string>(PACKAGE_NAME, false));
|
||||
#endif
|
||||
|
@ -83,7 +83,6 @@ struct conky_window {
|
||||
int width;
|
||||
int height;
|
||||
#ifdef OWN_WINDOW
|
||||
char class_name[256];
|
||||
char title[256];
|
||||
int x;
|
||||
int y;
|
||||
@ -158,6 +157,7 @@ extern conky::config_setting<bool> out_to_x;
|
||||
|
||||
#ifdef OWN_WINDOW
|
||||
extern conky::config_setting<bool> own_window;
|
||||
extern conky::config_setting<std::string> own_window_class;
|
||||
#endif
|
||||
|
||||
#endif /*X11_H_*/
|
||||
|
Loading…
Reference in New Issue
Block a user