1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-15 17:47:09 +00:00

Make conky (more-or-less) functional again

This commit is contained in:
Pavel Labath 2010-10-31 18:17:22 +01:00
parent 104ae7454c
commit c9334eb071
3 changed files with 19 additions and 63 deletions

View File

@ -166,7 +166,14 @@ static conky::simple_config_setting<bool> short_units("short_units", false, true
static conky::simple_config_setting<bool> format_human_readable("format_human_readable", static conky::simple_config_setting<bool> format_human_readable("format_human_readable",
true, true); true, true);
static conky::simple_config_setting<bool> out_to_stdout("out_to_console", false, false); static conky::simple_config_setting<bool> out_to_stdout("out_to_console",
// Default value is false, unless we are building without X
#ifdef BUILD_X11
false,
#else
true,
#endif
false);
static conky::simple_config_setting<bool> out_to_stderr("out_to_stderr", false, false); static conky::simple_config_setting<bool> out_to_stderr("out_to_stderr", false, false);
@ -2685,10 +2692,6 @@ void load_config_file()
} }
#endif /* BUILD_NCURSES */ #endif /* BUILD_NCURSES */
#endif #endif
if(out_to_x.get(*state)) {
current_text_color = default_color.get(*state);
}
} }
static void print_help(const char *prog_name) { static void print_help(const char *prog_name) {
@ -2911,6 +2914,10 @@ void initialisation(int argc, char **argv) {
conky::set_config_settings(*state); conky::set_config_settings(*state);
if(out_to_x.get(*state)) {
current_text_color = default_color.get(*state);
}
/* generate text and get initial size */ /* generate text and get initial size */
extract_variable_text(global_text); extract_variable_text(global_text);
free_and_zero(global_text); free_and_zero(global_text);
@ -3050,67 +3057,18 @@ int main(int argc, char **argv)
set_current_config(); set_current_config();
state.reset(new lua::state); state.reset(new lua::state);
conky::export_symbols(*state);
initialisation(argc, argv);
first_pass = 0; /* don't ever call fork() again */
//////////// XXX ////////////////////////////////
lua::state &l = *state;
try { try {
std::cout << "config.alignment = " << text_alignment.get(l) << std::endl; conky::export_symbols(*state);
l.pushstring("X");
text_alignment.lua_set(l); initialisation(argc, argv);
std::cout << "config.alignment = " << text_alignment.get(l) << std::endl;
std::cout << "config.own_window_hints = " << own_window_hints.get(l) << std::endl; first_pass = 0; /* don't ever call fork() again */
l.loadstring(
"print('config.asdf = ', conky.config.asdf);\n"
"conky.config.asdf = -42;\n"
"print('config.asdf = ', conky.config.asdf);\n"
"conky.config.alignment='asdf';\n"
"print('config.alignment = ', conky.config.alignment);\n"
"print('config.own_window_hints = ', conky.config.own_window_hints);\n"
"print('config.mpd_host = ', conky.config.mpd_host);\n"
"print('config.mpd_password = ', conky.config.mpd_password);\n"
"print('config.mpd_port = ', conky.config.mpd_port);\n"
"print('config.music_player_interval = ', conky.config.music_player_interval);\n"
);
l.call(0, 0);
sleep(3);
} }
catch(std::exception &e) { catch(std::exception &e) {
std::cerr << "caught exception: " << e.what() << std::endl; std::cerr << "caught exception: " << e.what() << std::endl;
} }
#if 0
try {
l.pushvalue(lua::GLOBALSINDEX);
l.pushnil();
while(l.next(-2)) {
if(l.isnumber(-2))
std::cout << l.tonumber(-2);
else if(l.isstring(-2))
std::cout << '"' << l.tostring(-2) << '"';
else
std::cout << l.type_name(l.type(-2));
std::cout << " -> ";
if(l.isnumber(-1))
std::cout << l.tonumber(-1);
else if(l.isstring(-1))
std::cout << '"' << l.tostring(-1) << '"';
else
std::cout << l.type_name(l.type(-1));
std::cout << std::endl;
}
}
catch(std::exception &e) {
std::cerr << "caught exception: " << e.what() << std::endl;
}
#endif
#ifdef BUILD_WEATHER_XOAP #ifdef BUILD_WEATHER_XOAP
/* Load xoap keys, if existing */ /* Load xoap keys, if existing */
load_xoap_keys(); load_xoap_keys();
@ -3125,8 +3083,6 @@ int main(int argc, char **argv)
fcntl(inotify_fd, F_SETFD, fcntl(inotify_fd, F_GETFD) | FD_CLOEXEC); fcntl(inotify_fd, F_SETFD, fcntl(inotify_fd, F_GETFD) | FD_CLOEXEC);
} }
#endif /* HAVE_SYS_INOTIFY_H */ #endif /* HAVE_SYS_INOTIFY_H */
clean_up(NULL, NULL);
return 0;
//////////// XXX //////////////////////////////// //////////// XXX ////////////////////////////////
main_loop(); main_loop();

View File

@ -157,7 +157,7 @@ void load_fonts(void)
{ {
if (not out_to_x.get(*state)) if (not out_to_x.get(*state))
return; return;
for (size_t i = 0; i <= fonts.size(); i++) { for (size_t i = 0; i < fonts.size(); i++) {
#ifdef BUILD_XFT #ifdef BUILD_XFT
/* load Xft font */ /* load Xft font */
if (use_xft.get(*state)) { if (use_xft.get(*state)) {

View File

@ -145,7 +145,7 @@ namespace priv {
public: public:
out_to_x_setting() out_to_x_setting()
: Base("out_to_x", false, false) : Base("out_to_x", true, false)
{} {}
}; };