mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-05 21:07:52 +00:00
Split conky.h into several smaller header files
In order to do this correctly: Removed duplicate includes Fixed mpd functions to accept mpd_s instead of information Freed mpd.h of any need to include conky.h (mpd.c still includes it for the constants) git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@1154 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
parent
59704d5e3e
commit
610b0b628d
@ -23,9 +23,6 @@
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <glib.h>
|
||||
#ifndef AUDACIOUS_LEGACY
|
||||
#include <glib-object.h>
|
||||
@ -55,7 +52,6 @@
|
||||
xmms_remote_get_playlist_length(x)
|
||||
#endif
|
||||
|
||||
#include "config.h"
|
||||
#include "conky.h"
|
||||
#include "audacious.h"
|
||||
#include "timed_thread.h"
|
||||
|
@ -22,6 +22,12 @@
|
||||
#ifndef AUDACIOUS_H
|
||||
#define AUDACIOUS_H
|
||||
|
||||
struct audacious_s {
|
||||
audacious_t items; /* e.g. items[AUDACIOUS_STATUS] */
|
||||
int max_title_len; /* e.g. ${audacious_title 50} */
|
||||
timed_thread *p_timed_thread;
|
||||
};
|
||||
|
||||
enum _audacious_items {
|
||||
AUDACIOUS_STATUS = 0,
|
||||
AUDACIOUS_TITLE,
|
||||
|
@ -27,9 +27,6 @@
|
||||
#include <bmp/dbus.hh>
|
||||
#include <dbus/dbus-glib.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "conky.h"
|
||||
|
||||
#define DBUS_TYPE_G_STRING_VALUE_HASHTABLE \
|
||||
|
14
src/bmpx.h
Normal file
14
src/bmpx.h
Normal file
@ -0,0 +1,14 @@
|
||||
#ifndef BMPX_H_
|
||||
#define BMPX_H_
|
||||
|
||||
void update_bmpx(void);
|
||||
struct bmpx_s {
|
||||
char *title;
|
||||
char *artist;
|
||||
char *album;
|
||||
char *uri;
|
||||
int bitrate;
|
||||
int track;
|
||||
};
|
||||
|
||||
#endif /*BMPX_H_*/
|
17
src/common.c
17
src/common.c
@ -26,9 +26,6 @@
|
||||
* $Id$ */
|
||||
|
||||
#include "conky.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <sys/time.h>
|
||||
@ -301,15 +298,15 @@ void update_stuff(void)
|
||||
|
||||
#ifdef MPD
|
||||
if (NEED(INFO_MPD)) {
|
||||
if (!mpd_timed_thread) {
|
||||
init_mpd_stats(&info);
|
||||
mpd_timed_thread = timed_thread_create(&update_mpd,
|
||||
(void *) NULL, info.music_player_interval * 1000000);
|
||||
if (!mpd_timed_thread) {
|
||||
if (!info.mpd.timed_thread) {
|
||||
init_mpd_stats(&info.mpd);
|
||||
info.mpd.timed_thread = timed_thread_create(&update_mpd,
|
||||
(void *) &info.mpd, info.music_player_interval * 1000000);
|
||||
if (!info.mpd.timed_thread) {
|
||||
ERR("Failed to create MPD timed thread");
|
||||
}
|
||||
timed_thread_register(mpd_timed_thread, &mpd_timed_thread);
|
||||
if (timed_thread_run(mpd_timed_thread)) {
|
||||
timed_thread_register(info.mpd.timed_thread, &info.mpd.timed_thread);
|
||||
if (timed_thread_run(info.mpd.timed_thread)) {
|
||||
ERR("Failed to run MPD timed thread");
|
||||
}
|
||||
}
|
||||
|
47
src/common.h
Normal file
47
src/common.h
Normal file
@ -0,0 +1,47 @@
|
||||
#ifndef COMMON_H_
|
||||
#define COMMON_H_
|
||||
|
||||
int check_mount(char *s);
|
||||
void update_diskio(void);
|
||||
void prepare_update(void);
|
||||
void update_uptime(void);
|
||||
void update_meminfo(void);
|
||||
void update_net_stats(void);
|
||||
void update_cpu_usage(void);
|
||||
void update_total_processes(void);
|
||||
void update_running_processes(void);
|
||||
void update_i8k(void);
|
||||
char get_freq(char *, size_t, const char *, int, unsigned int);
|
||||
void get_freq_dynamic(char *, size_t, const char *, int);
|
||||
char get_voltage(char *, size_t, const char *, int, unsigned int); /* ptarjan */
|
||||
void update_load_average(void);
|
||||
void update_top(void);
|
||||
void free_all_processes(void);
|
||||
struct process *get_first_process(void);
|
||||
void get_cpu_count(void);
|
||||
|
||||
int open_sysfs_sensor(const char *dir, const char *dev, const char *type, int n,
|
||||
int *divisor, char *devtype);
|
||||
|
||||
#define open_i2c_sensor(dev, type, n, divisor, devtype) \
|
||||
open_sysfs_sensor("/sys/bus/i2c/devices/", dev, type, n, divisor, devtype)
|
||||
#define open_platform_sensor(dev, type, n, divisor, devtype) \
|
||||
open_sysfs_sensor("/sys/bus/platform/devices/", dev, type, n, divisor, devtype)
|
||||
#define open_hwmon_sensor(dev, type, n, divisor, devtype) \
|
||||
open_sysfs_sensor("/sys/class/hwmon/", dev, type, n, divisor, devtype)
|
||||
|
||||
double get_sysfs_info(int *fd, int arg, char *devtype, char *type);
|
||||
|
||||
void get_adt746x_cpu(char *, size_t);
|
||||
void get_adt746x_fan(char *, size_t);
|
||||
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);
|
||||
void get_acpi_fan(char *, size_t);
|
||||
void get_battery_stuff(char *buf, unsigned int n, const char *bat, int item);
|
||||
int get_battery_perct(const char *bat);
|
||||
int get_battery_perct_bar(const char *bat);
|
||||
|
||||
#endif /*COMMON_H_*/
|
@ -26,8 +26,6 @@
|
||||
* $Id$ */
|
||||
|
||||
#include "conky.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <math.h>
|
||||
#include <ctype.h>
|
||||
@ -37,7 +35,6 @@
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <termios.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
#if HAVE_DIRENT_H
|
||||
#include <dirent.h>
|
||||
@ -2304,7 +2301,7 @@ static void free_text_objects(unsigned int count, struct text_object *objs)
|
||||
case OBJ_mpd_file:
|
||||
case OBJ_mpd_percent:
|
||||
case OBJ_mpd_smart:
|
||||
free_mpd_vars(&info);
|
||||
free_mpd_vars(&info.mpd);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
338
src/conky.h
338
src/conky.h
@ -35,7 +35,6 @@
|
||||
#endif /* HAS_MCHECK_H */
|
||||
|
||||
#include "config.h"
|
||||
#include "top.h"
|
||||
#include <sys/utsname.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -50,19 +49,11 @@
|
||||
#endif
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
#include <sys/mount.h>
|
||||
#include <sys/ucred.h>
|
||||
#include <fcntl.h>
|
||||
#include <kvm.h>
|
||||
#if (defined(i386) || defined(__i386__))
|
||||
#include <machine/apm_bios.h>
|
||||
#endif /* i386 || __i386__ */
|
||||
#include "freebsd.h"
|
||||
#endif /* __FreeBSD__ */
|
||||
|
||||
#if defined(__OpenBSD__)
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/sensors.h>
|
||||
#include <machine/apmvar.h>
|
||||
#include "openbsd.h"
|
||||
#endif /* __OpenBSD__ */
|
||||
|
||||
#ifndef HAVE_STRNDUP
|
||||
@ -79,7 +70,7 @@ char *strndup(const char *s, size_t n);
|
||||
#endif
|
||||
|
||||
#ifdef RSS
|
||||
#include "prss.h"
|
||||
#include "rss.h"
|
||||
#endif
|
||||
|
||||
#ifdef SMAPI
|
||||
@ -92,16 +83,7 @@ char *strndup(const char *s, size_t n);
|
||||
|
||||
#include "mboxscan.h"
|
||||
#include "timed_thread.h"
|
||||
|
||||
enum {
|
||||
TOP_CPU,
|
||||
TOP_NAME,
|
||||
TOP_PID,
|
||||
TOP_MEM,
|
||||
TOP_TIME,
|
||||
TOP_MEM_RES,
|
||||
TOP_MEM_VSIZE,
|
||||
};
|
||||
#include "top.h"
|
||||
|
||||
#define DEFAULT_TEXT_BUFFER_SIZE 256
|
||||
extern unsigned int text_buffer_size;
|
||||
@ -124,21 +106,6 @@ extern unsigned int text_buffer_size;
|
||||
#define CRIT_ERR(...) \
|
||||
{ ERR(__VA_ARGS__); exit(EXIT_FAILURE); }
|
||||
|
||||
struct i8k_struct {
|
||||
char *version;
|
||||
char *bios;
|
||||
char *serial;
|
||||
char *cpu_temp;
|
||||
char *left_fan_status;
|
||||
char *right_fan_status;
|
||||
char *left_fan_rpm;
|
||||
char *right_fan_rpm;
|
||||
char *ac_status;
|
||||
char *buttons_status;
|
||||
};
|
||||
|
||||
struct i8k_struct i8k;
|
||||
|
||||
struct net_stat {
|
||||
const char *dev;
|
||||
int up;
|
||||
@ -200,70 +167,19 @@ struct mail_s { // for imap and pop3
|
||||
}; */
|
||||
|
||||
#ifdef MPD
|
||||
struct mpd_s {
|
||||
char *title;
|
||||
char *artist;
|
||||
char *album;
|
||||
char *status;
|
||||
char *random;
|
||||
char *repeat;
|
||||
char *track;
|
||||
char *name;
|
||||
char *file;
|
||||
int volume;
|
||||
unsigned int port;
|
||||
char host[128];
|
||||
char password[128];
|
||||
float progress;
|
||||
int bitrate;
|
||||
int length;
|
||||
int elapsed;
|
||||
int max_title_len; /* e.g. ${mpd_title 50} */
|
||||
};
|
||||
|
||||
#include "mpd.h"
|
||||
#endif
|
||||
|
||||
#ifdef XMMS2
|
||||
struct xmms2_s {
|
||||
char *artist;
|
||||
char *album;
|
||||
char *title;
|
||||
char *genre;
|
||||
char *comment;
|
||||
char *url;
|
||||
char *date;
|
||||
char* playlist;
|
||||
int tracknr;
|
||||
int bitrate;
|
||||
unsigned int id;
|
||||
int duration;
|
||||
int elapsed;
|
||||
int timesplayed;
|
||||
float size;
|
||||
|
||||
float progress;
|
||||
char *status;
|
||||
};
|
||||
#include "xmms2.h"
|
||||
#endif
|
||||
|
||||
#ifdef AUDACIOUS
|
||||
struct audacious_s {
|
||||
audacious_t items; /* e.g. items[AUDACIOUS_STATUS] */
|
||||
int max_title_len; /* e.g. ${audacious_title 50} */
|
||||
timed_thread *p_timed_thread;
|
||||
};
|
||||
#include "audacious.h"
|
||||
#endif
|
||||
|
||||
#ifdef BMPX
|
||||
void update_bmpx(void);
|
||||
struct bmpx_s {
|
||||
char *title;
|
||||
char *artist;
|
||||
char *album;
|
||||
char *uri;
|
||||
int bitrate;
|
||||
int track;
|
||||
};
|
||||
#include "bmpx.h"
|
||||
#endif
|
||||
|
||||
void update_entropy(void);
|
||||
@ -287,7 +203,6 @@ struct gateway_info {
|
||||
|
||||
#ifdef TCP_PORT_MONITOR
|
||||
#include "libtcp-portmon.h"
|
||||
#define MAX_PORT_MONITOR_CONNECTIONS_DEFAULT 256
|
||||
#endif
|
||||
|
||||
enum {
|
||||
@ -353,10 +268,6 @@ enum {
|
||||
IFUP_ADDR
|
||||
} ifup_strictness;
|
||||
|
||||
#ifdef MPD
|
||||
#include "libmpdclient.h"
|
||||
#endif
|
||||
|
||||
/* Update interval */
|
||||
double update_interval;
|
||||
|
||||
@ -391,7 +302,6 @@ struct information {
|
||||
int mail_running;
|
||||
#ifdef MPD
|
||||
struct mpd_s mpd;
|
||||
mpd_Connection *conn;
|
||||
#endif
|
||||
#ifdef XMMS2
|
||||
struct xmms2_s xmms2;
|
||||
@ -450,97 +360,12 @@ char *tmpstring1;
|
||||
char *tmpstring2;
|
||||
|
||||
#ifdef X11
|
||||
/* in x11.c */
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xatom.h>
|
||||
|
||||
#ifdef XFT
|
||||
#include <X11/Xft/Xft.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_XDBE
|
||||
#include <X11/extensions/Xdbe.h>
|
||||
#endif
|
||||
|
||||
#define ATOM(a) XInternAtom(display, #a, False)
|
||||
|
||||
#ifdef OWN_WINDOW
|
||||
enum _window_type {
|
||||
TYPE_NORMAL = 0,
|
||||
TYPE_DOCK,
|
||||
TYPE_DESKTOP,
|
||||
TYPE_OVERRIDE
|
||||
};
|
||||
|
||||
enum _window_hints {
|
||||
HINT_UNDECORATED = 0,
|
||||
HINT_BELOW,
|
||||
HINT_ABOVE,
|
||||
HINT_STICKY,
|
||||
HINT_SKIP_TASKBAR,
|
||||
HINT_SKIP_PAGER
|
||||
};
|
||||
|
||||
#define SET_HINT(mask, hint) (mask |= (1 << hint))
|
||||
#define TEST_HINT(mask, hint) (mask & (1 << hint))
|
||||
#endif
|
||||
|
||||
struct conky_window {
|
||||
Window root, window, desktop;
|
||||
Drawable drawable;
|
||||
GC gc;
|
||||
#ifdef HAVE_XDBE
|
||||
XdbeBackBuffer back_buffer;
|
||||
#endif
|
||||
#ifdef XFT
|
||||
XftDraw *xftdraw;
|
||||
#endif
|
||||
|
||||
int width;
|
||||
int height;
|
||||
#ifdef OWN_WINDOW
|
||||
char class_name[256];
|
||||
char title[256];
|
||||
int x;
|
||||
int y;
|
||||
unsigned int type;
|
||||
unsigned long hints;
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef HAVE_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(void);
|
||||
void init_window(int use_own_window, int width, int height, int set_trans,
|
||||
int back_colour, char **argv, int argc);
|
||||
void create_gc(void);
|
||||
void set_transparent_background(Window win);
|
||||
long get_x11_color(const char *);
|
||||
|
||||
#include "x11.h"
|
||||
#endif /* X11 */
|
||||
|
||||
int cpu_separate;
|
||||
int short_units;
|
||||
|
||||
/* in common.c */
|
||||
|
||||
/* struct that has all info */
|
||||
struct information info;
|
||||
|
||||
@ -570,157 +395,26 @@ extern double current_update_time, last_update_time;
|
||||
|
||||
extern int no_buffers;
|
||||
|
||||
/* system dependant (in linux.c) */
|
||||
|
||||
int check_mount(char *s);
|
||||
void update_diskio(void);
|
||||
void prepare_update(void);
|
||||
void update_uptime(void);
|
||||
void update_meminfo(void);
|
||||
void update_net_stats(void);
|
||||
void update_cpu_usage(void);
|
||||
void update_total_processes(void);
|
||||
void update_running_processes(void);
|
||||
void update_i8k(void);
|
||||
char get_freq(char *, size_t, const char *, int, unsigned int);
|
||||
void get_freq_dynamic(char *, size_t, const char *, int);
|
||||
char get_voltage(char *, size_t, const char *, int, unsigned int); /* ptarjan */
|
||||
void update_load_average(void);
|
||||
int interface_up(const char *dev);
|
||||
char *get_ioscheduler(char *);
|
||||
int get_laptop_mode(void);
|
||||
void update_gateway_info(void);
|
||||
|
||||
int open_sysfs_sensor(const char *dir, const char *dev, const char *type, int n,
|
||||
int *divisor, char *devtype);
|
||||
|
||||
#define open_i2c_sensor(dev, type, n, divisor, devtype) \
|
||||
open_sysfs_sensor("/sys/bus/i2c/devices/", dev, type, n, divisor, devtype)
|
||||
#define open_platform_sensor(dev, type, n, divisor, devtype) \
|
||||
open_sysfs_sensor("/sys/bus/platform/devices/", dev, type, n, divisor, devtype)
|
||||
#define open_hwmon_sensor(dev, type, n, divisor, devtype) \
|
||||
open_sysfs_sensor("/sys/class/hwmon/", dev, type, n, divisor, devtype)
|
||||
|
||||
double get_sysfs_info(int *fd, int arg, char *devtype, char *type);
|
||||
|
||||
void get_adt746x_cpu(char *, size_t);
|
||||
void get_adt746x_fan(char *, size_t);
|
||||
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);
|
||||
void get_acpi_fan(char *, size_t);
|
||||
void get_battery_stuff(char *buf, unsigned int n, const char *bat, int item);
|
||||
int get_battery_perct(const char *bat);
|
||||
int get_battery_perct_bar(const char *bat);
|
||||
void get_ibm_acpi_fan(char *buf, size_t client_buffer_size);
|
||||
void get_ibm_acpi_temps(void);
|
||||
void get_ibm_acpi_volume(char *buf, size_t client_buffer_size);
|
||||
void get_ibm_acpi_brightness(char *buf, size_t client_buffer_size);
|
||||
const char *get_disk_protect_queue(const char *);
|
||||
void get_cpu_count(void);
|
||||
|
||||
struct ibm_acpi_struct {
|
||||
int temps[8];
|
||||
};
|
||||
|
||||
struct ibm_acpi_struct ibm_acpi;
|
||||
|
||||
#if defined(__OpenBSD__)
|
||||
void update_obsd_sensors(void);
|
||||
void get_obsd_vendor(char *buf, size_t client_buffer_size);
|
||||
void get_obsd_product(char *buf, size_t client_buffer_size);
|
||||
|
||||
#define OBSD_MAX_SENSORS 256
|
||||
struct obsd_sensors_struct {
|
||||
int device;
|
||||
float temp[MAXSENSORDEVICES][OBSD_MAX_SENSORS];
|
||||
unsigned int fan[MAXSENSORDEVICES][OBSD_MAX_SENSORS];
|
||||
float volt[MAXSENSORDEVICES][OBSD_MAX_SENSORS];
|
||||
};
|
||||
struct obsd_sensors_struct obsd_sensors;
|
||||
#endif /* __OpenBSD__ */
|
||||
|
||||
enum { PB_BATT_STATUS, PB_BATT_PERCENT, PB_BATT_TIME };
|
||||
void get_powerbook_batt_info(char *, size_t, int);
|
||||
|
||||
struct local_mail_s {
|
||||
char *box;
|
||||
int mail_count;
|
||||
int new_mail_count;
|
||||
float interval;
|
||||
time_t last_mtime;
|
||||
double last_update;
|
||||
};
|
||||
|
||||
void update_top(void);
|
||||
void free_all_processes(void);
|
||||
struct process *get_first_process(void);
|
||||
|
||||
/* 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(struct local_mail_s *);
|
||||
|
||||
/* in freebsd.c */
|
||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
kvm_t *kd;
|
||||
#if defined(__linux__)
|
||||
#include "linux.h"
|
||||
#endif
|
||||
|
||||
#include "fs.h"
|
||||
#include "mixer.h"
|
||||
#include "mail.h"
|
||||
|
||||
#if (defined(__FreeBSD__) || defined(__FreeBSD_kernel__) \
|
||||
|| defined(__OpenBSD__)) && (defined(i386) || defined(__i386__))
|
||||
#ifdef __OpenBSD__
|
||||
typedef struct apm_power_info *apm_info_t;
|
||||
#endif
|
||||
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
|
||||
extern void init_mpd_stats(struct information *current_info);
|
||||
void *update_mpd(void *) __attribute__((noreturn));
|
||||
extern timed_thread *mpd_timed_thread;
|
||||
void free_mpd_vars(struct information *current_info);
|
||||
#endif /* MPD */
|
||||
|
||||
/* in xmms2.c */
|
||||
#ifdef XMMS2
|
||||
void update_xmms2(void);
|
||||
#endif
|
||||
|
||||
/* in hddtemp.c */
|
||||
#ifdef HDDTEMP
|
||||
int scan_hddtemp(const char *arg, char **dev, char **addr, int *port, char **temp);
|
||||
char *get_hddtemp_info(char *dev, char *addr, int port, char *unit);
|
||||
#include "hddtemp.h"
|
||||
#endif /* HDDTEMP */
|
||||
|
||||
/* in rss.c */
|
||||
#ifdef RSS
|
||||
PRSS *get_rss_info(char *uri, int delay);
|
||||
void init_rss_info(void);
|
||||
void free_rss_info(void);
|
||||
#endif /* RSS */
|
||||
|
||||
/* in linux.c */
|
||||
|
||||
/* in nvidia.c */
|
||||
#ifdef NVIDIA
|
||||
|
||||
|
@ -29,7 +29,6 @@
|
||||
|
||||
#include "conky.h"
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
/* The following ifdefs were adapted from gkrellm */
|
||||
#include <linux/major.h>
|
||||
|
||||
|
@ -45,9 +45,6 @@
|
||||
#include <fcntl.h>
|
||||
#include <ifaddrs.h>
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <dev/wi/if_wavelan_ieee.h>
|
||||
|
15
src/freebsd.h
Normal file
15
src/freebsd.h
Normal file
@ -0,0 +1,15 @@
|
||||
#ifndef FREEBSD_H_
|
||||
#define FREEBSD_H_
|
||||
|
||||
#include "common.h"
|
||||
#include <sys/mount.h>
|
||||
#include <sys/ucred.h>
|
||||
#include <fcntl.h>
|
||||
#include <kvm.h>
|
||||
#if (defined(i386) || defined(__i386__))
|
||||
#include <machine/apm_bios.h>
|
||||
#endif /* i386 || __i386__ */
|
||||
|
||||
kvm_t *kd;
|
||||
|
||||
#endif /*FREEBSD_H_*/
|
2
src/fs.c
2
src/fs.c
@ -27,8 +27,6 @@
|
||||
|
||||
#include "conky.h"
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
|
8
src/fs.h
Normal file
8
src/fs.h
Normal file
@ -0,0 +1,8 @@
|
||||
#ifndef FS_H_
|
||||
#define FS_H_
|
||||
|
||||
void update_fs_stats(void);
|
||||
struct fs_stat *prepare_fs_stat(const char *path);
|
||||
void clear_fs_stats(void);
|
||||
|
||||
#endif /*FS_H_*/
|
@ -27,9 +27,6 @@
|
||||
|
||||
#include "conky.h"
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <netdb.h>
|
||||
|
7
src/hddtemp.h
Normal file
7
src/hddtemp.h
Normal file
@ -0,0 +1,7 @@
|
||||
#ifndef HDDTEMP_H_
|
||||
#define HDDTEMP_H_
|
||||
|
||||
int scan_hddtemp(const char *arg, char **dev, char **addr, int *port, char **temp);
|
||||
char *get_hddtemp_info(char *dev, char *addr, int port, char *unit);
|
||||
|
||||
#endif /*HDDTEMP_H_*/
|
@ -39,11 +39,8 @@
|
||||
#include <errno.h>
|
||||
#include <ctype.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/param.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
|
||||
|
@ -41,6 +41,7 @@
|
||||
#define TCP_CONNECTION_STARTING_AGE 1
|
||||
#define TCP_CONNECTION_HASH_KEY_SIZE 28
|
||||
#define TCP_PORT_MONITOR_HASH_KEY_SIZE 12
|
||||
#define MAX_PORT_MONITOR_CONNECTIONS_DEFAULT 256
|
||||
|
||||
/* -------------------------------------------------------------------
|
||||
* IMPLEMENTATION INTERFACE
|
||||
|
@ -27,9 +27,6 @@
|
||||
* $Id$ */
|
||||
|
||||
#include "conky.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <dirent.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
|
41
src/linux.h
Normal file
41
src/linux.h
Normal file
@ -0,0 +1,41 @@
|
||||
#ifndef LINUX_H_
|
||||
#define LINUX_H_
|
||||
|
||||
#include "common.h"
|
||||
|
||||
void get_ibm_acpi_fan(char *buf, size_t client_buffer_size);
|
||||
void get_ibm_acpi_temps(void);
|
||||
void get_ibm_acpi_volume(char *buf, size_t client_buffer_size);
|
||||
void get_ibm_acpi_brightness(char *buf, size_t client_buffer_size);
|
||||
const char *get_disk_protect_queue(const char *);
|
||||
|
||||
struct i8k_struct {
|
||||
char *version;
|
||||
char *bios;
|
||||
char *serial;
|
||||
char *cpu_temp;
|
||||
char *left_fan_status;
|
||||
char *right_fan_status;
|
||||
char *left_fan_rpm;
|
||||
char *right_fan_rpm;
|
||||
char *ac_status;
|
||||
char *buttons_status;
|
||||
};
|
||||
|
||||
struct i8k_struct i8k;
|
||||
|
||||
struct ibm_acpi_struct {
|
||||
int temps[8];
|
||||
};
|
||||
|
||||
struct ibm_acpi_struct ibm_acpi;
|
||||
|
||||
int interface_up(const char *dev);
|
||||
char *get_ioscheduler(char *);
|
||||
int get_laptop_mode(void);
|
||||
void update_gateway_info(void);
|
||||
|
||||
enum { PB_BATT_STATUS, PB_BATT_PERCENT, PB_BATT_TIME };
|
||||
void get_powerbook_batt_info(char *, size_t, int);
|
||||
|
||||
#endif /*LINUX_H_*/
|
@ -30,8 +30,6 @@
|
||||
|
||||
#include <dirent.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "conky.h"
|
||||
|
||||
|
17
src/mail.h
Normal file
17
src/mail.h
Normal file
@ -0,0 +1,17 @@
|
||||
#ifndef MAIL_H_
|
||||
#define MAIL_H_
|
||||
|
||||
extern char *current_mail_spool;
|
||||
|
||||
struct local_mail_s {
|
||||
char *box;
|
||||
int mail_count;
|
||||
int new_mail_count;
|
||||
float interval;
|
||||
time_t last_mtime;
|
||||
double last_update;
|
||||
};
|
||||
|
||||
void update_mail_count(struct local_mail_s *);
|
||||
|
||||
#endif /*MAIL_H_*/
|
@ -29,9 +29,6 @@
|
||||
#include <sys/stat.h>
|
||||
#include <sys/time.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "mboxscan.h"
|
||||
|
||||
#define FROM_WIDTH 10
|
||||
|
@ -29,8 +29,6 @@
|
||||
#include <sys/ioctl.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
#ifdef HAVE_LINUX_SOUNDCARD_H
|
||||
|
9
src/mixer.h
Normal file
9
src/mixer.h
Normal file
@ -0,0 +1,9 @@
|
||||
#ifndef MIXER_H_
|
||||
#define MIXER_H_
|
||||
|
||||
int mixer_init(const char *);
|
||||
int mixer_get_avg(int);
|
||||
int mixer_get_left(int);
|
||||
int mixer_get_right(int);
|
||||
|
||||
#endif /*MIXER_H_*/
|
332
src/mpd.c
332
src/mpd.c
@ -25,229 +25,221 @@
|
||||
* $Id$ */
|
||||
|
||||
#include "conky.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "libmpdclient.h"
|
||||
|
||||
timed_thread *mpd_timed_thread = NULL;
|
||||
|
||||
void clear_mpd_stats(struct information *current_info);
|
||||
|
||||
void init_mpd_stats(struct information *current_info)
|
||||
void init_mpd_stats(struct mpd_s *mpd)
|
||||
{
|
||||
if (current_info->mpd.artist == NULL) {
|
||||
current_info->mpd.artist = malloc(text_buffer_size);
|
||||
if (mpd->artist == NULL) {
|
||||
mpd->artist = malloc(text_buffer_size);
|
||||
}
|
||||
if (current_info->mpd.album == NULL) {
|
||||
current_info->mpd.album = malloc(text_buffer_size);
|
||||
if (mpd->album == NULL) {
|
||||
mpd->album = malloc(text_buffer_size);
|
||||
}
|
||||
if (current_info->mpd.title == NULL) {
|
||||
current_info->mpd.title = malloc(text_buffer_size);
|
||||
if (mpd->title == NULL) {
|
||||
mpd->title = malloc(text_buffer_size);
|
||||
}
|
||||
if (current_info->mpd.random == NULL) {
|
||||
current_info->mpd.random = malloc(text_buffer_size);
|
||||
if (mpd->random == NULL) {
|
||||
mpd->random = malloc(text_buffer_size);
|
||||
}
|
||||
if (current_info->mpd.repeat == NULL) {
|
||||
current_info->mpd.repeat = malloc(text_buffer_size);
|
||||
if (mpd->repeat == NULL) {
|
||||
mpd->repeat = malloc(text_buffer_size);
|
||||
}
|
||||
if (current_info->mpd.track == NULL) {
|
||||
current_info->mpd.track = malloc(text_buffer_size);
|
||||
if (mpd->track == NULL) {
|
||||
mpd->track = malloc(text_buffer_size);
|
||||
}
|
||||
if (current_info->mpd.status == NULL) {
|
||||
current_info->mpd.status = malloc(text_buffer_size);
|
||||
if (mpd->status == NULL) {
|
||||
mpd->status = malloc(text_buffer_size);
|
||||
}
|
||||
if (current_info->mpd.name == NULL) {
|
||||
current_info->mpd.name = malloc(text_buffer_size);
|
||||
if (mpd->name == NULL) {
|
||||
mpd->name = malloc(text_buffer_size);
|
||||
}
|
||||
if (current_info->mpd.file == NULL) {
|
||||
current_info->mpd.file = malloc(text_buffer_size);
|
||||
if (mpd->file == NULL) {
|
||||
mpd->file = malloc(text_buffer_size);
|
||||
}
|
||||
clear_mpd_stats(current_info);
|
||||
clear_mpd_stats(mpd);
|
||||
}
|
||||
|
||||
void free_mpd_vars(struct information *current_info)
|
||||
void free_mpd_vars(struct mpd_s *mpd)
|
||||
{
|
||||
if (current_info->mpd.title) {
|
||||
free(current_info->mpd.title);
|
||||
current_info->mpd.title = NULL;
|
||||
if (mpd->title) {
|
||||
free(mpd->title);
|
||||
mpd->title = NULL;
|
||||
}
|
||||
if (current_info->mpd.artist) {
|
||||
free(current_info->mpd.artist);
|
||||
current_info->mpd.artist = NULL;
|
||||
if (mpd->artist) {
|
||||
free(mpd->artist);
|
||||
mpd->artist = NULL;
|
||||
}
|
||||
if (current_info->mpd.album) {
|
||||
free(current_info->mpd.album);
|
||||
current_info->mpd.album = NULL;
|
||||
if (mpd->album) {
|
||||
free(mpd->album);
|
||||
mpd->album = NULL;
|
||||
}
|
||||
if (current_info->mpd.random) {
|
||||
free(current_info->mpd.random);
|
||||
current_info->mpd.random = NULL;
|
||||
if (mpd->random) {
|
||||
free(mpd->random);
|
||||
mpd->random = NULL;
|
||||
}
|
||||
if (current_info->mpd.repeat) {
|
||||
free(current_info->mpd.repeat);
|
||||
current_info->mpd.repeat = NULL;
|
||||
if (mpd->repeat) {
|
||||
free(mpd->repeat);
|
||||
mpd->repeat = NULL;
|
||||
}
|
||||
if (current_info->mpd.track) {
|
||||
free(current_info->mpd.track);
|
||||
current_info->mpd.track = NULL;
|
||||
if (mpd->track) {
|
||||
free(mpd->track);
|
||||
mpd->track = NULL;
|
||||
}
|
||||
if (current_info->mpd.name) {
|
||||
free(current_info->mpd.name);
|
||||
current_info->mpd.name = NULL;
|
||||
if (mpd->name) {
|
||||
free(mpd->name);
|
||||
mpd->name = NULL;
|
||||
}
|
||||
if (current_info->mpd.file) {
|
||||
free(current_info->mpd.file);
|
||||
current_info->mpd.file = NULL;
|
||||
if (mpd->file) {
|
||||
free(mpd->file);
|
||||
mpd->file = NULL;
|
||||
}
|
||||
if (current_info->mpd.status) {
|
||||
free(current_info->mpd.status);
|
||||
current_info->mpd.status = NULL;
|
||||
if (mpd->status) {
|
||||
free(mpd->status);
|
||||
mpd->status = NULL;
|
||||
}
|
||||
if (current_info->conn) {
|
||||
mpd_closeConnection(current_info->conn);
|
||||
current_info->conn = 0;
|
||||
if (mpd->conn) {
|
||||
mpd_closeConnection(mpd->conn);
|
||||
mpd->conn = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void clear_mpd_stats(struct information *current_info)
|
||||
void clear_mpd_stats(struct mpd_s *mpd)
|
||||
{
|
||||
*current_info->mpd.name = 0;
|
||||
*current_info->mpd.file = 0;
|
||||
*current_info->mpd.artist = 0;
|
||||
*current_info->mpd.album = 0;
|
||||
*current_info->mpd.title = 0;
|
||||
*current_info->mpd.random = 0;
|
||||
*current_info->mpd.repeat = 0;
|
||||
*current_info->mpd.track = 0;
|
||||
*current_info->mpd.status = 0;
|
||||
current_info->mpd.bitrate = 0;
|
||||
current_info->mpd.progress = 0;
|
||||
current_info->mpd.elapsed = 0;
|
||||
current_info->mpd.length = 0;
|
||||
*mpd->name = 0;
|
||||
*mpd->file = 0;
|
||||
*mpd->artist = 0;
|
||||
*mpd->album = 0;
|
||||
*mpd->title = 0;
|
||||
*mpd->random = 0;
|
||||
*mpd->repeat = 0;
|
||||
*mpd->track = 0;
|
||||
*mpd->status = 0;
|
||||
mpd->bitrate = 0;
|
||||
mpd->progress = 0;
|
||||
mpd->elapsed = 0;
|
||||
mpd->length = 0;
|
||||
}
|
||||
|
||||
void *update_mpd(void *arg)
|
||||
{
|
||||
struct information *current_info = &info;
|
||||
|
||||
if (arg) {
|
||||
/* make gcc happy (unused argument) */
|
||||
if (arg == NULL) {
|
||||
CRIT_ERR("update_mpd called with a null argument!");
|
||||
}
|
||||
|
||||
struct mpd_s *mpd = (struct mpd_s *) arg;
|
||||
|
||||
while (1) {
|
||||
mpd_Status *status;
|
||||
mpd_InfoEntity *entity;
|
||||
|
||||
if (!current_info->conn) {
|
||||
current_info->conn = mpd_newConnection(current_info->mpd.host,
|
||||
current_info->mpd.port, 10);
|
||||
if (!mpd->conn) {
|
||||
mpd->conn = mpd_newConnection(mpd->host,
|
||||
mpd->port, 10);
|
||||
}
|
||||
if (strlen(current_info->mpd.password) > 1) {
|
||||
mpd_sendPasswordCommand(current_info->conn,
|
||||
current_info->mpd.password);
|
||||
mpd_finishCommand(current_info->conn);
|
||||
if (strlen(mpd->password) > 1) {
|
||||
mpd_sendPasswordCommand(mpd->conn,
|
||||
mpd->password);
|
||||
mpd_finishCommand(mpd->conn);
|
||||
}
|
||||
|
||||
timed_thread_lock(mpd_timed_thread);
|
||||
timed_thread_lock(mpd->timed_thread);
|
||||
|
||||
if (current_info->conn->error || current_info->conn == NULL) {
|
||||
ERR("MPD error: %s\n", current_info->conn->errorStr);
|
||||
mpd_closeConnection(current_info->conn);
|
||||
current_info->conn = 0;
|
||||
clear_mpd_stats(current_info);
|
||||
if (mpd->conn->error || mpd->conn == NULL) {
|
||||
ERR("MPD error: %s\n", mpd->conn->errorStr);
|
||||
mpd_closeConnection(mpd->conn);
|
||||
mpd->conn = 0;
|
||||
clear_mpd_stats(mpd);
|
||||
|
||||
strncpy(current_info->mpd.status, "MPD not responding",
|
||||
strncpy(mpd->status, "MPD not responding",
|
||||
text_buffer_size - 1);
|
||||
timed_thread_unlock(mpd_timed_thread);
|
||||
if (timed_thread_test(mpd_timed_thread)) {
|
||||
timed_thread_exit(mpd_timed_thread);
|
||||
timed_thread_unlock(mpd->timed_thread);
|
||||
if (timed_thread_test(mpd->timed_thread)) {
|
||||
timed_thread_exit(mpd->timed_thread);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
mpd_sendStatusCommand(current_info->conn);
|
||||
if ((status = mpd_getStatus(current_info->conn)) == NULL) {
|
||||
ERR("MPD error: %s\n", current_info->conn->errorStr);
|
||||
mpd_closeConnection(current_info->conn);
|
||||
current_info->conn = 0;
|
||||
clear_mpd_stats(current_info);
|
||||
mpd_sendStatusCommand(mpd->conn);
|
||||
if ((status = mpd_getStatus(mpd->conn)) == NULL) {
|
||||
ERR("MPD error: %s\n", mpd->conn->errorStr);
|
||||
mpd_closeConnection(mpd->conn);
|
||||
mpd->conn = 0;
|
||||
clear_mpd_stats(mpd);
|
||||
|
||||
strncpy(current_info->mpd.status, "MPD not responding",
|
||||
strncpy(mpd->status, "MPD not responding",
|
||||
text_buffer_size - 1);
|
||||
timed_thread_unlock(mpd_timed_thread);
|
||||
if (timed_thread_test(mpd_timed_thread)) {
|
||||
timed_thread_exit(mpd_timed_thread);
|
||||
timed_thread_unlock(mpd->timed_thread);
|
||||
if (timed_thread_test(mpd->timed_thread)) {
|
||||
timed_thread_exit(mpd->timed_thread);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
mpd_finishCommand(current_info->conn);
|
||||
if (current_info->conn->error) {
|
||||
// fprintf(stderr, "%s\n", current_info->conn->errorStr);
|
||||
mpd_closeConnection(current_info->conn);
|
||||
current_info->conn = 0;
|
||||
timed_thread_unlock(mpd_timed_thread);
|
||||
if (timed_thread_test(mpd_timed_thread)) {
|
||||
timed_thread_exit(mpd_timed_thread);
|
||||
mpd_finishCommand(mpd->conn);
|
||||
if (mpd->conn->error) {
|
||||
// fprintf(stderr, "%s\n", mpd->conn->errorStr);
|
||||
mpd_closeConnection(mpd->conn);
|
||||
mpd->conn = 0;
|
||||
timed_thread_unlock(mpd->timed_thread);
|
||||
if (timed_thread_test(mpd->timed_thread)) {
|
||||
timed_thread_exit(mpd->timed_thread);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
current_info->mpd.volume = status->volume;
|
||||
mpd->volume = status->volume;
|
||||
/* if (status->error) {
|
||||
printf("error: %s\n", status->error);
|
||||
} */
|
||||
|
||||
if (status->state == MPD_STATUS_STATE_PLAY) {
|
||||
strncpy(current_info->mpd.status, "Playing", text_buffer_size - 1);
|
||||
strncpy(mpd->status, "Playing", text_buffer_size - 1);
|
||||
}
|
||||
if (status->state == MPD_STATUS_STATE_STOP) {
|
||||
clear_mpd_stats(current_info);
|
||||
strncpy(current_info->mpd.status, "Stopped", text_buffer_size - 1);
|
||||
clear_mpd_stats(mpd);
|
||||
strncpy(mpd->status, "Stopped", text_buffer_size - 1);
|
||||
}
|
||||
if (status->state == MPD_STATUS_STATE_PAUSE) {
|
||||
strncpy(current_info->mpd.status, "Paused", text_buffer_size - 1);
|
||||
strncpy(mpd->status, "Paused", text_buffer_size - 1);
|
||||
}
|
||||
if (status->state == MPD_STATUS_STATE_UNKNOWN) {
|
||||
clear_mpd_stats(current_info);
|
||||
*current_info->mpd.status = 0;
|
||||
clear_mpd_stats(mpd);
|
||||
*mpd->status = 0;
|
||||
}
|
||||
if (status->state == MPD_STATUS_STATE_PLAY
|
||||
|| status->state == MPD_STATUS_STATE_PAUSE) {
|
||||
current_info->mpd.bitrate = status->bitRate;
|
||||
current_info->mpd.progress = (float) status->elapsedTime /
|
||||
mpd->bitrate = status->bitRate;
|
||||
mpd->progress = (float) status->elapsedTime /
|
||||
status->totalTime;
|
||||
current_info->mpd.elapsed = status->elapsedTime;
|
||||
current_info->mpd.length = status->totalTime;
|
||||
mpd->elapsed = status->elapsedTime;
|
||||
mpd->length = status->totalTime;
|
||||
if (status->random == 0) {
|
||||
strcpy(current_info->mpd.random, "Off");
|
||||
strcpy(mpd->random, "Off");
|
||||
} else if (status->random == 1) {
|
||||
strcpy(current_info->mpd.random, "On");
|
||||
strcpy(mpd->random, "On");
|
||||
} else {
|
||||
*current_info->mpd.random = 0;
|
||||
*mpd->random = 0;
|
||||
}
|
||||
if (status->repeat == 0) {
|
||||
strcpy(current_info->mpd.repeat, "Off");
|
||||
strcpy(mpd->repeat, "Off");
|
||||
} else if (status->repeat == 1) {
|
||||
strcpy(current_info->mpd.repeat, "On");
|
||||
strcpy(mpd->repeat, "On");
|
||||
} else {
|
||||
*current_info->mpd.repeat = 0;
|
||||
*mpd->repeat = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (current_info->conn->error) {
|
||||
// fprintf(stderr, "%s\n", current_info->conn->errorStr);
|
||||
mpd_closeConnection(current_info->conn);
|
||||
current_info->conn = 0;
|
||||
timed_thread_unlock(mpd_timed_thread);
|
||||
if (timed_thread_test(mpd_timed_thread)) {
|
||||
timed_thread_exit(mpd_timed_thread);
|
||||
if (mpd->conn->error) {
|
||||
// fprintf(stderr, "%s\n", mpd->conn->errorStr);
|
||||
mpd_closeConnection(mpd->conn);
|
||||
mpd->conn = 0;
|
||||
timed_thread_unlock(mpd->timed_thread);
|
||||
if (timed_thread_test(mpd->timed_thread)) {
|
||||
timed_thread_exit(mpd->timed_thread);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
mpd_sendCurrentSongCommand(current_info->conn);
|
||||
while ((entity = mpd_getNextInfoEntity(current_info->conn))) {
|
||||
mpd_sendCurrentSongCommand(mpd->conn);
|
||||
while ((entity = mpd_getNextInfoEntity(mpd->conn))) {
|
||||
mpd_Song *song = entity->info.song;
|
||||
|
||||
if (entity->type != MPD_INFO_ENTITY_TYPE_SONG) {
|
||||
@ -256,40 +248,40 @@ void *update_mpd(void *arg)
|
||||
}
|
||||
|
||||
if (song->artist) {
|
||||
strncpy(current_info->mpd.artist, song->artist,
|
||||
strncpy(mpd->artist, song->artist,
|
||||
text_buffer_size - 1);
|
||||
} else {
|
||||
*current_info->mpd.artist = 0;
|
||||
*mpd->artist = 0;
|
||||
}
|
||||
if (song->album) {
|
||||
strncpy(current_info->mpd.album, song->album,
|
||||
strncpy(mpd->album, song->album,
|
||||
text_buffer_size - 1);
|
||||
} else {
|
||||
*current_info->mpd.album = 0;
|
||||
*mpd->album = 0;
|
||||
}
|
||||
if (song->title) {
|
||||
strncpy(current_info->mpd.title, song->title,
|
||||
strncpy(mpd->title, song->title,
|
||||
text_buffer_size - 1);
|
||||
} else {
|
||||
*current_info->mpd.title = 0;
|
||||
*mpd->title = 0;
|
||||
}
|
||||
if (song->track) {
|
||||
strncpy(current_info->mpd.track, song->track,
|
||||
strncpy(mpd->track, song->track,
|
||||
text_buffer_size - 1);
|
||||
} else {
|
||||
*current_info->mpd.track = 0;
|
||||
*mpd->track = 0;
|
||||
}
|
||||
if (song->name) {
|
||||
strncpy(current_info->mpd.name, song->name,
|
||||
strncpy(mpd->name, song->name,
|
||||
text_buffer_size - 1);
|
||||
} else {
|
||||
*current_info->mpd.name = 0;
|
||||
*mpd->name = 0;
|
||||
}
|
||||
if (song->file) {
|
||||
strncpy(current_info->mpd.file, song->file,
|
||||
strncpy(mpd->file, song->file,
|
||||
text_buffer_size - 1);
|
||||
} else {
|
||||
*current_info->mpd.file = 0;
|
||||
*mpd->file = 0;
|
||||
}
|
||||
if (entity != NULL) {
|
||||
mpd_freeInfoEntity(entity);
|
||||
@ -300,36 +292,36 @@ void *update_mpd(void *arg)
|
||||
mpd_freeInfoEntity(entity);
|
||||
entity = NULL;
|
||||
}
|
||||
mpd_finishCommand(current_info->conn);
|
||||
if (current_info->conn->error) {
|
||||
// fprintf(stderr, "%s\n", current_info->conn->errorStr);
|
||||
mpd_closeConnection(current_info->conn);
|
||||
current_info->conn = 0;
|
||||
timed_thread_unlock(mpd_timed_thread);
|
||||
if (timed_thread_test(mpd_timed_thread)) {
|
||||
timed_thread_exit(mpd_timed_thread);
|
||||
mpd_finishCommand(mpd->conn);
|
||||
if (mpd->conn->error) {
|
||||
// fprintf(stderr, "%s\n", mpd->conn->errorStr);
|
||||
mpd_closeConnection(mpd->conn);
|
||||
mpd->conn = 0;
|
||||
timed_thread_unlock(mpd->timed_thread);
|
||||
if (timed_thread_test(mpd->timed_thread)) {
|
||||
timed_thread_exit(mpd->timed_thread);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
timed_thread_unlock(mpd_timed_thread);
|
||||
if (current_info->conn->error) {
|
||||
// fprintf(stderr, "%s\n", current_info->conn->errorStr);
|
||||
mpd_closeConnection(current_info->conn);
|
||||
current_info->conn = 0;
|
||||
if (timed_thread_test(mpd_timed_thread)) {
|
||||
timed_thread_exit(mpd_timed_thread);
|
||||
timed_thread_unlock(mpd->timed_thread);
|
||||
if (mpd->conn->error) {
|
||||
// fprintf(stderr, "%s\n", mpd->conn->errorStr);
|
||||
mpd_closeConnection(mpd->conn);
|
||||
mpd->conn = 0;
|
||||
if (timed_thread_test(mpd->timed_thread)) {
|
||||
timed_thread_exit(mpd->timed_thread);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
mpd_freeStatus(status);
|
||||
/* if (current_info->conn) {
|
||||
mpd_closeConnection(current_info->conn);
|
||||
current_info->conn = 0;
|
||||
/* if (mpd->conn) {
|
||||
mpd_closeConnection(mpd->conn);
|
||||
mpd->conn = 0;
|
||||
} */
|
||||
if (timed_thread_test(mpd_timed_thread)) {
|
||||
timed_thread_exit(mpd_timed_thread);
|
||||
if (timed_thread_test(mpd->timed_thread)) {
|
||||
timed_thread_exit(mpd->timed_thread);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
41
src/mpd.h
Normal file
41
src/mpd.h
Normal file
@ -0,0 +1,41 @@
|
||||
#ifndef MPD_H_
|
||||
#define MPD_H_
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "libmpdclient.h"
|
||||
#include "timed_thread.h"
|
||||
|
||||
struct mpd_s {
|
||||
char *title;
|
||||
char *artist;
|
||||
char *album;
|
||||
char *status;
|
||||
char *random;
|
||||
char *repeat;
|
||||
char *track;
|
||||
char *name;
|
||||
char *file;
|
||||
int volume;
|
||||
unsigned int port;
|
||||
char host[128];
|
||||
char password[128];
|
||||
float progress;
|
||||
int bitrate;
|
||||
int length;
|
||||
int elapsed;
|
||||
int max_title_len; /* e.g. ${mpd_title 50} */
|
||||
mpd_Connection *conn;
|
||||
timed_thread *timed_thread;
|
||||
};
|
||||
|
||||
#include "conky.h"
|
||||
|
||||
extern void init_mpd_stats(struct mpd_s *mpd);
|
||||
void clear_mpd_stats(struct mpd_s *mpd);
|
||||
void *update_mpd(void *) __attribute__((noreturn));
|
||||
void free_mpd_vars(struct mpd_s *mpd);
|
||||
|
||||
#endif /*MPD_H_*/
|
31
src/netbsd.c
31
src/netbsd.c
@ -25,36 +25,7 @@
|
||||
*
|
||||
* $Id$ */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <err.h>
|
||||
#include <limits.h>
|
||||
#include <paths.h>
|
||||
|
||||
#include <kvm.h>
|
||||
#include <nlist.h>
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/user.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/swap.h>
|
||||
#include <sys/sched.h>
|
||||
#include <sys/envsys.h>
|
||||
|
||||
#include <net/if.h>
|
||||
|
||||
#include <uvm/uvm_extern.h>
|
||||
|
||||
#include <machine/param.h>
|
||||
|
||||
#include "conky.h"
|
||||
#include "netbsd.h"
|
||||
|
||||
static kvm_t *kd = NULL;
|
||||
int kd_init = 0, nkd_init = 0;
|
||||
|
31
src/netbsd.h
Normal file
31
src/netbsd.h
Normal file
@ -0,0 +1,31 @@
|
||||
#ifndef NETBSD_H_
|
||||
#define NETBSD_H_
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <err.h>
|
||||
#include <limits.h>
|
||||
#include <paths.h>
|
||||
#include <kvm.h>
|
||||
#include <nlist.h>
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/user.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/swap.h>
|
||||
#include <sys/sched.h>
|
||||
#include <sys/envsys.h>
|
||||
|
||||
#include <net/if.h>
|
||||
|
||||
#include <uvm/uvm_extern.h>
|
||||
|
||||
#include <machine/param.h>
|
||||
|
||||
#include "conky.h"
|
||||
#include "common.h"
|
||||
|
||||
#endif /*NETBSD_H_*/
|
@ -49,9 +49,6 @@
|
||||
#include <fcntl.h>
|
||||
#include <ifaddrs.h>
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <machine/apmvar.h>
|
||||
|
||||
|
26
src/openbsd.h
Normal file
26
src/openbsd.h
Normal file
@ -0,0 +1,26 @@
|
||||
#ifndef OPENBSD_H_
|
||||
#define OPENBSD_H_
|
||||
|
||||
#include "common.h"
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/sensors.h>
|
||||
#include <machine/apmvar.h>
|
||||
|
||||
void update_obsd_sensors(void);
|
||||
void get_obsd_vendor(char *buf, size_t client_buffer_size);
|
||||
void get_obsd_product(char *buf, size_t client_buffer_size);
|
||||
|
||||
#define OBSD_MAX_SENSORS 256
|
||||
struct obsd_sensors_struct {
|
||||
int device;
|
||||
float temp[MAXSENSORDEVICES][OBSD_MAX_SENSORS];
|
||||
unsigned int fan[MAXSENSORDEVICES][OBSD_MAX_SENSORS];
|
||||
float volt[MAXSENSORDEVICES][OBSD_MAX_SENSORS];
|
||||
};
|
||||
struct obsd_sensors_struct obsd_sensors;
|
||||
|
||||
#if defined(i386) || defined(__i386__)
|
||||
typedef struct apm_power_info *apm_info_t;
|
||||
#endif
|
||||
|
||||
#endif /*OPENBSD_H_*/
|
@ -15,14 +15,10 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
|
||||
|
||||
#include "config.h"
|
||||
#include "prss.h"
|
||||
#include "conky.h"
|
||||
#include <libxml/parser.h>
|
||||
#include <libxml/tree.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifndef PARSE_OPTIONS
|
||||
#define PARSE_OPTIONS 0
|
||||
|
@ -27,8 +27,6 @@
|
||||
|
||||
#include "conky.h"
|
||||
#include "prss.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <assert.h>
|
||||
#include <curl/curl.h>
|
||||
|
10
src/rss.h
Normal file
10
src/rss.h
Normal file
@ -0,0 +1,10 @@
|
||||
#ifndef RSS_H_
|
||||
#define RSS_H_
|
||||
|
||||
#include "prss.h"
|
||||
|
||||
PRSS *get_rss_info(char *uri, int delay);
|
||||
void init_rss_info(void);
|
||||
void free_rss_info(void);
|
||||
|
||||
#endif /*RSS_H_*/
|
@ -20,10 +20,8 @@
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
#include "conky.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "smapi.h"
|
||||
|
||||
#define SYS_SMAPI_PATH "/sys/devices/platform/smapi"
|
||||
|
||||
|
@ -24,6 +24,9 @@
|
||||
#ifndef SMAPI_H
|
||||
#define SMAPI_H
|
||||
|
||||
#include "conky.h"
|
||||
#include <sys/stat.h>
|
||||
|
||||
int smapi_bat_installed(int);
|
||||
|
||||
char *smapi_read_str(const char *);
|
||||
|
@ -26,8 +26,6 @@
|
||||
#include <pthread.h>
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#ifndef HAVE_CLOCK_GETTIME
|
||||
#include <sys/time.h>
|
||||
|
@ -22,6 +22,8 @@
|
||||
#ifndef _TIMED_THREAD_H_
|
||||
#define _TIMED_THREAD_H_
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
/* 10000 microseconds = 10 ms = 0.01 sec */
|
||||
#define MINIMUM_INTERVAL_USECS 10000
|
||||
|
||||
|
13
src/top.h
13
src/top.h
@ -40,8 +40,6 @@
|
||||
|
||||
#include "conky.h"
|
||||
#define CPU_THRESHHOLD 0 /* threshhold for the cpu diff to appear */
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <dirent.h>
|
||||
#include <string.h>
|
||||
@ -56,7 +54,6 @@
|
||||
|
||||
#include <sys/wait.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/time.h>
|
||||
@ -76,6 +73,16 @@
|
||||
#define PROCFS_CMDLINE_TEMPLATE "/proc/%d/cmdline"
|
||||
#define MAX_SP 10 // number of elements to sort
|
||||
|
||||
enum top_field {
|
||||
TOP_CPU,
|
||||
TOP_NAME,
|
||||
TOP_PID,
|
||||
TOP_MEM,
|
||||
TOP_TIME,
|
||||
TOP_MEM_RES,
|
||||
TOP_MEM_VSIZE
|
||||
};
|
||||
|
||||
/******************************************
|
||||
* Process class *
|
||||
******************************************/
|
||||
|
@ -29,9 +29,6 @@
|
||||
|
||||
#include "conky.h"
|
||||
#include <utmp.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
||||
static void user_name(char *ptr)
|
||||
|
86
src/x11.h
Normal file
86
src/x11.h
Normal file
@ -0,0 +1,86 @@
|
||||
#ifndef X11_H_
|
||||
#define X11_H_
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xatom.h>
|
||||
|
||||
#ifdef XFT
|
||||
#include <X11/Xft/Xft.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_XDBE
|
||||
#include <X11/extensions/Xdbe.h>
|
||||
#endif
|
||||
|
||||
#define ATOM(a) XInternAtom(display, #a, False)
|
||||
|
||||
#ifdef OWN_WINDOW
|
||||
enum _window_type {
|
||||
TYPE_NORMAL = 0,
|
||||
TYPE_DOCK,
|
||||
TYPE_DESKTOP,
|
||||
TYPE_OVERRIDE
|
||||
};
|
||||
|
||||
enum _window_hints {
|
||||
HINT_UNDECORATED = 0,
|
||||
HINT_BELOW,
|
||||
HINT_ABOVE,
|
||||
HINT_STICKY,
|
||||
HINT_SKIP_TASKBAR,
|
||||
HINT_SKIP_PAGER
|
||||
};
|
||||
|
||||
#define SET_HINT(mask, hint) (mask |= (1 << hint))
|
||||
#define TEST_HINT(mask, hint) (mask & (1 << hint))
|
||||
#endif
|
||||
|
||||
struct conky_window {
|
||||
Window root, window, desktop;
|
||||
Drawable drawable;
|
||||
GC gc;
|
||||
#ifdef HAVE_XDBE
|
||||
XdbeBackBuffer back_buffer;
|
||||
#endif
|
||||
#ifdef XFT
|
||||
XftDraw *xftdraw;
|
||||
#endif
|
||||
|
||||
int width;
|
||||
int height;
|
||||
#ifdef OWN_WINDOW
|
||||
char class_name[256];
|
||||
char title[256];
|
||||
int x;
|
||||
int y;
|
||||
unsigned int type;
|
||||
unsigned long hints;
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef HAVE_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(void);
|
||||
void init_window(int use_own_window, int width, int height, int set_trans,
|
||||
int back_colour, char **argv, int argc);
|
||||
void create_gc(void);
|
||||
void set_transparent_background(Window win);
|
||||
long get_x11_color(const char *);
|
||||
|
||||
#endif /*X11_H_*/
|
@ -25,9 +25,6 @@
|
||||
* $Id$ */
|
||||
|
||||
#include "conky.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <xmmsclient/xmmsclient.h>
|
||||
|
||||
#define CONN_INIT 0
|
||||
|
27
src/xmms2.h
Normal file
27
src/xmms2.h
Normal file
@ -0,0 +1,27 @@
|
||||
#ifndef XMMS2_H_
|
||||
#define XMMS2_H_
|
||||
|
||||
struct xmms2_s {
|
||||
char *artist;
|
||||
char *album;
|
||||
char *title;
|
||||
char *genre;
|
||||
char *comment;
|
||||
char *url;
|
||||
char *date;
|
||||
char* playlist;
|
||||
int tracknr;
|
||||
int bitrate;
|
||||
unsigned int id;
|
||||
int duration;
|
||||
int elapsed;
|
||||
int timesplayed;
|
||||
float size;
|
||||
|
||||
float progress;
|
||||
char *status;
|
||||
};
|
||||
|
||||
void update_xmms2(void);
|
||||
|
||||
#endif /*XMMS2_H_*/
|
Loading…
Reference in New Issue
Block a user