6 #include <sys/utsname.h>
13 #if defined(HAVE_CAIRO_H) && defined(HAVE_CAIRO_XLIB_H) && defined(WANT_CAIRO)
16 #include <X11/Xutil.h>
18 #include <cairo-xlib.h>
26 #define TEXT_BUFFER_SIZE 1024
32 #include <sys/socket.h>
34 #define ERR(s, varargs...) \
35 fprintf(stderr, "Conky: " s "\n", ##varargs)
38 #define CRIT_ERR(s, varargs...) \
39 { fprintf(stderr, "Conky: " s "\n", ##varargs); exit(EXIT_FAILURE); }
44 long long last_read_recv, last_read_trans;
45 long long recv, trans;
46 double recv_speed, trans_speed;
49 double net_rec[15], net_trans[15];
60 unsigned int user, nice, system, idle, iowait, irq, softirq;
111 #include "libmpdclient.h"
117 struct utsname uname_s;
123 /* memory information in kilobytes */
124 unsigned int mem, memmax, swap, swapmax;
125 unsigned int bufmem, buffers, cached;
128 unsigned int run_procs;
131 struct cpu_stat cpu_summed;
132 unsigned int cpu_count;
133 unsigned int cpu_avg_samples;
135 unsigned int net_avg_samples;
139 int new_mail_count, mail_count;
146 mpd_Connection *conn;
148 struct process *cpu[10];
149 struct process *memu[10];
150 unsigned long looped;
155 #include <X11/Xlib.h>
156 #include <X11/Xlib.h>
157 #include <X11/Xatom.h>
160 #include <X11/Xft/Xft.h>
163 #if defined(HAVE_XDBE) && defined(DOUBLE_BUFFER)
165 #include <X11/extensions/Xdbe.h>
168 #define ATOM(a) XInternAtom(display, #a, False)
170 struct conky_window {
175 XdbeBackBuffer back_buffer;
207 extern Display *display;
208 extern int display_width;
209 extern int display_height;
212 extern int workarea[4];
214 extern struct conky_window window;
217 void init_window(int use_own_window, int width, int height);
219 void set_transparent_background(Window win);
220 long get_x11_color(const char *);
224 /* struct that has all info */
225 struct information info;
228 double get_time(void);
229 FILE *open_file(const char *file, int *reported);
230 void variable_substitute(const char *s, char *dest, unsigned int n);
231 void format_seconds(char *buf, unsigned int n, long t);
232 void format_seconds_short(char *buf, unsigned int n, long t);
233 struct net_stat *get_net_stat(const char *dev);
237 #define SET_NEED(a) need_mask |= 1 << (a)
238 extern unsigned int need_mask;
240 extern double current_update_time, last_update_time;
242 extern int no_buffers;
244 /* system dependant (in linux.c) */
246 void prepare_update(void);
247 void update_uptime(void);
248 void update_meminfo(void);
249 void update_net_stats(void);
250 void update_wifi_stats(void);
251 void update_cpu_usage(void);
252 void update_total_processes(void);
253 void update_running_processes(void);
255 void update_load_average();
256 int open_i2c_sensor(const char *dev, const char *type, int n, int *div,
258 double get_i2c_info(int *fd, int arg, char *devtype, char *type);
260 char *get_adt746x_cpu(void);
261 char *get_adt746x_fan(void);
263 int open_acpi_temperature(const char *name);
264 double get_acpi_temperature(int fd);
265 char *get_acpi_ac_adapter(void);
266 char *get_acpi_fan(void);
267 void get_battery_stuff(char *buf, unsigned int n, const char *bat);
270 struct process *next;
271 struct process *previous;
276 unsigned int user_time;
278 unsigned int kernel_time;
279 unsigned int previous_user_time;
280 unsigned int previous_kernel_time;
283 unsigned int time_stamp;
284 unsigned int counted;
285 unsigned int changed;
290 double last_metar_update;
291 extern char *metar_station;
292 extern char *metar_server;
293 extern char *metar_path;
295 extern char metar_worked;
296 extern Decoded_METAR data;
298 extern int calculateRelativeHumidity(int, int);
299 extern int calculateWindChill(int, int);
300 extern int knTokph(int);
301 extern const char *calculateWindDirectionString(int);
302 extern const char *calculateShortWindDirectionString(int);
312 /* fs-stuff is possibly system dependant (in fs.c) */
314 void update_fs_stats(void);
315 struct fs_stat *prepare_fs_stat(const char *path);
316 void clear_fs_stats(void);
320 int mixer_init(const char *);
321 int mixer_get_avg(int);
322 int mixer_get_left(int);
323 int mixer_get_right(int);
327 extern char *current_mail_spool;
329 void update_mail_count();
334 extern char *seti_dir;
347 typedef long long int64;
348 /* The info necessary to connect to mldonkey. login and password can be NULL. */
349 typedef struct mldonkey_config {
350 char *mldonkey_hostname;
352 char *mldonkey_login;
353 char *mldonkey_password;
356 /* The MLDonkey status returned */
357 typedef struct mldonkey_info {
358 int64 upload_counter;
359 int64 download_counter;
361 int64 shared_counter;
363 int tcp_download_rate;
365 int udp_download_rate;
366 int ndownloaded_files;
367 int ndownloading_files;
368 int nconnected_networks;
369 int connected_networks[1];
372 extern mldonkey_info mlinfo;
373 extern mldonkey_config mlconfig;
375 int get_mldonkey_status(mldonkey_config *config, mldonkey_info *info);
382 extern int show_nice_processes;
386 extern int do_it(void);