2 * Conky, a system monitor, based on torsmo
4 * This program is licensed under BSD license, read COPYING
12 #if defined(HAS_MCHECK_H)
14 #endif /* HAS_MCHECK_H */
16 #include <sys/utsname.h>
24 #if defined(HAVE_CAIRO_H) && defined(HAVE_CAIRO_XLIB_H) && defined(WANT_CAIRO)
27 #include <X11/Xutil.h>
29 #include <cairo-xlib.h>
38 #define TEXT_BUFFER_SIZE 1024
40 #include <sys/socket.h>
42 #define ERR(s, varargs...) \
43 fprintf(stderr, "Conky: " s "\n", ##varargs)
46 #define CRIT_ERR(s, varargs...) \
47 { fprintf(stderr, "Conky: " s "\n", ##varargs); exit(EXIT_FAILURE); }
54 char *left_fan_status;
55 char *right_fan_status;
62 struct i8k_struct i8k;
67 long long last_read_recv, last_read_trans;
68 long long recv, trans;
69 double recv_speed, trans_speed;
72 double net_rec[15], net_trans[15];
75 unsigned int diskio_value;
85 unsigned int user, nice, system, idle, iowait, irq, softirq;
137 #include "libmpdclient.h"
143 struct utsname uname_s;
149 /* memory information in kilobytes */
150 unsigned int mem, memmax, swap, swapmax;
151 unsigned int bufmem, buffers, cached;
154 unsigned int run_procs;
157 /* struct cpu_stat cpu_summed; what the hell is this? */
158 unsigned int cpu_count;
159 unsigned int cpu_avg_samples;
161 unsigned int net_avg_samples;
165 int new_mail_count, mail_count;
172 mpd_Connection *conn;
174 struct process *cpu[10];
175 struct process *memu[10];
176 unsigned long looped;
192 #include <X11/Xlib.h>
193 #include <X11/Xlib.h>
194 #include <X11/Xatom.h>
197 #include <X11/Xft/Xft.h>
200 #if defined(HAVE_XDBE) && defined(DOUBLE_BUFFER)
202 #include <X11/extensions/Xdbe.h>
205 #define ATOM(a) XInternAtom(display, #a, False)
207 struct conky_window {
212 XdbeBackBuffer back_buffer;
235 extern Display *display;
236 extern int display_width;
237 extern int display_height;
240 extern int workarea[4];
242 extern struct conky_window window;
245 #if defined OWN_WINDOW
246 void init_window(int use_own_window, int width, int height, int on_bottom, int fixed_pos, int set_trans, int back_colour);
248 void init_window(int use_own_window, int width, int height, int on_bottom, int set_trans, int back_colour);
251 void set_transparent_background(Window win);
252 long get_x11_color(const char *);
258 /* struct that has all info */
259 struct information info;
262 double get_time(void);
263 FILE *open_file(const char *file, int *reported);
264 void variable_substitute(const char *s, char *dest, unsigned int n);
265 void format_seconds(char *buf, unsigned int n, long t);
266 void format_seconds_short(char *buf, unsigned int n, long t);
267 struct net_stat *get_net_stat(const char *dev);
271 #define SET_NEED(a) need_mask |= 1 << (a)
272 extern unsigned long long need_mask;
274 extern double current_update_time, last_update_time;
276 extern int no_buffers;
278 /* system dependant (in linux.c) */
280 void update_diskio(void);
281 void prepare_update(void);
282 void update_uptime(void);
283 void update_meminfo(void);
284 void update_net_stats(void);
285 void update_wifi_stats(void);
286 void update_cpu_usage(void);
287 void update_total_processes(void);
288 void update_running_processes(void);
289 void update_i8k(void);
291 float get_freq_dynamic();
292 void update_load_average();
293 int open_i2c_sensor(const char *dev, const char *type, int n, int *div,
295 double get_i2c_info(int *fd, int arg, char *devtype, char *type);
297 char *get_adt746x_cpu(void);
298 char *get_adt746x_fan(void);
299 unsigned int get_diskio(void);
301 int open_acpi_temperature(const char *name);
302 double get_acpi_temperature(int fd);
303 char *get_acpi_ac_adapter(void);
304 char *get_acpi_fan(void);
305 void get_battery_stuff(char *buf, unsigned int n, const char *bat);
308 struct process *next;
309 struct process *previous;
314 unsigned int user_time;
316 unsigned int kernel_time;
317 unsigned int previous_user_time;
318 unsigned int previous_kernel_time;
321 unsigned int time_stamp;
322 unsigned int counted;
323 unsigned int changed;
329 /* fs-stuff is possibly system dependant (in fs.c) */
331 void update_fs_stats(void);
332 struct fs_stat *prepare_fs_stat(const char *path);
333 void clear_fs_stats(void);
337 int mixer_init(const char *);
338 int mixer_get_avg(int);
339 int mixer_get_left(int);
340 int mixer_get_right(int);
344 extern char *current_mail_spool;
346 void update_mail_count();
351 extern char *seti_dir;
364 typedef long long int64;
365 /* The info necessary to connect to mldonkey. login and password can be NULL. */
366 typedef struct mldonkey_config {
367 char *mldonkey_hostname;
369 char *mldonkey_login;
370 char *mldonkey_password;
373 /* The MLDonkey status returned */
374 typedef struct mldonkey_info {
375 int64 upload_counter;
376 int64 download_counter;
378 int64 shared_counter;
380 int tcp_download_rate;
382 int udp_download_rate;
383 int ndownloaded_files;
384 int ndownloading_files;
385 int nconnected_networks;
386 int connected_networks[1];
389 extern mldonkey_info mlinfo;
390 extern mldonkey_config mlconfig;
392 int get_mldonkey_status(mldonkey_config * config, mldonkey_info * info);
397 /* nothing to see here */
401 extern int do_it(void);