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 *tops[10];
149 unsigned long looped;
154 #include <X11/Xlib.h>
155 #include <X11/Xlib.h>
156 #include <X11/Xatom.h>
159 #include <X11/Xft/Xft.h>
162 #if defined(HAVE_XDBE) && defined(DOUBLE_BUFFER)
164 #include <X11/extensions/Xdbe.h>
167 #define ATOM(a) XInternAtom(display, #a, False)
169 struct conky_window {
174 XdbeBackBuffer back_buffer;
205 extern Display *display;
206 extern int display_width;
207 extern int display_height;
210 extern int workarea[4];
212 extern struct conky_window window;
215 void init_window(int use_own_window, int width, int height);
217 void set_transparent_background(Window win);
218 long get_x11_color(const char *);
222 /* struct that has all info */
223 struct information info;
226 double get_time(void);
227 FILE *open_file(const char *file, int *reported);
228 void variable_substitute(const char *s, char *dest, unsigned int n);
229 void format_seconds(char *buf, unsigned int n, long t);
230 void format_seconds_short(char *buf, unsigned int n, long t);
231 struct net_stat *get_net_stat(const char *dev);
235 #define SET_NEED(a) need_mask |= 1 << (a)
236 extern unsigned int need_mask;
238 extern double current_update_time, last_update_time;
240 extern int no_buffers;
242 /* system dependant (in linux.c) */
244 void prepare_update(void);
245 void update_uptime(void);
246 void update_meminfo(void);
247 void update_net_stats(void);
248 void update_wifi_stats(void);
249 void update_cpu_usage(void);
250 void update_total_processes(void);
251 void update_running_processes(void);
253 void update_load_average();
254 int open_i2c_sensor(const char *dev, const char *type, int n, int *div,
256 double get_i2c_info(int *fd, int arg, char *devtype, char *type);
258 char *get_adt746x_cpu(void);
259 char *get_adt746x_fan(void);
261 int open_acpi_temperature(const char *name);
262 double get_acpi_temperature(int fd);
263 char *get_acpi_ac_adapter(void);
264 char *get_acpi_fan(void);
265 void get_battery_stuff(char *buf, unsigned int n, const char *bat);
268 struct process *next;
269 struct process *previous;
274 unsigned int user_time;
276 unsigned int kernel_time;
277 unsigned int previous_user_time;
278 unsigned int previous_kernel_time;
281 unsigned int time_stamp;
282 unsigned int counted;
283 unsigned int changed;
288 double last_metar_update;
289 extern char *metar_station;
290 extern char *metar_server;
291 extern char *metar_path;
293 extern char metar_worked;
294 extern Decoded_METAR data;
296 extern int calculateRelativeHumidity(int, int);
297 extern int calculateWindChill(int, int);
298 extern int knTokph(int);
299 extern const char *calculateWindDirectionString(int);
300 extern const char *calculateShortWindDirectionString(int);
310 /* fs-stuff is possibly system dependant (in fs.c) */
312 void update_fs_stats(void);
313 struct fs_stat *prepare_fs_stat(const char *path);
314 void clear_fs_stats(void);
318 int mixer_init(const char *);
319 int mixer_get_avg(int);
320 int mixer_get_left(int);
321 int mixer_get_right(int);
325 extern char *current_mail_spool;
327 void update_mail_count();
332 extern char *seti_dir;
345 typedef long long int64;
346 /* The info necessary to connect to mldonkey. login and password can be NULL. */
347 typedef struct mldonkey_config {
348 char *mldonkey_hostname;
350 char *mldonkey_login;
351 char *mldonkey_password;
354 /* The MLDonkey status returned */
355 typedef struct mldonkey_info {
356 int64 upload_counter;
357 int64 download_counter;
359 int64 shared_counter;
361 int tcp_download_rate;
363 int udp_download_rate;
364 int ndownloaded_files;
365 int ndownloading_files;
366 int nconnected_networks;
367 int connected_networks[1];
370 extern mldonkey_info mlinfo;
371 extern mldonkey_config mlconfig;
373 int get_mldonkey_status(mldonkey_config *config, mldonkey_info *info);
380 extern int show_nice_processes;
384 extern int do_it(void);