/* * Conky, a system monitor, based on torsmo * * This program is licensed under BSD license, read COPYING * * $Id$ */ #ifndef _conky_h_ #define _conky_h_ #if defined(XMMS) || defined(BMP) || defined(AUDACIOUS) || defined(INFOPIPE) #include #endif #if defined(HAS_MCHECK_H) #include #endif /* HAS_MCHECK_H */ #include "config.h" #include #include #include #include #include #include #include #if defined(__FreeBSD__) #include #include #endif /* __FreeBSD__ */ #ifdef X11 #if defined(HAVE_CAIRO_H) && defined(HAVE_CAIRO_XLIB_H) && defined(WANT_CAIRO) #define CAIRO #include #include #include #include #endif #endif /* X11 */ #if defined(__FreeBSD__) && (defined(i386) || defined(__i386__)) #include #endif /* __FreeBSD__ */ #define TOP_CPU 1 #define TOP_NAME 2 #define TOP_PID 3 #define TOP_MEM 4 #define TEXT_BUFFER_SIZE 1024 #define P_MAX_SIZE ((TEXT_BUFFER_SIZE * 4) - 2) #include #define ERR(s, varargs...) \ fprintf(stderr, "Conky: " s "\n", ##varargs) /* critical error */ #define CRIT_ERR(s, varargs...) \ { fprintf(stderr, "Conky: " s "\n", ##varargs); exit(EXIT_FAILURE); } /* in sys/param.h #ifndef MIN #define MIN(a,b) (a>b ? b : a) #endif #ifndef MAX #define MAX(a,b) (a #include #include #ifdef XFT #include #endif #if defined(HAVE_XDBE) && defined(DOUBLE_BUFFER) #define XDBE #include #endif #define ATOM(a) XInternAtom(display, #a, False) struct conky_window { Window window; Drawable drawable; GC gc; #ifdef XDBE XdbeBackBuffer back_buffer; #endif #ifdef XFT XftDraw *xftdraw; #endif int width; int height; #ifdef OWN_WINDOW int x; int y; #endif }; #ifdef XDBE extern int use_xdbe; #endif #ifdef XFT extern int use_xft; #endif extern Display *display; extern int display_width; extern int display_height; extern int screen; extern int workarea[4]; extern struct conky_window window; void init_X11(); #if defined OWN_WINDOW void init_window(int use_own_window, char* wm_class_name, int width, int height, int on_bottom, int fixed_pos, int set_trans, int back_colour, char * nodename); #else void init_window(int use_own_window, int width, int height, int on_bottom, int set_trans, int back_colour, char * nodename); #endif void create_gc(); void set_transparent_background(Window win); long get_x11_color(const char *); #endif /* X11 */ /* in common.c */ /* struct that has all info */ struct information info; void signal_handler(int); void reload_config(void); void clean_up(void); void update_uname(); double get_time(void); FILE *open_file(const char *file, int *reported); void variable_substitute(const char *s, char *dest, unsigned int n); void format_seconds(char *buf, unsigned int n, long t); void format_seconds_short(char *buf, unsigned int n, long t); struct net_stat *get_net_stat(const char *dev); void update_stuff(); int round_to_int(float f); #define SET_NEED(a) need_mask |= 1 << (a) extern unsigned long long need_mask; extern double current_update_time, last_update_time; extern int no_buffers; /* system dependant (in linux.c) */ void update_diskio(void); void prepare_update(void); void update_uptime(void); void update_meminfo(void); void update_net_stats(void); void update_wifi_stats(void); void update_cpu_usage(void); void update_total_processes(void); void update_running_processes(void); void update_i8k(void); void get_freq( char *, size_t, char *, int ); /* pk */ void get_freq_dynamic( char *, size_t, char *, int ); /* pk */ void update_load_average(); int open_i2c_sensor(const char *dev, const char *type, int n, int *div, char *devtype); double get_i2c_info(int *fd, int arg, char *devtype, char *type); void get_adt746x_cpu( char *, size_t ); /* pk */ void get_adt746x_fan( char *, size_t ); /* pk */ unsigned int get_diskio(void); int open_acpi_temperature(const char *name); double get_acpi_temperature(int fd); void get_acpi_ac_adapter( char *, size_t ); /* pk */ void get_acpi_fan( char *, size_t ); /* pk */ void get_battery_stuff(char *buf, unsigned int n, const char *bat); struct process { struct process *next; struct process *previous; pid_t pid; char *name; float amount; unsigned long user_time; unsigned long total; unsigned long kernel_time; unsigned long previous_user_time; unsigned long previous_kernel_time; unsigned int vsize; unsigned int rss; unsigned int time_stamp; unsigned int counted; unsigned int changed; float totalmem; }; void update_top(); void free_all_processes(); struct process *get_first_process(); /* fs-stuff is possibly system dependant (in fs.c) */ void update_fs_stats(void); struct fs_stat *prepare_fs_stat(const char *path); void clear_fs_stats(void); /* in mixer.c */ int mixer_init(const char *); int mixer_get_avg(int); int mixer_get_left(int); int mixer_get_right(int); /* in mail.c */ extern char *current_mail_spool; void update_mail_count(); /* in seti.c */ #ifdef SETI extern char *seti_dir; void update_seti(); #endif /* in freebsd.c */ #if defined(__FreeBSD__) && (defined(i386) || defined(__i386__)) int apm_getinfo(int fd, apm_info_t aip); char *get_apm_adapter(void); char *get_apm_battery_life(void); char *get_apm_battery_time(void); #endif /* in mpd.c */ #ifdef MPD void update_mpd(); #endif #ifdef MLDONKEY /* in mldonkey.c */ typedef long long int64; /* The info necessary to connect to mldonkey. login and password can be NULL. */ typedef struct mldonkey_config { char *mldonkey_hostname; int mldonkey_port; char *mldonkey_login; char *mldonkey_password; } mldonkey_config; /* The MLDonkey status returned */ typedef struct mldonkey_info { int64 upload_counter; int64 download_counter; int nshared_files; int64 shared_counter; int tcp_upload_rate; int tcp_download_rate; int udp_upload_rate; int udp_download_rate; int ndownloaded_files; int ndownloading_files; int nconnected_networks; int connected_networks[1]; } mldonkey_info; extern mldonkey_info mlinfo; extern mldonkey_config mlconfig; int get_mldonkey_status(mldonkey_config * config, mldonkey_info * info); #endif /* in linux.c */ /* nothing to see here */ /* in cairo.c */ extern int do_it(void); #endif