2 * Conky, a system monitor, based on torsmo
4 * This program is licensed under BSD license, read COPYING
15 #include <sys/utsname.h>
23 #if defined(HAVE_CAIRO_H) && defined(HAVE_CAIRO_XLIB_H) && defined(WANT_CAIRO)
26 #include <X11/Xutil.h>
28 #include <cairo-xlib.h>
37 #define TEXT_BUFFER_SIZE 1024
39 #include <sys/socket.h>
41 #define ERR(s, varargs...) \
42 fprintf(stderr, "Conky: " s "\n", ##varargs)
45 #define CRIT_ERR(s, varargs...) \
46 { fprintf(stderr, "Conky: " s "\n", ##varargs); exit(EXIT_FAILURE); }
51 long long last_read_recv, last_read_trans;
52 long long recv, trans;
53 double recv_speed, trans_speed;
56 double net_rec[15], net_trans[15];
67 unsigned int user, nice, system, idle, iowait, irq, softirq;
117 #include "libmpdclient.h"
123 struct utsname uname_s;
129 /* memory information in kilobytes */
130 unsigned int mem, memmax, swap, swapmax;
131 unsigned int bufmem, buffers, cached;
134 unsigned int run_procs;
137 struct cpu_stat cpu_summed;
138 unsigned int cpu_count;
139 unsigned int cpu_avg_samples;
141 unsigned int net_avg_samples;
145 int new_mail_count, mail_count;
152 mpd_Connection *conn;
154 struct process *cpu[10];
155 struct process *memu[10];
156 unsigned long looped;
172 #include <X11/Xlib.h>
173 #include <X11/Xlib.h>
174 #include <X11/Xatom.h>
177 #include <X11/Xft/Xft.h>
180 #if defined(HAVE_XDBE) && defined(DOUBLE_BUFFER)
182 #include <X11/extensions/Xdbe.h>
185 #define ATOM(a) XInternAtom(display, #a, False)
187 struct conky_window {
192 XdbeBackBuffer back_buffer;
215 extern Display *display;
216 extern int display_width;
217 extern int display_height;
220 extern int workarea[4];
222 extern struct conky_window window;
225 #if defined OWN_WINDOW
226 void init_window(int use_own_window, int width, int height, int on_bottom, int fixed_pos);
228 void init_window(int use_own_window, int width, int height, int on_bottom);
231 void set_transparent_background(Window win);
232 long get_x11_color(const char *);
238 /* struct that has all info */
239 struct information info;
242 double get_time(void);
243 FILE *open_file(const char *file, int *reported);
244 void variable_substitute(const char *s, char *dest, unsigned int n);
245 void format_seconds(char *buf, unsigned int n, long t);
246 void format_seconds_short(char *buf, unsigned int n, long t);
247 struct net_stat *get_net_stat(const char *dev);
251 #define SET_NEED(a) need_mask |= 1 << (a)
252 extern unsigned long long need_mask;
254 extern double current_update_time, last_update_time;
256 extern int no_buffers;
258 /* system dependant (in linux.c) */
260 void prepare_update(void);
261 void update_uptime(void);
262 void update_meminfo(void);
263 void update_net_stats(void);
264 void update_wifi_stats(void);
265 void update_cpu_usage(void);
266 void update_total_processes(void);
267 void update_running_processes(void);
269 void update_load_average();
270 int open_i2c_sensor(const char *dev, const char *type, int n, int *div,
272 double get_i2c_info(int *fd, int arg, char *devtype, char *type);
274 char *get_adt746x_cpu(void);
275 char *get_adt746x_fan(void);
277 int open_acpi_temperature(const char *name);
278 double get_acpi_temperature(int fd);
279 char *get_acpi_ac_adapter(void);
280 char *get_acpi_fan(void);
281 void get_battery_stuff(char *buf, unsigned int n, const char *bat);
284 struct process *next;
285 struct process *previous;
290 unsigned int user_time;
292 unsigned int kernel_time;
293 unsigned int previous_user_time;
294 unsigned int previous_kernel_time;
297 unsigned int time_stamp;
298 unsigned int counted;
299 unsigned int changed;
305 /* fs-stuff is possibly system dependant (in fs.c) */
307 void update_fs_stats(void);
308 struct fs_stat *prepare_fs_stat(const char *path);
309 void clear_fs_stats(void);
313 int mixer_init(const char *);
314 int mixer_get_avg(int);
315 int mixer_get_left(int);
316 int mixer_get_right(int);
320 extern char *current_mail_spool;
322 void update_mail_count();
327 extern char *seti_dir;
340 typedef long long int64;
341 /* The info necessary to connect to mldonkey. login and password can be NULL. */
342 typedef struct mldonkey_config {
343 char *mldonkey_hostname;
345 char *mldonkey_login;
346 char *mldonkey_password;
349 /* The MLDonkey status returned */
350 typedef struct mldonkey_info {
351 int64 upload_counter;
352 int64 download_counter;
354 int64 shared_counter;
356 int tcp_download_rate;
358 int udp_download_rate;
359 int ndownloaded_files;
360 int ndownloading_files;
361 int nconnected_networks;
362 int connected_networks[1];
365 extern mldonkey_info mlinfo;
366 extern mldonkey_config mlconfig;
368 int get_mldonkey_status(mldonkey_config * config, mldonkey_info * info);
373 /* nothing to see here */
377 extern int do_it(void);