mirror of
https://github.com/Llewellynvdm/conky.git
synced 2025-02-06 14:09:29 +00:00
Make display a lua setting
This commit is contained in:
parent
70d53b770f
commit
fe9c0609cc
22
src/conky.cc
22
src/conky.cc
@ -308,9 +308,6 @@ struct _x11_stuff_s {
|
|||||||
static int text_start_x, text_start_y; /* text start position in window */
|
static int text_start_x, text_start_y; /* text start position in window */
|
||||||
static int text_width = 1, text_height = 1; /* initially 1 so no zero-sized window is created */
|
static int text_width = 1, text_height = 1; /* initially 1 so no zero-sized window is created */
|
||||||
|
|
||||||
/* display to connect to */
|
|
||||||
static char *disp = NULL;
|
|
||||||
|
|
||||||
#endif /* BUILD_X11 */
|
#endif /* BUILD_X11 */
|
||||||
|
|
||||||
/* struct that has all info to be shared between
|
/* struct that has all info to be shared between
|
||||||
@ -2246,7 +2243,6 @@ static void main_loop(void)
|
|||||||
XFixesDestroyRegion(display, x11_stuff.region2);
|
XFixesDestroyRegion(display, x11_stuff.region2);
|
||||||
XFixesDestroyRegion(display, x11_stuff.part);
|
XFixesDestroyRegion(display, x11_stuff.part);
|
||||||
#endif /* BUILD_XDAMAGE */
|
#endif /* BUILD_XDAMAGE */
|
||||||
free_and_zero(disp);
|
|
||||||
}
|
}
|
||||||
#endif /* BUILD_X11 */
|
#endif /* BUILD_X11 */
|
||||||
free_and_zero(overwrite_file);
|
free_and_zero(overwrite_file);
|
||||||
@ -2662,7 +2658,7 @@ static void X11_initialisation(void)
|
|||||||
if (x_initialised == YES) return;
|
if (x_initialised == YES) return;
|
||||||
state->pushboolean(true);
|
state->pushboolean(true);
|
||||||
out_to_x.lua_set(*state);
|
out_to_x.lua_set(*state);
|
||||||
init_X11(disp);
|
init_X11();
|
||||||
set_default_configurations_for_x();
|
set_default_configurations_for_x();
|
||||||
x_initialised = YES;
|
x_initialised = YES;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -2811,14 +2807,6 @@ char load_config_file(const char *f)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_X11
|
||||||
CONF("display") {
|
|
||||||
if (!value || x_initialised == YES) {
|
|
||||||
CONF_ERR;
|
|
||||||
} else {
|
|
||||||
free_and_zero(disp);
|
|
||||||
disp = strdup(value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
CONF("background") {
|
CONF("background") {
|
||||||
fork_to_background = string_to_bool(value);
|
fork_to_background = string_to_bool(value);
|
||||||
}
|
}
|
||||||
@ -3850,6 +3838,10 @@ void initialisation(int argc, char **argv) {
|
|||||||
state->pushstring(optarg);
|
state->pushstring(optarg);
|
||||||
text_alignment.lua_set(*state);
|
text_alignment.lua_set(*state);
|
||||||
break;
|
break;
|
||||||
|
case 'X':
|
||||||
|
state->pushstring(optarg);
|
||||||
|
display_name.lua_set(*state);
|
||||||
|
break;
|
||||||
|
|
||||||
#ifdef OWN_WINDOW
|
#ifdef OWN_WINDOW
|
||||||
case 'o':
|
case 'o':
|
||||||
@ -4051,10 +4043,6 @@ int main(int argc, char **argv)
|
|||||||
case 'w':
|
case 'w':
|
||||||
window.window = strtol(optarg, 0, 0);
|
window.window = strtol(optarg, 0, 0);
|
||||||
break;
|
break;
|
||||||
case 'X':
|
|
||||||
free_and_zero(disp);
|
|
||||||
disp = strdup(optarg);
|
|
||||||
break;
|
|
||||||
#endif /* BUILD_X11 */
|
#endif /* BUILD_X11 */
|
||||||
|
|
||||||
case '?':
|
case '?':
|
||||||
|
@ -75,9 +75,12 @@ static Window find_desktop_window(Window *p_root, Window *p_desktop);
|
|||||||
static Window find_subwindow(Window win, int w, int h);
|
static Window find_subwindow(Window win, int w, int h);
|
||||||
|
|
||||||
/* X11 initializer */
|
/* X11 initializer */
|
||||||
void init_X11(const char *disp)
|
void init_X11()
|
||||||
{
|
{
|
||||||
if (!display) {
|
if (!display) {
|
||||||
|
const std::string &dispstr = display_name.get(*state).c_str();
|
||||||
|
// passing NULL to XOpenDisplay should open the default display
|
||||||
|
const char *disp = dispstr.size() ? dispstr.c_str() : NULL;
|
||||||
if ((display = XOpenDisplay(disp)) == NULL) {
|
if ((display = XOpenDisplay(disp)) == NULL) {
|
||||||
CRIT_ERR(NULL, NULL, "can't open display: %s", XDisplayName(disp));
|
CRIT_ERR(NULL, NULL, "can't open display: %s", XDisplayName(disp));
|
||||||
}
|
}
|
||||||
@ -941,6 +944,8 @@ conky::simple_config_setting<alignment> text_alignment("alignment", NONE, false)
|
|||||||
|
|
||||||
conky::simple_config_setting<bool> out_to_x("out_to_x", false, false);
|
conky::simple_config_setting<bool> out_to_x("out_to_x", false, false);
|
||||||
|
|
||||||
|
conky::simple_config_setting<std::string> display_name("display", std::string(), false);
|
||||||
|
|
||||||
#ifdef OWN_WINDOW
|
#ifdef OWN_WINDOW
|
||||||
conky::simple_config_setting<bool> own_window("own_window", false, false);
|
conky::simple_config_setting<bool> own_window("own_window", false, false);
|
||||||
conky::simple_config_setting<bool> set_transparent("own_window_transparent", false, false);
|
conky::simple_config_setting<bool> set_transparent("own_window_transparent", false, false);
|
||||||
|
@ -111,7 +111,7 @@ extern int workarea[4];
|
|||||||
extern struct conky_window window;
|
extern struct conky_window window;
|
||||||
extern char window_created;
|
extern char window_created;
|
||||||
|
|
||||||
void init_X11(const char*);
|
void init_X11();
|
||||||
void init_window(int width, int height, char **argv, int argc);
|
void init_window(int width, int height, char **argv, int argc);
|
||||||
void destroy_window(void);
|
void destroy_window(void);
|
||||||
void create_gc(void);
|
void create_gc(void);
|
||||||
@ -146,6 +146,7 @@ enum alignment {
|
|||||||
|
|
||||||
extern conky::simple_config_setting<alignment> text_alignment;
|
extern conky::simple_config_setting<alignment> text_alignment;
|
||||||
extern conky::simple_config_setting<bool> out_to_x;
|
extern conky::simple_config_setting<bool> out_to_x;
|
||||||
|
extern conky::simple_config_setting<std::string> display_name;
|
||||||
|
|
||||||
#ifdef OWN_WINDOW
|
#ifdef OWN_WINDOW
|
||||||
extern conky::simple_config_setting<bool> own_window;
|
extern conky::simple_config_setting<bool> own_window;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user