6 #include <sys/utsname.h>
10 #if defined(HAVE_CAIRO_H) && defined(HAVE_CAIRO_XLIB_H) && defined(WANT_CAIRO)
13 #include <X11/Xutil.h>
15 #include <cairo-xlib.h>
23 #define TEXT_BUFFER_SIZE (1024*4)
29 #include <sys/socket.h>
31 #define ERR(s, varargs...) \
32 fprintf(stderr, "Conky: " s "\n", ##varargs)
35 #define CRIT_ERR(s, varargs...) \
36 { fprintf(stderr, "Conky: " s "\n", ##varargs); exit(EXIT_FAILURE); }
41 long long last_read_recv, last_read_trans;
42 long long recv, trans;
43 double recv_speed, trans_speed;
46 double net_rec[15], net_trans[15];
57 unsigned int user, nice, system, idle, iowait, irq, softirq;
108 #include "libmpdclient.h"
114 struct utsname uname_s;
120 /* memory information in kilobytes */
121 unsigned int mem, memmax, swap, swapmax;
122 unsigned int bufmem, buffers, cached;
125 unsigned int run_procs;
128 struct cpu_stat cpu_summed;
129 unsigned int cpu_count;
130 unsigned int cpu_avg_samples;
132 unsigned int net_avg_samples;
136 int new_mail_count, mail_count;
143 mpd_Connection *conn;
145 struct process *tops[10];
146 unsigned long looped;
151 #include <X11/Xlib.h>
152 #include <X11/Xlib.h>
153 #include <X11/Xatom.h>
156 #include <X11/Xft/Xft.h>
159 #if defined(HAVE_XDBE) && defined(DOUBLE_BUFFER)
161 #include <X11/extensions/Xdbe.h>
164 #define ATOM(a) XInternAtom(display, #a, False)
166 struct conky_window {
171 XdbeBackBuffer back_buffer;
202 extern Display *display;
203 extern int display_width;
204 extern int display_height;
207 extern int workarea[4];
209 extern struct conky_window window;
212 void init_window(int use_own_window, int width, int height);
214 void set_transparent_background(Window win);
215 long get_x11_color(const char *);
219 /* struct that has all info */
220 struct information info;
223 double get_time(void);
224 FILE *open_file(const char *file, int *reported);
225 void variable_substitute(const char *s, char *dest, unsigned int n);
226 void format_seconds(char *buf, unsigned int n, long t);
227 void format_seconds_short(char *buf, unsigned int n, long t);
228 struct net_stat *get_net_stat(const char *dev);
232 #define SET_NEED(a) need_mask |= 1 << (a)
233 extern unsigned int need_mask;
235 extern double current_update_time, last_update_time;
237 extern int no_buffers;
239 /* system dependant (in linux.c) */
241 void prepare_update(void);
242 void update_uptime(void);
243 void update_meminfo(void);
244 void update_net_stats(void);
245 void update_wifi_stats(void);
246 void update_cpu_usage(void);
247 void update_total_processes(void);
248 void update_running_processes(void);
250 void update_load_average();
251 int open_i2c_sensor(const char *dev, const char *type, int n, int *div,
253 double get_i2c_info(int *fd, int arg, char *devtype, char *type);
255 char *get_adt746x_cpu(void);
256 char *get_adt746x_fan(void);
258 int open_acpi_temperature(const char *name);
259 double get_acpi_temperature(int fd);
260 char *get_acpi_ac_adapter(void);
261 char *get_acpi_fan(void);
262 void get_battery_stuff(char *buf, unsigned int n, const char *bat);
265 struct process *next;
266 struct process *previous;
271 unsigned int user_time;
273 unsigned int kernel_time;
274 unsigned int previous_user_time;
275 unsigned int previous_kernel_time;
278 unsigned int time_stamp;
279 unsigned int counted;
280 unsigned int changed;
285 double last_metar_update;
286 extern char *metar_station;
287 extern char *metar_server;
288 extern char *metar_path;
290 extern char metar_worked;
291 extern Decoded_METAR data;
293 extern int calculateRelativeHumidity(int, int);
294 extern int calculateWindChill(int, int);
295 extern int knTokph(int);
296 extern const char *calculateWindDirectionString(int);
297 extern const char *calculateShortWindDirectionString(int);
307 /* fs-stuff is possibly system dependant (in fs.c) */
309 void update_fs_stats(void);
310 struct fs_stat *prepare_fs_stat(const char *path);
311 void clear_fs_stats(void);
315 int mixer_init(const char *);
316 int mixer_get_avg(int);
317 int mixer_get_left(int);
318 int mixer_get_right(int);
322 extern char *current_mail_spool;
324 void update_mail_count();
329 extern char *seti_dir;
342 typedef long long int64;
343 /* The info necessary to connect to mldonkey. login and password can be NULL. */
344 typedef struct mldonkey_config {
345 char *mldonkey_hostname;
347 char *mldonkey_login;
348 char *mldonkey_password;
351 /* The MLDonkey status returned */
352 typedef struct mldonkey_info {
353 int64 upload_counter;
354 int64 download_counter;
356 int64 shared_counter;
358 int tcp_download_rate;
360 int udp_download_rate;
361 int ndownloaded_files;
362 int ndownloading_files;
363 int nconnected_networks;
364 int connected_networks[1];
367 extern mldonkey_info mlinfo;
368 extern mldonkey_config mlconfig;
370 int get_mldonkey_status(mldonkey_config *config, mldonkey_info *info);
377 extern int show_nice_processes;
381 extern int do_it(void);