mirror of
https://github.com/Llewellynvdm/conky.git
synced 2025-02-15 02:11:38 +00:00
Merge branch 'master' of git://nwl.cc/~n0-1/conky
This commit is contained in:
commit
2b128b7a7c
@ -1,3 +1,6 @@
|
||||
2008-12-15
|
||||
* Have a maximum width for all variable length mpd vars
|
||||
|
||||
2008-12-14
|
||||
* Fix disk_protect for linux-2.6.27 (and hopefully above)
|
||||
* Improve behaviour of $pb_battery
|
||||
|
@ -249,7 +249,7 @@ dnl EVE Skill Monitor
|
||||
dnl
|
||||
|
||||
AC_ARG_ENABLE([eve],
|
||||
EC_HELP_STRING([--enable-eve], [Eve-Online skill monitor @<:@default=no@:>@]),
|
||||
AC_HELP_STRING([--enable-eve], [Eve-Online skill monitor @<:@default=no@:>@]),
|
||||
[want_eve="$enableval"], [want_eve=no])
|
||||
|
||||
AM_CONDITIONAL(BUILD_EVE, test x$want_eve = xyes)
|
||||
@ -552,6 +552,9 @@ dnl
|
||||
|
||||
AC_DEFINE(DEFAULTNETDEV, "eth0", [Default networkdevice])
|
||||
AC_DEFINE(CONFIG_FILE, "$HOME/.conkyrc", [Configfile of the user])
|
||||
AC_DEFINE(MAX_SPECIALS_DEFAULT, 512, [Default maximum number of special things, e.g. fonts, offsets, aligns, etc.])
|
||||
AC_DEFINE(MAX_USER_TEXT_DEFAULT, 16384, [Default maximum size of config TEXT buffer, i.e. below TEXT line.])
|
||||
AC_DEFINE(DEFAULT_TEXT_BUFFER_SIZE, 256, [Default size used for temporary, static text buffers])
|
||||
|
||||
dnl
|
||||
dnl Some functions
|
||||
@ -656,7 +659,7 @@ AC_ARG_ENABLE([debug],
|
||||
|
||||
if test "x$want_debug" = "xyes" -a $ac_cv_c_compiler_gnu != no; then
|
||||
CFLAGS="$CFLAGS -g3"
|
||||
AC_DEFINE([DEBUG], [], [Define for debugging])
|
||||
AC_DEFINE([DEBUG], 1, [Define for debugging])
|
||||
fi
|
||||
|
||||
dnl
|
||||
|
@ -123,6 +123,7 @@ conky_SOURCES = \
|
||||
fs.c \
|
||||
$(hddtemp) \
|
||||
$(linux) \
|
||||
logging.h \
|
||||
$(nvidia) \
|
||||
mail.c \
|
||||
mixer.c \
|
||||
@ -142,7 +143,9 @@ conky_SOURCES = \
|
||||
$(xmms2) \
|
||||
$(smapi) \
|
||||
temphelper.c \
|
||||
temphelper.h
|
||||
temphelper.h \
|
||||
text_object.h \
|
||||
text_object.c
|
||||
|
||||
conky_LDFLAGS = \
|
||||
$(PTHREAD_LIBS) \
|
||||
|
@ -17,9 +17,10 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
|
||||
* USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#include "config.h"
|
||||
#include "conky.h"
|
||||
#include "logging.h"
|
||||
#include "audacious.h"
|
||||
|
||||
#include <glib.h>
|
||||
#ifndef AUDACIOUS_LEGACY
|
||||
@ -50,9 +51,6 @@
|
||||
xmms_remote_get_playlist_length(x)
|
||||
#endif
|
||||
|
||||
#include "conky.h"
|
||||
#include "audacious.h"
|
||||
|
||||
/* access to this item array is synchronized */
|
||||
static audacious_t audacious_items;
|
||||
|
||||
|
@ -24,11 +24,13 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "conky.h"
|
||||
#include "logging.h"
|
||||
|
||||
#include <bmp/dbus.hh>
|
||||
#include <dbus/dbus-glib.h>
|
||||
|
||||
#include "conky.h"
|
||||
|
||||
#define DBUS_TYPE_G_STRING_VALUE_HASHTABLE \
|
||||
(dbus_g_type_get_map("GHashTable", G_TYPE_STRING, G_TYPE_VALUE))
|
||||
|
||||
|
18
src/common.c
18
src/common.c
@ -25,12 +25,27 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "conky.h"
|
||||
#include "fs.h"
|
||||
#include "logging.h"
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <sys/time.h>
|
||||
#include <pthread.h>
|
||||
|
||||
/* check for OS and include appropriate headers */
|
||||
#if defined(__linux__)
|
||||
#include "linux.h"
|
||||
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
#include "freebsd.h"
|
||||
#elif defined(__OpenBSD__)
|
||||
#include "openbsd.h"
|
||||
#endif
|
||||
|
||||
/* OS specific prototypes to be implemented by linux.c & Co. */
|
||||
void update_entropy(void);
|
||||
|
||||
#ifndef HAVE_STRNDUP
|
||||
// use our own strndup() if it's not available
|
||||
char *strndup(const char *s, size_t n)
|
||||
@ -183,7 +198,7 @@ void free_dns_data(void)
|
||||
|
||||
//static double last_dns_update;
|
||||
|
||||
void update_dns_data(void)
|
||||
static void update_dns_data(void)
|
||||
{
|
||||
FILE *fp;
|
||||
char line[256];
|
||||
@ -258,6 +273,7 @@ static double last_meminfo_update;
|
||||
static double last_fs_update;
|
||||
|
||||
unsigned long long need_mask;
|
||||
int no_buffers;
|
||||
|
||||
#define NEED(a) ((need_mask & (1 << a)) && ((info.mask & (1 << a)) == 0))
|
||||
|
||||
|
53
src/common.h
53
src/common.h
@ -1,5 +1,8 @@
|
||||
#ifndef COMMON_H_
|
||||
#define COMMON_H_
|
||||
#ifndef _COMMON_H
|
||||
#define _COMMON_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
int check_mount(char *s);
|
||||
void update_diskio(void);
|
||||
@ -9,8 +12,10 @@ void update_meminfo(void);
|
||||
void update_net_stats(void);
|
||||
void update_cpu_usage(void);
|
||||
void update_total_processes(void);
|
||||
void update_uname(void);
|
||||
void update_running_processes(void);
|
||||
void update_i8k(void);
|
||||
void update_stuff(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 */
|
||||
@ -19,6 +24,48 @@ void update_top(void);
|
||||
void free_all_processes(void);
|
||||
struct process *get_first_process(void);
|
||||
void get_cpu_count(void);
|
||||
double get_time(void);
|
||||
|
||||
FILE *open_file(const char *, int *);
|
||||
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);
|
||||
|
||||
#ifdef X11
|
||||
void update_x11info(void);
|
||||
#endif
|
||||
|
||||
int round_to_int(float);
|
||||
|
||||
extern unsigned long long need_mask;
|
||||
extern int no_buffers;
|
||||
|
||||
struct dns_data {
|
||||
int nscount;
|
||||
char **ns_list;
|
||||
};
|
||||
void free_dns_data(void);
|
||||
|
||||
struct net_stat {
|
||||
const char *dev;
|
||||
int up;
|
||||
long long last_read_recv, last_read_trans;
|
||||
long long recv, trans;
|
||||
double recv_speed, trans_speed;
|
||||
struct sockaddr addr;
|
||||
char* addrs;
|
||||
double net_rec[15], net_trans[15];
|
||||
// wireless extensions
|
||||
char essid[32];
|
||||
char bitrate[16];
|
||||
char mode[16];
|
||||
int link_qual;
|
||||
int link_qual_max;
|
||||
char ap[18];
|
||||
};
|
||||
void clear_net_stats(void);
|
||||
struct net_stat *get_net_stat(const char *);
|
||||
|
||||
int open_sysfs_sensor(const char *dir, const char *dev, const char *type, int n,
|
||||
int *divisor, char *devtype);
|
||||
@ -44,4 +91,4 @@ 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_*/
|
||||
#endif /* _COMMON_H */
|
||||
|
1016
src/conky.c
1016
src/conky.c
File diff suppressed because it is too large
Load Diff
285
src/conky.h
285
src/conky.h
@ -28,6 +28,10 @@
|
||||
#ifndef _conky_h_
|
||||
#define _conky_h_
|
||||
|
||||
#include "config.h" /* defines */
|
||||
#include "common.h" /* at least for struct dns_data */
|
||||
#include <sys/utsname.h> /* struct uname_s */
|
||||
|
||||
#if defined(HAS_MCHECK_H)
|
||||
#include <mcheck.h>
|
||||
#endif /* HAS_MCHECK_H */
|
||||
@ -39,161 +43,20 @@
|
||||
#define FALSE 0
|
||||
#define TRUE 1
|
||||
|
||||
#include "config.h"
|
||||
#include <sys/utsname.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <locale.h>
|
||||
#include <langinfo.h>
|
||||
#include <wchar.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
#if !defined(__GNUC__)
|
||||
# define __attribute__(x) /* nothing */
|
||||
#endif
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
#include "freebsd.h"
|
||||
#endif /* __FreeBSD__ || __FreeBSD_kernel__ */
|
||||
|
||||
#if defined(__OpenBSD__)
|
||||
#include "openbsd.h"
|
||||
#endif /* __OpenBSD__ */
|
||||
|
||||
#ifndef HAVE_STRNDUP
|
||||
// use our own strndup() if it's not available
|
||||
char *strndup(const char *s, size_t n);
|
||||
#endif /* HAVE_STRNDUP */
|
||||
|
||||
#ifdef AUDACIOUS
|
||||
#include "audacious.h"
|
||||
#endif
|
||||
|
||||
#ifdef XMMS2
|
||||
#include <xmmsclient/xmmsclient.h>
|
||||
#endif
|
||||
|
||||
#ifdef RSS
|
||||
#include "rss.h"
|
||||
#endif
|
||||
|
||||
#ifdef EVE
|
||||
#include "eve.h"
|
||||
#endif
|
||||
|
||||
#ifdef SMAPI
|
||||
#include "smapi.h"
|
||||
#endif
|
||||
|
||||
#ifdef NVIDIA
|
||||
#include "nvidia.h"
|
||||
#endif
|
||||
|
||||
#include "mboxscan.h"
|
||||
#include "timed_thread.h"
|
||||
#include "top.h"
|
||||
|
||||
#define DEFAULT_TEXT_BUFFER_SIZE 256
|
||||
extern unsigned int text_buffer_size;
|
||||
|
||||
/* maximum number of special things, e.g. fonts, offsets, aligns, etc. */
|
||||
#define MAX_SPECIALS_DEFAULT 512
|
||||
|
||||
/* maximum size of config TEXT buffer, i.e. below TEXT line. */
|
||||
#define MAX_USER_TEXT_DEFAULT 16384
|
||||
|
||||
#include <sys/socket.h>
|
||||
|
||||
#define ERR(...) { \
|
||||
fprintf(stderr, PACKAGE_NAME": "); \
|
||||
fprintf(stderr, __VA_ARGS__); \
|
||||
fprintf(stderr, "\n"); \
|
||||
}
|
||||
|
||||
/* critical error */
|
||||
#define CRIT_ERR(...) \
|
||||
{ ERR(__VA_ARGS__); exit(EXIT_FAILURE); }
|
||||
|
||||
/* debugging output */
|
||||
extern int global_debug_level;
|
||||
#define __DBGP(level, ...) \
|
||||
if (global_debug_level > level) { \
|
||||
fprintf(stderr, "DEBUG(%d) [" __FILE__ ":%d]: ", level, __LINE__); \
|
||||
fprintf(stderr, __VA_ARGS__); \
|
||||
fprintf(stderr, "\n"); \
|
||||
}
|
||||
#define DBGP(...) __DBGP(0, __VA_ARGS__)
|
||||
#define DBGP2(...) __DBGP(1, __VA_ARGS__)
|
||||
|
||||
struct net_stat {
|
||||
const char *dev;
|
||||
int up;
|
||||
long long last_read_recv, last_read_trans;
|
||||
long long recv, trans;
|
||||
double recv_speed, trans_speed;
|
||||
struct sockaddr addr;
|
||||
char* addrs;
|
||||
double net_rec[15], net_trans[15];
|
||||
// wireless extensions
|
||||
char essid[32];
|
||||
char bitrate[16];
|
||||
char mode[16];
|
||||
int link_qual;
|
||||
int link_qual_max;
|
||||
char ap[18];
|
||||
};
|
||||
|
||||
struct dns_data {
|
||||
int nscount;
|
||||
char **ns_list;
|
||||
};
|
||||
|
||||
struct fs_stat {
|
||||
char path[DEFAULT_TEXT_BUFFER_SIZE];
|
||||
char type[DEFAULT_TEXT_BUFFER_SIZE];
|
||||
long long size;
|
||||
long long avail;
|
||||
long long free;
|
||||
char set;
|
||||
};
|
||||
|
||||
#include "diskio.h"
|
||||
|
||||
struct mail_s { // for imap and pop3
|
||||
unsigned long unseen;
|
||||
unsigned long messages;
|
||||
unsigned long used;
|
||||
unsigned long quota;
|
||||
unsigned long port;
|
||||
unsigned int retries;
|
||||
float interval;
|
||||
double last_update;
|
||||
char host[128];
|
||||
char user[128];
|
||||
char pass[128];
|
||||
char command[1024];
|
||||
char folder[128];
|
||||
timed_thread *p_timed_thread;
|
||||
char secure;
|
||||
};
|
||||
|
||||
/* struct cpu_stat {
|
||||
unsigned int user, nice, system, idle, iowait, irq, softirq;
|
||||
int cpu_avg_samples;
|
||||
}; */
|
||||
|
||||
#ifdef MPD
|
||||
#include "mpd.h"
|
||||
#endif
|
||||
|
||||
#ifdef MOC
|
||||
#include "moc.h"
|
||||
#endif
|
||||
|
||||
#ifdef XMMS2
|
||||
#include "xmms2.h"
|
||||
#endif
|
||||
/* headers of optional features
|
||||
* include them here, so we don't need to run the check
|
||||
* in every code file optionally using the feature
|
||||
*/
|
||||
|
||||
#ifdef AUDACIOUS
|
||||
#include "audacious.h"
|
||||
@ -203,7 +66,46 @@ struct mail_s { // for imap and pop3
|
||||
#include "bmpx.h"
|
||||
#endif
|
||||
|
||||
void update_entropy(void);
|
||||
#ifdef EVE
|
||||
#include "eve.h"
|
||||
#endif
|
||||
|
||||
#ifdef HDDTEMP
|
||||
#include "hddtemp.h"
|
||||
#endif /* HDDTEMP */
|
||||
|
||||
#ifdef MOC
|
||||
#include "moc.h"
|
||||
#endif
|
||||
|
||||
#ifdef MPD
|
||||
#include "mpd.h"
|
||||
#endif
|
||||
|
||||
#ifdef NVIDIA
|
||||
#include "nvidia.h"
|
||||
#endif
|
||||
|
||||
#ifdef RSS
|
||||
#include "rss.h"
|
||||
#endif
|
||||
|
||||
#ifdef SMAPI
|
||||
#include "smapi.h"
|
||||
#endif
|
||||
|
||||
#ifdef TCP_PORT_MONITOR
|
||||
#include "tcp-portmon.h"
|
||||
#endif
|
||||
|
||||
#ifdef XMMS2
|
||||
#include "xmms2.h"
|
||||
#endif
|
||||
|
||||
/* A size for temporary, static buffers to use when
|
||||
* one doesn't know what to choose. Defaults to 256. */
|
||||
extern unsigned int text_buffer_size;
|
||||
|
||||
struct entropy_s {
|
||||
unsigned int entropy_avail;
|
||||
unsigned int poolsize;
|
||||
@ -233,10 +135,6 @@ struct x11_info {
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef TCP_PORT_MONITOR
|
||||
#include "tcp-portmon.h"
|
||||
#endif
|
||||
|
||||
enum {
|
||||
INFO_CPU = 0,
|
||||
INFO_MAIL = 1,
|
||||
@ -292,24 +190,21 @@ enum {
|
||||
#endif
|
||||
};
|
||||
|
||||
/* get_battery_stuff() item selector */
|
||||
/* get_battery_stuff() item selector
|
||||
* needed by conky.c, linux.c and freebsd.c */
|
||||
enum {
|
||||
BATTERY_STATUS,
|
||||
BATTERY_TIME
|
||||
};
|
||||
|
||||
/* if_up strictness selector */
|
||||
/* if_up strictness selector
|
||||
* needed by conky.c and linux.c (and potentially others) */
|
||||
enum {
|
||||
IFUP_UP,
|
||||
IFUP_LINK,
|
||||
IFUP_ADDR
|
||||
} ifup_strictness;
|
||||
|
||||
/* Update interval */
|
||||
double update_interval;
|
||||
|
||||
volatile int g_signal_pending;
|
||||
|
||||
struct information {
|
||||
unsigned int mask;
|
||||
|
||||
@ -377,6 +272,7 @@ struct information {
|
||||
unsigned int diskio_write_value;
|
||||
};
|
||||
|
||||
/* needed by linux.c and top.c -> outsource somewhere */
|
||||
enum {
|
||||
/* set to true if kernel uses "long" format for /proc/stats */
|
||||
KFLAG_IS_LONGSTAT = 0x01,
|
||||
@ -386,84 +282,27 @@ enum {
|
||||
/* bits 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 available for future use */
|
||||
/* KFLAG_NEXT_ONE = 0x04 */
|
||||
};
|
||||
|
||||
#define KFLAG_SETON(a) info.kflags |= a
|
||||
#define KFLAG_SETOFF(a) info.kflags &= (~a)
|
||||
#define KFLAG_FLIP(a) info.kflags ^= a
|
||||
#define KFLAG_ISSET(a) info.kflags & a
|
||||
|
||||
#define TO_X 1
|
||||
#define TO_STDOUT 2
|
||||
int output_methods;
|
||||
|
||||
int top_cpu;
|
||||
int top_mem;
|
||||
|
||||
int use_spacer;
|
||||
/* defined in conky.c, needed by top.c */
|
||||
extern int top_cpu, top_mem;
|
||||
|
||||
enum spacer_opts { NO_SPACER = 0, LEFT_SPACER, RIGHT_SPACER };
|
||||
|
||||
char *tmpstring1;
|
||||
char *tmpstring2;
|
||||
/* defined in conky.c, needed by top.c */
|
||||
extern int cpu_separate;
|
||||
|
||||
#ifdef X11
|
||||
#include "x11.h"
|
||||
#endif /* X11 */
|
||||
/* struct that has all info to be shared between
|
||||
* instances of the same text object */
|
||||
extern struct information info;
|
||||
|
||||
int cpu_separate;
|
||||
int short_units;
|
||||
|
||||
/* struct that has all info */
|
||||
struct information info;
|
||||
|
||||
void signal_handler(int);
|
||||
void reload_config(void);
|
||||
void clean_up(void);
|
||||
|
||||
void update_uname(void);
|
||||
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 clear_net_stats(void);
|
||||
void free_dns_data(void);
|
||||
void update_dns_data(void);
|
||||
/* defined in users.c */
|
||||
void update_users(void);
|
||||
|
||||
#ifdef X11
|
||||
void update_x11info(void);
|
||||
#endif
|
||||
|
||||
void update_stuff(void);
|
||||
|
||||
int round_to_int(float f);
|
||||
|
||||
extern unsigned long long need_mask;
|
||||
|
||||
/* defined in conky.c */
|
||||
extern double current_update_time, last_update_time;
|
||||
|
||||
extern int no_buffers;
|
||||
|
||||
#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__))
|
||||
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
|
||||
|
||||
#ifdef HDDTEMP
|
||||
#include "hddtemp.h"
|
||||
#endif /* HDDTEMP */
|
||||
|
||||
#endif
|
||||
|
@ -26,7 +26,12 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "conky.h"
|
||||
#include "config.h"
|
||||
#include "conky.h" /* text_buffer_size */
|
||||
#include "logging.h"
|
||||
#include "diskio.h"
|
||||
#include "common.h"
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
/* The following ifdefs were adapted from gkrellm */
|
||||
#include <linux/major.h>
|
||||
|
2
src/fs.c
2
src/fs.c
@ -26,6 +26,8 @@
|
||||
*/
|
||||
|
||||
#include "conky.h"
|
||||
#include "logging.h"
|
||||
#include "fs.h"
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
|
18
src/fs.h
18
src/fs.h
@ -1,8 +1,20 @@
|
||||
#ifndef FS_H_
|
||||
#define FS_H_
|
||||
#ifndef _FS_H
|
||||
#define _FS_H
|
||||
|
||||
#include "conky.h" /* DEFAULT_TEXT_BUFFER_SIZE */
|
||||
|
||||
/* needed here and by fs.c */
|
||||
struct fs_stat {
|
||||
char path[DEFAULT_TEXT_BUFFER_SIZE];
|
||||
char type[DEFAULT_TEXT_BUFFER_SIZE];
|
||||
long long size;
|
||||
long long avail;
|
||||
long long free;
|
||||
char set;
|
||||
};
|
||||
|
||||
void update_fs_stats(void);
|
||||
struct fs_stat *prepare_fs_stat(const char *path);
|
||||
void clear_fs_stats(void);
|
||||
|
||||
#endif /*FS_H_*/
|
||||
#endif /* _FS_H */
|
||||
|
@ -26,6 +26,7 @@
|
||||
*/
|
||||
|
||||
#include "conky.h"
|
||||
#include "logging.h"
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
@ -27,6 +27,9 @@
|
||||
*/
|
||||
|
||||
#include "conky.h"
|
||||
#include "logging.h"
|
||||
#include "common.h"
|
||||
#include "linux.h"
|
||||
#include <dirent.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
|
@ -1,5 +1,5 @@
|
||||
#ifndef LINUX_H_
|
||||
#define LINUX_H_
|
||||
#ifndef _LINUX_H
|
||||
#define _LINUX_H
|
||||
|
||||
#include "common.h"
|
||||
|
||||
@ -38,4 +38,4 @@ 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_*/
|
||||
#endif /* _LINUX_H */
|
||||
|
51
src/logging.h
Normal file
51
src/logging.h
Normal file
@ -0,0 +1,51 @@
|
||||
/* Conky, a system monitor, based on torsmo
|
||||
*
|
||||
* Any original torsmo code is licensed under the BSD license
|
||||
*
|
||||
* All code written since the fork of torsmo is licensed under the GPL
|
||||
*
|
||||
* Please see COPYING for details
|
||||
*
|
||||
* Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
|
||||
* Copyright (c) 2005-2008 Brenden Matthews, Philip Kovacs, et. al.
|
||||
* (see AUTHORS)
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#ifndef _LOGGING_H
|
||||
#define _LOGGING_H
|
||||
|
||||
#define ERR(...) { \
|
||||
fprintf(stderr, PACKAGE_NAME": "); \
|
||||
fprintf(stderr, __VA_ARGS__); \
|
||||
fprintf(stderr, "\n"); \
|
||||
}
|
||||
|
||||
/* critical error */
|
||||
#define CRIT_ERR(...) \
|
||||
{ ERR(__VA_ARGS__); exit(EXIT_FAILURE); }
|
||||
|
||||
/* debugging output */
|
||||
extern int global_debug_level;
|
||||
#define __DBGP(level, ...) \
|
||||
if (global_debug_level > level) { \
|
||||
fprintf(stderr, "DEBUG(%d) [" __FILE__ ":%d]: ", level, __LINE__); \
|
||||
fprintf(stderr, __VA_ARGS__); \
|
||||
fprintf(stderr, "\n"); \
|
||||
}
|
||||
#define DBGP(...) __DBGP(0, __VA_ARGS__)
|
||||
#define DBGP2(...) __DBGP(1, __VA_ARGS__)
|
||||
|
||||
#endif /* _LOGGING_H */
|
17
src/mail.c
17
src/mail.c
@ -25,8 +25,18 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "conky.h"
|
||||
#include "common.h"
|
||||
#include "logging.h"
|
||||
#include "mail.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <netdb.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
@ -34,6 +44,13 @@
|
||||
#include <errno.h>
|
||||
#include <termios.h>
|
||||
|
||||
/* MAX() is defined by a header included from conky.h
|
||||
* maybe once this is not true anymore, so have an alternative
|
||||
* waiting to drop in.
|
||||
*
|
||||
* #define MAX(a, b) ((a > b) ? a : b)
|
||||
*/
|
||||
|
||||
char *current_mail_spool;
|
||||
|
||||
void update_mail_count(struct local_mail_s *mail)
|
||||
|
26
src/mail.h
26
src/mail.h
@ -1,8 +1,28 @@
|
||||
#ifndef _MAIL_H_
|
||||
#define _MAIL_H_
|
||||
#ifndef _MAIL_H
|
||||
#define _MAIL_H
|
||||
|
||||
#include "timed_thread.h"
|
||||
|
||||
extern char *current_mail_spool;
|
||||
|
||||
struct mail_s { // for imap and pop3
|
||||
unsigned long unseen;
|
||||
unsigned long messages;
|
||||
unsigned long used;
|
||||
unsigned long quota;
|
||||
unsigned long port;
|
||||
unsigned int retries;
|
||||
float interval;
|
||||
double last_update;
|
||||
char host[128];
|
||||
char user[128];
|
||||
char pass[128];
|
||||
char command[1024];
|
||||
char folder[128];
|
||||
timed_thread *p_timed_thread;
|
||||
char secure;
|
||||
};
|
||||
|
||||
struct local_mail_s {
|
||||
char *box;
|
||||
int mail_count;
|
||||
@ -21,4 +41,4 @@ struct mail_s *parse_mail_args(char type, const char *arg);
|
||||
void *imap_thread(void *arg);
|
||||
void *pop3_thread(void *arg);
|
||||
|
||||
#endif /* _MAIL_H_ */
|
||||
#endif /* _MAIL_H */
|
||||
|
@ -26,6 +26,8 @@
|
||||
*/
|
||||
|
||||
#include "conky.h"
|
||||
#include "logging.h"
|
||||
#include "mail.h"
|
||||
#include <sys/stat.h>
|
||||
#include <sys/time.h>
|
||||
#include <errno.h>
|
||||
|
@ -26,6 +26,7 @@
|
||||
*/
|
||||
|
||||
#include "conky.h"
|
||||
#include "logging.h"
|
||||
#include <sys/ioctl.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
|
@ -19,6 +19,7 @@
|
||||
*/
|
||||
|
||||
#include "conky.h"
|
||||
#include "logging.h"
|
||||
#include "moc.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -25,6 +25,7 @@
|
||||
*/
|
||||
|
||||
#include "conky.h"
|
||||
#include "logging.h"
|
||||
|
||||
void init_mpd_stats(struct mpd_s *mpd)
|
||||
{
|
||||
|
@ -26,6 +26,7 @@
|
||||
*/
|
||||
|
||||
#include "conky.h"
|
||||
#include "logging.h"
|
||||
#include "prss.h"
|
||||
#include <time.h>
|
||||
#include <assert.h>
|
||||
|
@ -18,8 +18,15 @@
|
||||
* USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
#include "conky.h" /* text_buffer_size, PACKAGE_NAME, maybe more */
|
||||
#include "smapi.h"
|
||||
#include "logging.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#define SYS_SMAPI_PATH "/sys/devices/platform/smapi"
|
||||
|
||||
|
@ -19,11 +19,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SMAPI_H
|
||||
#define SMAPI_H
|
||||
|
||||
#include "conky.h"
|
||||
#include <sys/stat.h>
|
||||
#ifndef _SMAPI_H
|
||||
#define _SMAPI_H
|
||||
|
||||
int smapi_bat_installed(int);
|
||||
|
||||
@ -37,4 +34,4 @@ char *smapi_get_bat_str(int, const char *);
|
||||
int smapi_get_bat_int(int, const char *);
|
||||
char *smapi_get_bat_val(const char *);
|
||||
|
||||
#endif /* SMAPI_H */
|
||||
#endif /* _SMAPI_H */
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
/* doesn't work, feel free to finish this */
|
||||
#include "conky.h"
|
||||
#include "common.h"
|
||||
#include <kstat.h>
|
||||
|
||||
static kstat_ctl_t *kstat;
|
||||
|
@ -18,6 +18,7 @@
|
||||
*
|
||||
*/
|
||||
#include "conky.h"
|
||||
#include "logging.h"
|
||||
#include "tcp-portmon.h"
|
||||
#include "libtcp-portmon.h"
|
||||
|
||||
|
162
src/text_object.c
Normal file
162
src/text_object.c
Normal file
@ -0,0 +1,162 @@
|
||||
/* Conky, a system monitor, based on torsmo
|
||||
*
|
||||
* Any original torsmo code is licensed under the BSD license
|
||||
*
|
||||
* All code written since the fork of torsmo is licensed under the GPL
|
||||
*
|
||||
* Please see COPYING for details
|
||||
*
|
||||
* Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
|
||||
* Copyright (c) 2005-2008 Brenden Matthews, Philip Kovacs, et. al.
|
||||
* (see AUTHORS)
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#include "text_object.h"
|
||||
#include "logging.h"
|
||||
|
||||
/* text_object_list
|
||||
*
|
||||
* this list is special. it looks like this:
|
||||
* NULL <-- obj1 <--> obj2 <--> ... <--> objN --> NULL
|
||||
* ^-------root_object----------^
|
||||
* directions are reversed here
|
||||
*
|
||||
* why this is cool:
|
||||
* - root_object points both to the start and end of the list
|
||||
* - while traversing, the end of the list is always a NULL pointer
|
||||
* (this works in BOTH directions)
|
||||
*/
|
||||
|
||||
/* append an object to the given root object's list */
|
||||
int append_object(struct text_object *root, struct text_object *obj)
|
||||
{
|
||||
struct text_object *end;
|
||||
|
||||
end = root->prev;
|
||||
obj->prev = end;
|
||||
obj->next = NULL;
|
||||
|
||||
if (end) {
|
||||
if (end->next)
|
||||
CRIT_ERR("huston, we have a lift-off");
|
||||
end->next = obj;
|
||||
} else {
|
||||
root->next = obj;
|
||||
}
|
||||
root->prev = obj;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* ifblock handlers for the object list
|
||||
*
|
||||
* - each if points to it's else or endif
|
||||
* - each else points to it's endif
|
||||
*
|
||||
*/
|
||||
|
||||
/* possible ifblock types
|
||||
* only used internally, so no need to make this public
|
||||
*/
|
||||
enum ifblock_type {
|
||||
IFBLOCK_IF = 1,
|
||||
IFBLOCK_ELSE,
|
||||
IFBLOCK_ENDIF,
|
||||
};
|
||||
|
||||
/* linked list of ifblock objects, building a stack
|
||||
* only used internally, so no need to make this public
|
||||
*/
|
||||
struct ifblock_stack_obj {
|
||||
enum ifblock_type type;
|
||||
struct text_object *obj;
|
||||
struct ifblock_stack_obj *next;
|
||||
};
|
||||
|
||||
/* top of the internal ifblock stack
|
||||
* initially contains only one "object", i.e. a NULL pointer
|
||||
* indicating the end of the stack.
|
||||
*/
|
||||
static struct ifblock_stack_obj *ifblock_stack_top = NULL;
|
||||
|
||||
/* push an ifblock object onto the stack
|
||||
* in fact, this does a lot more:
|
||||
* - IFBLOCK_IF is just pushed onto the stack
|
||||
* - IFBLOCK_ELSE updates the "next" pointer of the upmost
|
||||
* object in the stack and is then pushed onto the stack
|
||||
* - IFBLOCK_ENDIF updates the "next" pointer of the upmost
|
||||
* object in the stack and then triggers stack popping of
|
||||
* any optional IFBLOCK_ELSE along with it's IFBLOCK_IF
|
||||
*/
|
||||
static int push_ifblock(struct text_object *obj, enum ifblock_type type)
|
||||
{
|
||||
struct ifblock_stack_obj *stackobj;
|
||||
|
||||
switch (type) {
|
||||
case IFBLOCK_ENDIF:
|
||||
if (!ifblock_stack_top)
|
||||
CRIT_ERR("got an endif without matching if");
|
||||
ifblock_stack_top->obj->data.ifblock.next = obj;
|
||||
/* if there's some else in between, remove and free it */
|
||||
if (ifblock_stack_top->type == IFBLOCK_ELSE) {
|
||||
stackobj = ifblock_stack_top;
|
||||
ifblock_stack_top = stackobj->next;
|
||||
free(stackobj);
|
||||
}
|
||||
/* finally remove and free the if object */
|
||||
stackobj = ifblock_stack_top;
|
||||
ifblock_stack_top = stackobj->next;
|
||||
free(stackobj);
|
||||
break;
|
||||
case IFBLOCK_ELSE:
|
||||
if (!ifblock_stack_top)
|
||||
CRIT_ERR("got an else without matching if");
|
||||
ifblock_stack_top->obj->data.ifblock.next = obj;
|
||||
/* fall through */
|
||||
case IFBLOCK_IF:
|
||||
stackobj = malloc(sizeof(struct ifblock_stack_obj));
|
||||
stackobj->type = type;
|
||||
stackobj->obj = obj;
|
||||
stackobj->next = ifblock_stack_top;
|
||||
ifblock_stack_top = stackobj;
|
||||
break;
|
||||
default:
|
||||
CRIT_ERR("push_ifblock() missuse detected!");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* public functions for client use */
|
||||
|
||||
int obj_be_ifblock_if(struct text_object *obj)
|
||||
{
|
||||
return push_ifblock(obj, IFBLOCK_IF);
|
||||
}
|
||||
int obj_be_ifblock_else(struct text_object *obj)
|
||||
{
|
||||
return push_ifblock(obj, IFBLOCK_ELSE);
|
||||
}
|
||||
int obj_be_ifblock_endif(struct text_object *obj)
|
||||
{
|
||||
return push_ifblock(obj, IFBLOCK_ENDIF);
|
||||
}
|
||||
|
||||
/* check if ifblock stack is empty
|
||||
* if so, return true (!= 0)
|
||||
*/
|
||||
int ifblock_stack_empty(void)
|
||||
{
|
||||
return ifblock_stack_top == NULL;
|
||||
}
|
495
src/text_object.h
Normal file
495
src/text_object.h
Normal file
@ -0,0 +1,495 @@
|
||||
/* Conky, a system monitor, based on torsmo
|
||||
*
|
||||
* Any original torsmo code is licensed under the BSD license
|
||||
*
|
||||
* All code written since the fork of torsmo is licensed under the GPL
|
||||
*
|
||||
* Please see COPYING for details
|
||||
*
|
||||
* Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
|
||||
* Copyright (c) 2005-2008 Brenden Matthews, Philip Kovacs, et. al.
|
||||
* (see AUTHORS)
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#ifndef _TEXT_OBJECT_H
|
||||
#define _TEXT_OBJECT_H
|
||||
|
||||
#include "config.h" /* for the defines */
|
||||
#include "timed_thread.h" /* timed_thread */
|
||||
|
||||
#ifdef TCP_PORT_MONITOR
|
||||
#include "tcp-portmon.h" /* tcp_port_monitor_data */
|
||||
#endif
|
||||
|
||||
#include "mail.h" /* local_mail_s */
|
||||
#include "fs.h" /* struct fs_stat */
|
||||
|
||||
#ifdef NVIDIA
|
||||
#include "nvidia.h" /* nvidia_s */
|
||||
#endif
|
||||
|
||||
enum text_object_type {
|
||||
OBJ_addr,
|
||||
#if defined(__linux__)
|
||||
OBJ_addrs,
|
||||
#endif /* __linux__ */
|
||||
#ifndef __OpenBSD__
|
||||
OBJ_acpiacadapter,
|
||||
OBJ_adt746xcpu,
|
||||
OBJ_adt746xfan,
|
||||
OBJ_acpifan,
|
||||
OBJ_acpitemp,
|
||||
OBJ_battery,
|
||||
OBJ_battery_time,
|
||||
OBJ_battery_percent,
|
||||
OBJ_battery_bar,
|
||||
#endif /* !__OpenBSD__ */
|
||||
OBJ_buffers,
|
||||
OBJ_cached,
|
||||
OBJ_color,
|
||||
OBJ_color0,
|
||||
OBJ_color1,
|
||||
OBJ_color2,
|
||||
OBJ_color3,
|
||||
OBJ_color4,
|
||||
OBJ_color5,
|
||||
OBJ_color6,
|
||||
OBJ_color7,
|
||||
OBJ_color8,
|
||||
OBJ_color9,
|
||||
OBJ_conky_version,
|
||||
OBJ_conky_build_date,
|
||||
OBJ_conky_build_arch,
|
||||
OBJ_font,
|
||||
OBJ_cpu,
|
||||
OBJ_cpubar,
|
||||
OBJ_cpugraph,
|
||||
OBJ_loadgraph,
|
||||
OBJ_diskio,
|
||||
OBJ_diskio_read,
|
||||
OBJ_diskio_write,
|
||||
OBJ_diskiograph,
|
||||
OBJ_diskiograph_read,
|
||||
OBJ_diskiograph_write,
|
||||
OBJ_downspeed,
|
||||
OBJ_downspeedf,
|
||||
OBJ_downspeedgraph,
|
||||
OBJ_else,
|
||||
OBJ_endif,
|
||||
OBJ_image,
|
||||
OBJ_exec,
|
||||
OBJ_execi,
|
||||
OBJ_texeci,
|
||||
OBJ_execbar,
|
||||
OBJ_execgraph,
|
||||
OBJ_execibar,
|
||||
OBJ_execigraph,
|
||||
OBJ_execp,
|
||||
OBJ_execpi,
|
||||
OBJ_freq,
|
||||
OBJ_freq_g,
|
||||
OBJ_fs_bar,
|
||||
OBJ_fs_bar_free,
|
||||
OBJ_fs_free,
|
||||
OBJ_fs_free_perc,
|
||||
OBJ_fs_size,
|
||||
OBJ_fs_type,
|
||||
OBJ_fs_used,
|
||||
OBJ_fs_used_perc,
|
||||
OBJ_goto,
|
||||
OBJ_tab,
|
||||
OBJ_hr,
|
||||
OBJ_offset,
|
||||
OBJ_voffset,
|
||||
OBJ_alignr,
|
||||
OBJ_alignc,
|
||||
OBJ_i2c,
|
||||
OBJ_platform,
|
||||
OBJ_hwmon,
|
||||
#if defined(__linux__)
|
||||
OBJ_disk_protect,
|
||||
OBJ_i8k_version,
|
||||
OBJ_i8k_bios,
|
||||
OBJ_i8k_serial,
|
||||
OBJ_i8k_cpu_temp,
|
||||
OBJ_i8k_left_fan_status,
|
||||
OBJ_i8k_right_fan_status,
|
||||
OBJ_i8k_left_fan_rpm,
|
||||
OBJ_i8k_right_fan_rpm,
|
||||
OBJ_i8k_ac_status,
|
||||
OBJ_i8k_buttons_status,
|
||||
OBJ_ibm_fan,
|
||||
OBJ_ibm_temps,
|
||||
OBJ_ibm_volume,
|
||||
OBJ_ibm_brightness,
|
||||
OBJ_if_up,
|
||||
OBJ_if_gw,
|
||||
OBJ_ioscheduler,
|
||||
OBJ_gw_iface,
|
||||
OBJ_gw_ip,
|
||||
OBJ_laptop_mode,
|
||||
OBJ_pb_battery,
|
||||
OBJ_voltage_mv,
|
||||
OBJ_voltage_v,
|
||||
OBJ_wireless_essid,
|
||||
OBJ_wireless_mode,
|
||||
OBJ_wireless_bitrate,
|
||||
OBJ_wireless_ap,
|
||||
OBJ_wireless_link_qual,
|
||||
OBJ_wireless_link_qual_max,
|
||||
OBJ_wireless_link_qual_perc,
|
||||
OBJ_wireless_link_bar,
|
||||
#endif /* __linux__ */
|
||||
OBJ_if_empty,
|
||||
OBJ_if_existing,
|
||||
OBJ_if_mounted,
|
||||
OBJ_if_running,
|
||||
OBJ_top,
|
||||
OBJ_top_mem,
|
||||
OBJ_tail,
|
||||
OBJ_head,
|
||||
OBJ_lines,
|
||||
OBJ_words,
|
||||
OBJ_kernel,
|
||||
OBJ_loadavg,
|
||||
OBJ_machine,
|
||||
OBJ_mails,
|
||||
OBJ_mboxscan,
|
||||
OBJ_mem,
|
||||
OBJ_memeasyfree,
|
||||
OBJ_memfree,
|
||||
OBJ_membar,
|
||||
OBJ_memgraph,
|
||||
OBJ_memmax,
|
||||
OBJ_memperc,
|
||||
OBJ_mem_res,
|
||||
OBJ_mem_vsize,
|
||||
OBJ_mixer,
|
||||
OBJ_mixerl,
|
||||
OBJ_mixerr,
|
||||
OBJ_mixerbar,
|
||||
OBJ_mixerlbar,
|
||||
OBJ_mixerrbar,
|
||||
#ifdef X11
|
||||
OBJ_monitor,
|
||||
OBJ_monitor_number,
|
||||
#endif
|
||||
OBJ_nameserver,
|
||||
OBJ_new_mails,
|
||||
OBJ_nodename,
|
||||
OBJ_nvidia,
|
||||
OBJ_pre_exec,
|
||||
OBJ_processes,
|
||||
OBJ_running_processes,
|
||||
OBJ_shadecolor,
|
||||
OBJ_outlinecolor,
|
||||
OBJ_stippled_hr,
|
||||
OBJ_swap,
|
||||
OBJ_swapbar,
|
||||
OBJ_swapmax,
|
||||
OBJ_swapperc,
|
||||
OBJ_sysname,
|
||||
OBJ_temp1, /* i2c is used instead in these */
|
||||
OBJ_temp2,
|
||||
OBJ_text,
|
||||
OBJ_time,
|
||||
OBJ_utime,
|
||||
OBJ_tztime,
|
||||
OBJ_totaldown,
|
||||
OBJ_totalup,
|
||||
OBJ_updates,
|
||||
OBJ_upspeed,
|
||||
OBJ_upspeedf,
|
||||
OBJ_upspeedgraph,
|
||||
OBJ_uptime,
|
||||
OBJ_uptime_short,
|
||||
OBJ_user_names,
|
||||
OBJ_user_terms,
|
||||
OBJ_user_times,
|
||||
OBJ_user_number,
|
||||
OBJ_imap,
|
||||
OBJ_imap_messages,
|
||||
OBJ_imap_unseen,
|
||||
OBJ_pop3,
|
||||
OBJ_pop3_unseen,
|
||||
OBJ_pop3_used,
|
||||
#if (defined(__FreeBSD__) || defined(__FreeBSD_kernel__) \
|
||||
|| defined(__OpenBSD__)) && (defined(i386) || defined(__i386__))
|
||||
OBJ_apm_adapter,
|
||||
OBJ_apm_battery_time,
|
||||
OBJ_apm_battery_life,
|
||||
#endif /* __FreeBSD__ __OpenBSD__ */
|
||||
#ifdef __OpenBSD__
|
||||
OBJ_obsd_sensors_temp,
|
||||
OBJ_obsd_sensors_fan,
|
||||
OBJ_obsd_sensors_volt,
|
||||
OBJ_obsd_vendor,
|
||||
OBJ_obsd_product,
|
||||
#endif /* __OpenBSD__ */
|
||||
#ifdef MPD
|
||||
OBJ_mpd_title,
|
||||
OBJ_mpd_artist,
|
||||
OBJ_mpd_album,
|
||||
OBJ_mpd_random,
|
||||
OBJ_mpd_repeat,
|
||||
OBJ_mpd_vol,
|
||||
OBJ_mpd_bitrate,
|
||||
OBJ_mpd_status,
|
||||
OBJ_mpd_host,
|
||||
OBJ_mpd_port,
|
||||
OBJ_mpd_password,
|
||||
OBJ_mpd_bar,
|
||||
OBJ_mpd_elapsed,
|
||||
OBJ_mpd_length,
|
||||
OBJ_mpd_track,
|
||||
OBJ_mpd_name,
|
||||
OBJ_mpd_file,
|
||||
OBJ_mpd_percent,
|
||||
OBJ_mpd_smart,
|
||||
OBJ_if_mpd_playing,
|
||||
#endif
|
||||
#ifdef MOC
|
||||
OBJ_moc_state,
|
||||
OBJ_moc_file,
|
||||
OBJ_moc_title,
|
||||
OBJ_moc_artist,
|
||||
OBJ_moc_song,
|
||||
OBJ_moc_album,
|
||||
OBJ_moc_totaltime,
|
||||
OBJ_moc_timeleft,
|
||||
OBJ_moc_curtime,
|
||||
OBJ_moc_bitrate,
|
||||
OBJ_moc_rate,
|
||||
#endif
|
||||
OBJ_music_player_interval,
|
||||
#ifdef XMMS2
|
||||
OBJ_xmms2_artist,
|
||||
OBJ_xmms2_album,
|
||||
OBJ_xmms2_title,
|
||||
OBJ_xmms2_genre,
|
||||
OBJ_xmms2_comment,
|
||||
OBJ_xmms2_url,
|
||||
OBJ_xmms2_date,
|
||||
OBJ_xmms2_tracknr,
|
||||
OBJ_xmms2_bitrate,
|
||||
OBJ_xmms2_id,
|
||||
OBJ_xmms2_duration,
|
||||
OBJ_xmms2_elapsed,
|
||||
OBJ_xmms2_size,
|
||||
OBJ_xmms2_percent,
|
||||
OBJ_xmms2_status,
|
||||
OBJ_xmms2_bar,
|
||||
OBJ_xmms2_smart,
|
||||
OBJ_xmms2_playlist,
|
||||
OBJ_xmms2_timesplayed,
|
||||
OBJ_if_xmms2_connected,
|
||||
#endif
|
||||
#ifdef AUDACIOUS
|
||||
OBJ_audacious_status,
|
||||
OBJ_audacious_title,
|
||||
OBJ_audacious_length,
|
||||
OBJ_audacious_length_seconds,
|
||||
OBJ_audacious_position,
|
||||
OBJ_audacious_position_seconds,
|
||||
OBJ_audacious_bitrate,
|
||||
OBJ_audacious_frequency,
|
||||
OBJ_audacious_channels,
|
||||
OBJ_audacious_filename,
|
||||
OBJ_audacious_playlist_length,
|
||||
OBJ_audacious_playlist_position,
|
||||
OBJ_audacious_main_volume,
|
||||
OBJ_audacious_bar,
|
||||
#endif
|
||||
#ifdef BMPX
|
||||
OBJ_bmpx_title,
|
||||
OBJ_bmpx_artist,
|
||||
OBJ_bmpx_album,
|
||||
OBJ_bmpx_track,
|
||||
OBJ_bmpx_uri,
|
||||
OBJ_bmpx_bitrate,
|
||||
#endif
|
||||
#ifdef EVE
|
||||
OBJ_eve,
|
||||
#endif
|
||||
#ifdef RSS
|
||||
OBJ_rss,
|
||||
#endif
|
||||
#ifdef TCP_PORT_MONITOR
|
||||
OBJ_tcp_portmon,
|
||||
#endif
|
||||
#ifdef HAVE_ICONV
|
||||
OBJ_iconv_start,
|
||||
OBJ_iconv_stop,
|
||||
#endif
|
||||
#ifdef HDDTEMP
|
||||
OBJ_hddtemp,
|
||||
#endif
|
||||
#ifdef SMAPI
|
||||
OBJ_smapi,
|
||||
OBJ_smapi_bat_bar,
|
||||
OBJ_smapi_bat_perc,
|
||||
OBJ_smapi_bat_temp,
|
||||
OBJ_smapi_bat_power,
|
||||
OBJ_if_smapi_bat_installed,
|
||||
#endif
|
||||
OBJ_scroll,
|
||||
OBJ_entropy_avail,
|
||||
OBJ_entropy_poolsize,
|
||||
OBJ_entropy_bar
|
||||
};
|
||||
|
||||
struct text_object {
|
||||
struct text_object *next, *prev; /* doubly linked list of text objects */
|
||||
union {
|
||||
char *s; /* some string */
|
||||
int i; /* some integer */
|
||||
long l; /* some other integer */
|
||||
unsigned int sensor;
|
||||
struct net_stat *net;
|
||||
struct fs_stat *fs;
|
||||
struct diskio_stat *diskio;
|
||||
unsigned char loadavg[3];
|
||||
unsigned int cpu_index;
|
||||
struct mail_s *mail;
|
||||
|
||||
struct {
|
||||
char *args;
|
||||
char *output;
|
||||
} mboxscan;
|
||||
|
||||
struct {
|
||||
char *tz; /* timezone variable */
|
||||
char *fmt; /* time display formatting */
|
||||
} tztime;
|
||||
|
||||
struct {
|
||||
struct fs_stat *fs;
|
||||
int w, h;
|
||||
} fsbar; /* 3 */
|
||||
|
||||
struct {
|
||||
int l;
|
||||
int w, h;
|
||||
} mixerbar; /* 3 */
|
||||
|
||||
struct {
|
||||
int fd;
|
||||
int arg;
|
||||
char devtype[256];
|
||||
char type[64];
|
||||
} sysfs; /* 2 */
|
||||
|
||||
struct {
|
||||
struct text_object *next;
|
||||
char *s;
|
||||
char *str;
|
||||
} ifblock;
|
||||
|
||||
struct {
|
||||
int num;
|
||||
int type;
|
||||
} top;
|
||||
|
||||
struct {
|
||||
int wantedlines;
|
||||
int readlines;
|
||||
char *logfile;
|
||||
double last_update;
|
||||
float interval;
|
||||
char *buffer;
|
||||
/* If not -1, a file descriptor to read from when
|
||||
* logfile is a FIFO. */
|
||||
int fd;
|
||||
} tail;
|
||||
|
||||
struct {
|
||||
double last_update;
|
||||
float interval;
|
||||
char *cmd;
|
||||
char *buffer;
|
||||
double data;
|
||||
} execi; /* 5 */
|
||||
|
||||
struct {
|
||||
float interval;
|
||||
char *cmd;
|
||||
char *buffer;
|
||||
double data;
|
||||
timed_thread *p_timed_thread;
|
||||
} texeci;
|
||||
|
||||
struct {
|
||||
int a, b;
|
||||
} pair; /* 2 */
|
||||
#ifdef TCP_PORT_MONITOR
|
||||
struct tcp_port_monitor_data tcp_port_monitor;
|
||||
#endif
|
||||
#ifdef HDDTEMP
|
||||
struct {
|
||||
char *addr;
|
||||
int port;
|
||||
char *dev;
|
||||
double update_time;
|
||||
char *temp;
|
||||
} hddtemp; /* 2 */
|
||||
#endif
|
||||
#ifdef EVE
|
||||
struct {
|
||||
char *apikey;
|
||||
char *charid;
|
||||
char *userid;
|
||||
} eve;
|
||||
#endif
|
||||
#ifdef RSS
|
||||
struct {
|
||||
char *uri;
|
||||
char *action;
|
||||
int act_par;
|
||||
int delay;
|
||||
} rss;
|
||||
#endif
|
||||
struct {
|
||||
char *text;
|
||||
unsigned int show;
|
||||
unsigned int step;
|
||||
unsigned int start;
|
||||
} scroll;
|
||||
|
||||
struct local_mail_s local_mail;
|
||||
#ifdef NVIDIA
|
||||
struct nvidia_s nvidia;
|
||||
#endif /* NVIDIA */
|
||||
|
||||
} data;
|
||||
int type;
|
||||
int a, b;
|
||||
long line;
|
||||
unsigned int c, d, e;
|
||||
float f;
|
||||
char showaslog;
|
||||
char global_mode;
|
||||
};
|
||||
|
||||
/* text object list helpers */
|
||||
int append_object(struct text_object *root, struct text_object *obj);
|
||||
|
||||
/* ifblock helpers */
|
||||
int obj_be_ifblock_if(struct text_object *);
|
||||
int obj_be_ifblock_else(struct text_object *);
|
||||
int obj_be_ifblock_endif(struct text_object *);
|
||||
int ifblock_stack_empty(void);
|
||||
|
||||
#endif /* _TEXT_OBJECT_H */
|
12
src/x11.c
12
src/x11.c
@ -25,25 +25,26 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "conky.h"
|
||||
#include "logging.h"
|
||||
#include "common.h"
|
||||
|
||||
#ifdef X11
|
||||
#include "x11.h"
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xatom.h>
|
||||
#include <X11/Xmd.h>
|
||||
#include <X11/Xutil.h>
|
||||
|
||||
#ifdef XFT
|
||||
#include <X11/Xft/Xft.h>
|
||||
int use_xft = 0;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_XDBE
|
||||
int use_xdbe;
|
||||
#endif
|
||||
|
||||
#ifdef XFT
|
||||
int use_xft = 0;
|
||||
#endif
|
||||
|
||||
/* some basic X11 stuff */
|
||||
Display *display;
|
||||
int display_width;
|
||||
@ -560,4 +561,3 @@ void update_x11info(void)
|
||||
current_info->x11.monitor.number = XScreenCount(display);
|
||||
current_info->x11.monitor.current = XDefaultScreen(display);
|
||||
}
|
||||
#endif /* X11 */
|
||||
|
Loading…
x
Reference in New Issue
Block a user