update_mail_count();
+
#if defined(__linux__)
if (NEED(INFO_I8K))
update_i8k();
break;
case OBJ_top:
if (info.first_process) {
- free_all_processes(info.first_process);
+ free_all_processes();
info.first_process = NULL;
}
break;
case OBJ_top_mem:
if (info.first_process) {
- free_all_processes(info.first_process);
+ free_all_processes();
info.first_process = NULL;
}
break;
wm_class_name,
text_width + border_margin * 2 + 1,
text_height + border_margin * 2 + 1,
- on_bottom, fixed_pos, set_transparent, background_colour);
+ on_bottom, fixed_pos, set_transparent, background_colour, info.uname_s.nodename);
#else
init_window
(own_window,
text_width + border_margin * 2 + 1,
text_height + border_margin * 2 + 1,
- on_bottom, set_transparent, background_colour);
+ on_bottom, set_transparent, background_colour, info.uname_s.nodename);
#endif
void init_X11();
#if defined OWN_WINDOW
-void init_window(int use_own_window, char* wm_class_name, int width, int height, int on_bottom, int fixed_pos, int set_trans, int back_colour);
+void init_window(int use_own_window, char* wm_class_name, int width, int height, int on_bottom, int fixed_pos, int set_trans, int back_colour, char * nodename);
#else
-void init_window(int use_own_window, int width, int height, int on_bottom, int set_trans, int back_colour);
+void init_window(int use_own_window, int width, int height, int on_bottom, int set_trans, int back_colour, char * nodename);
#endif
void create_gc();
void set_transparent_background(Window win);
-void free_all_processes(struct process *pr)
+void free_all_processes()
{
- struct process *next = NULL;
+ struct process *next = NULL, *pr = first_process;
while (pr) {
next = pr->next;
if (pr->name) {
free(pr);
pr = next;
}
+ first_process = NULL;
}
static struct process *find_process(pid_t pid)
/* Find the top processes */
/******************************************/
-// static int tot_struct; //for debugging..uncomment this and the 2 printfs in the next two functs
+//static int tot_struct; //for debugging..uncomment this and the 2 printfs in the next two functs
/*
* free a sp_process structure
*/
void free_sp(struct sorted_process * sp) {
free(sp);
- //printf("free: %d structs\n",--tot_struct );
+// printf("free: %d structs\n",--tot_struct );
}
/*
sp->greater = NULL;
sp->less = NULL;
sp->proc = proc;
- //printf("malloc: %d structs\n", ++tot_struct);
+// printf("malloc: %d structs\n", ++tot_struct);
return(sp);
}
#include <X11/Xft/Xft.h>
#endif
+#include <stdio.h>
+
#ifdef XDBE
int use_xdbe;
#endif
int use_xft = 0;
#endif
+#define WINDOW_NAME_FMT "%s - conky"
+
/* some basic X11 stuff */
Display *display;
int display_width;
}
#if defined OWN_WINDOW
-void init_window(int own_window, char* wm_class_name, int w, int h, int l, int fixed_pos, int set_trans, int back_colour)
+void init_window(int own_window, char* wm_class_name, int w, int h, int l, int fixed_pos, int set_trans, int back_colour, char * nodename)
#else
-void init_window(int own_window, int w, int h, int l, int set_trans, int back_colour)
+void init_window(int own_window, int w, int h, int l, int set_trans, int back_colour, char * nodename)
#endif
{
/* There seems to be some problems with setting transparent background (on
* happens but I bet the bug is somewhere here. */
set_transparent = set_trans;
background_colour = back_colour;
+ char * window_name = NULL;
+ int num_chars = 0;
#ifdef OWN_WINDOW
if (own_window) {
&class_hints);
/*set_transparent_background(window.window);*/
-
- XStoreName(display, window.window, "conky");
-
+ window_name = (char *) malloc(strlen(WINDOW_NAME_FMT) + strlen(nodename)+1);
+ sprintf(window_name, WINDOW_NAME_FMT, nodename);
+ XStoreName(display, window.window, window_name);
+ free(window_name);
XClearWindow(display, window.window);
if (!fixed_pos)