2009-07-28 21:44:22 +00:00
|
|
|
/* -*- mode: c; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
|
|
|
|
*
|
|
|
|
* Conky, a system monitor, based on torsmo
|
2005-08-05 01:06:17 +00:00
|
|
|
*
|
2007-08-10 19:53:44 +00:00
|
|
|
* 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
|
2009-03-30 04:55:30 +00:00
|
|
|
* Copyright (c) 2005-2009 Brenden Matthews, Philip Kovacs, et. al.
|
2008-02-20 20:30:45 +00:00
|
|
|
* (see AUTHORS)
|
2007-08-10 19:53:44 +00:00
|
|
|
* 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
|
2008-02-20 20:30:45 +00:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2005-08-05 01:06:17 +00:00
|
|
|
*
|
2009-07-27 20:47:19 +00:00
|
|
|
* vim: ts=4 sw=4 noet ai cindent syntax=c
|
|
|
|
*
|
2008-03-18 00:23:16 +00:00
|
|
|
*/
|
2005-08-05 01:06:17 +00:00
|
|
|
|
2005-07-20 00:30:40 +00:00
|
|
|
#ifndef _conky_h_
|
|
|
|
#define _conky_h_
|
|
|
|
|
2008-12-15 21:40:24 +00:00
|
|
|
#include "config.h" /* defines */
|
|
|
|
|
2005-08-23 06:10:25 +00:00
|
|
|
#if defined(HAS_MCHECK_H)
|
2005-08-12 04:34:06 +00:00
|
|
|
#include <mcheck.h>
|
2005-08-23 06:10:25 +00:00
|
|
|
#endif /* HAS_MCHECK_H */
|
2008-02-20 20:30:45 +00:00
|
|
|
|
2008-06-25 21:06:54 +00:00
|
|
|
#undef EQUAL
|
|
|
|
#undef FALSE
|
|
|
|
#undef TRUE
|
2008-06-21 20:37:58 +00:00
|
|
|
#define EQUAL 0 //returnvalue of strcmp-variants when strings are equal
|
2008-06-25 21:06:54 +00:00
|
|
|
#define FALSE 0
|
|
|
|
#define TRUE 1
|
2008-06-21 20:37:58 +00:00
|
|
|
|
2009-05-17 11:38:51 +00:00
|
|
|
#define DEFAULT_BAR_WIDTH_NO_X 10
|
2008-02-20 20:30:45 +00:00
|
|
|
|
2008-03-29 11:35:02 +00:00
|
|
|
#if !defined(__GNUC__)
|
|
|
|
# define __attribute__(x) /* nothing */
|
|
|
|
#endif
|
|
|
|
|
2008-04-02 19:46:09 +00:00
|
|
|
#ifndef HAVE_STRNDUP
|
|
|
|
// use our own strndup() if it's not available
|
|
|
|
char *strndup(const char *s, size_t n);
|
|
|
|
#endif /* HAVE_STRNDUP */
|
|
|
|
|
2008-12-15 21:40:24 +00:00
|
|
|
/* headers of optional features
|
|
|
|
* include them here, so we don't need to run the check
|
|
|
|
* in every code file optionally using the feature
|
|
|
|
*/
|
|
|
|
|
2006-11-03 20:54:52 +00:00
|
|
|
#ifdef AUDACIOUS
|
|
|
|
#include "audacious.h"
|
|
|
|
#endif
|
|
|
|
|
2008-12-15 21:40:24 +00:00
|
|
|
#ifdef BMPX
|
|
|
|
#include "bmpx.h"
|
2007-05-06 12:17:13 +00:00
|
|
|
#endif
|
|
|
|
|
2008-06-28 20:14:04 +00:00
|
|
|
#ifdef EVE
|
|
|
|
#include "eve.h"
|
|
|
|
#endif
|
|
|
|
|
2008-12-15 21:40:24 +00:00
|
|
|
#ifdef HDDTEMP
|
|
|
|
#include "hddtemp.h"
|
|
|
|
#endif /* HDDTEMP */
|
|
|
|
|
|
|
|
#ifdef MOC
|
|
|
|
#include "moc.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef MPD
|
|
|
|
#include "mpd.h"
|
2008-03-18 00:23:16 +00:00
|
|
|
#endif
|
|
|
|
|
2008-06-03 20:46:15 +00:00
|
|
|
#ifdef NVIDIA
|
|
|
|
#include "nvidia.h"
|
|
|
|
#endif
|
2008-06-15 18:38:33 +00:00
|
|
|
|
2009-07-20 05:43:36 +00:00
|
|
|
#ifdef HAVE_CURL
|
|
|
|
#include "ccurl_thread.h"
|
|
|
|
#endif /* HAVE_CURL */
|
|
|
|
|
2008-12-15 21:40:24 +00:00
|
|
|
#ifdef RSS
|
|
|
|
#include "rss.h"
|
2009-07-20 05:43:36 +00:00
|
|
|
#endif /* RSS */
|
2005-07-20 00:30:40 +00:00
|
|
|
|
2009-07-20 19:17:44 +00:00
|
|
|
#ifdef XOAP
|
|
|
|
#ifndef WEATHER
|
|
|
|
#error "WEATHER needs to be defined if XOAP is defined"
|
|
|
|
#endif /* WEATHER */
|
|
|
|
#endif /* XOAP */
|
|
|
|
|
2009-07-06 22:20:12 +00:00
|
|
|
#ifdef WEATHER
|
|
|
|
#include "weather.h"
|
2009-07-20 05:43:36 +00:00
|
|
|
#endif /* WEATHER */
|
2009-07-06 22:20:12 +00:00
|
|
|
|
2008-12-15 21:40:24 +00:00
|
|
|
#ifdef TCP_PORT_MONITOR
|
|
|
|
#include "tcp-portmon.h"
|
2008-09-24 06:59:45 +00:00
|
|
|
#endif
|
|
|
|
|
2006-03-25 21:21:07 +00:00
|
|
|
#ifdef XMMS2
|
2008-06-14 18:41:12 +00:00
|
|
|
#include "xmms2.h"
|
2006-03-25 21:21:07 +00:00
|
|
|
#endif
|
|
|
|
|
2009-01-03 23:00:52 +00:00
|
|
|
#ifdef IBM
|
|
|
|
#include "ibm.h"
|
2009-01-03 23:25:15 +00:00
|
|
|
#include "smapi.h"
|
2009-01-03 23:00:52 +00:00
|
|
|
#endif
|
|
|
|
|
2009-05-10 18:58:06 +00:00
|
|
|
#ifdef APCUPSD
|
|
|
|
#include "apcupsd.h"
|
|
|
|
#endif
|
|
|
|
|
2009-05-04 19:13:51 +00:00
|
|
|
/* sony support */
|
|
|
|
#include "sony.h"
|
|
|
|
|
2008-12-15 21:40:24 +00:00
|
|
|
/* 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;
|
2005-12-30 09:44:40 +00:00
|
|
|
|
2008-06-21 20:37:58 +00:00
|
|
|
#ifdef X11
|
2009-08-05 22:46:51 +00:00
|
|
|
int get_stippled_borders(void);
|
|
|
|
#endif /* X11 */
|
|
|
|
|
|
|
|
/* defined in conky.c */
|
|
|
|
extern long default_fg_color, default_bg_color, default_out_color;
|
|
|
|
extern long color0, color1, color2, color3, color4, color5, color6, color7,
|
|
|
|
color8, color9;
|
|
|
|
void set_current_text_color(long colour);
|
|
|
|
long get_current_text_color(void);
|
|
|
|
|
|
|
|
void set_updatereset(int);
|
|
|
|
int get_updatereset(void);
|
|
|
|
|
|
|
|
char *get_global_text(void);
|
|
|
|
extern long global_text_lines;
|
|
|
|
|
|
|
|
//adds newstring to to the tree unless you can already see it when travelling back.
|
|
|
|
//if it's possible to attach it then it returns a pointer to the leaf, else it returns NULL
|
|
|
|
struct conftree* conftree_add(struct conftree* previous, const char* newstring);
|
|
|
|
|
|
|
|
extern struct conftree *currentconffile;
|
|
|
|
|
2005-07-20 00:30:40 +00:00
|
|
|
enum {
|
|
|
|
INFO_CPU = 0,
|
|
|
|
INFO_MAIL = 1,
|
|
|
|
INFO_MEM = 2,
|
|
|
|
INFO_NET = 3,
|
2006-11-05 00:23:18 +00:00
|
|
|
INFO_PROCS = 4,
|
|
|
|
INFO_RUN_PROCS = 5,
|
|
|
|
INFO_UPTIME = 6,
|
|
|
|
INFO_BUFFERS = 7,
|
|
|
|
INFO_FS = 8,
|
2007-08-13 23:14:01 +00:00
|
|
|
INFO_SYSFS = 9,
|
2006-11-05 00:23:18 +00:00
|
|
|
INFO_MIXER = 10,
|
|
|
|
INFO_LOADAVG = 11,
|
|
|
|
INFO_UNAME = 12,
|
|
|
|
INFO_FREQ = 13,
|
2005-07-20 00:30:40 +00:00
|
|
|
#ifdef MPD
|
2006-11-05 00:23:18 +00:00
|
|
|
INFO_MPD = 14,
|
2005-07-20 00:30:40 +00:00
|
|
|
#endif
|
2006-11-05 00:23:18 +00:00
|
|
|
INFO_TOP = 15,
|
|
|
|
INFO_WIFI = 16,
|
|
|
|
INFO_DISKIO = 17,
|
|
|
|
INFO_I8K = 18,
|
2005-10-31 05:17:06 +00:00
|
|
|
#ifdef TCP_PORT_MONITOR
|
2008-02-20 20:30:45 +00:00
|
|
|
INFO_TCP_PORT_MONITOR = 19,
|
2005-10-31 05:17:06 +00:00
|
|
|
#endif
|
2006-11-03 20:54:52 +00:00
|
|
|
#ifdef AUDACIOUS
|
2006-11-05 00:23:18 +00:00
|
|
|
INFO_AUDACIOUS = 20,
|
2006-11-03 20:54:52 +00:00
|
|
|
#endif
|
2006-01-08 08:02:37 +00:00
|
|
|
#ifdef BMPX
|
2006-11-05 00:23:18 +00:00
|
|
|
INFO_BMPX = 21,
|
2006-01-07 07:01:22 +00:00
|
|
|
#endif
|
2006-03-25 21:21:07 +00:00
|
|
|
#ifdef XMMS2
|
2006-11-05 00:23:18 +00:00
|
|
|
INFO_XMMS2 = 22,
|
2006-03-25 21:21:07 +00:00
|
|
|
#endif
|
2006-11-30 20:46:34 +00:00
|
|
|
INFO_ENTROPY = 23,
|
2009-01-03 23:25:15 +00:00
|
|
|
#ifdef IBM
|
2008-03-18 00:23:16 +00:00
|
|
|
INFO_SMAPI = 25,
|
|
|
|
#endif
|
|
|
|
INFO_USERS = 26,
|
2008-03-22 22:58:26 +00:00
|
|
|
INFO_GW = 27,
|
2008-06-03 20:46:15 +00:00
|
|
|
#ifdef NVIDIA
|
2008-06-21 20:37:58 +00:00
|
|
|
INFO_NVIDIA = 28,
|
2008-06-03 20:46:15 +00:00
|
|
|
#endif
|
2008-06-21 20:37:58 +00:00
|
|
|
#ifdef X11
|
|
|
|
INFO_X11 = 29,
|
|
|
|
#endif
|
2008-09-24 06:59:45 +00:00
|
|
|
INFO_DNS = 30,
|
|
|
|
#ifdef MOC
|
2009-05-10 18:58:06 +00:00
|
|
|
INFO_MOC = 31,
|
|
|
|
#endif
|
|
|
|
#ifdef APCUPSD
|
|
|
|
INFO_APCUPSD = 32,
|
2008-09-24 06:59:45 +00:00
|
|
|
#endif
|
2009-07-06 22:20:12 +00:00
|
|
|
#ifdef WEATHER
|
|
|
|
INFO_WEATHER = 33,
|
|
|
|
#endif
|
2005-07-20 00:30:40 +00:00
|
|
|
};
|
|
|
|
|
2008-12-15 21:40:24 +00:00
|
|
|
/* get_battery_stuff() item selector
|
|
|
|
* needed by conky.c, linux.c and freebsd.c */
|
2006-12-12 23:21:14 +00:00
|
|
|
enum {
|
|
|
|
BATTERY_STATUS,
|
|
|
|
BATTERY_TIME
|
|
|
|
};
|
|
|
|
|
2008-12-15 21:40:24 +00:00
|
|
|
/* if_up strictness selector
|
|
|
|
* needed by conky.c and linux.c (and potentially others) */
|
2008-05-30 11:30:58 +00:00
|
|
|
enum {
|
|
|
|
IFUP_UP,
|
|
|
|
IFUP_LINK,
|
|
|
|
IFUP_ADDR
|
|
|
|
} ifup_strictness;
|
|
|
|
|
2009-07-28 18:38:43 +00:00
|
|
|
#ifdef HAVE_LUA
|
|
|
|
#include "llua.h"
|
|
|
|
#endif /* HAVE_LUA */
|
|
|
|
|
2008-12-15 21:40:24 +00:00
|
|
|
/* needed by linux.c and top.c -> outsource somewhere */
|
2005-11-27 06:56:35 +00:00
|
|
|
enum {
|
2008-02-20 20:30:45 +00:00
|
|
|
/* set to true if kernel uses "long" format for /proc/stats */
|
|
|
|
KFLAG_IS_LONGSTAT = 0x01,
|
|
|
|
/* set to true if kernel shows # of threads for the proc value
|
|
|
|
* in sysinfo() call */
|
|
|
|
KFLAG_PROC_IS_THREADS = 0x02
|
|
|
|
/* bits 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 available for future use */
|
|
|
|
/* KFLAG_NEXT_ONE = 0x04 */
|
|
|
|
};
|
2009-08-06 06:54:40 +00:00
|
|
|
#define KFLAG_SETON(a) ctx->info.kflags |= a
|
|
|
|
#define KFLAG_SETOFF(a) ctx->info.kflags &= (~a)
|
|
|
|
#define KFLAG_FLIP(a) ctx->info.kflags ^= a
|
|
|
|
#define KFLAG_ISSET(a) ctx->info.kflags & a
|
2005-07-20 00:30:40 +00:00
|
|
|
|
2008-12-15 21:40:24 +00:00
|
|
|
/* defined in users.c */
|
|
|
|
void update_users(void);
|
2005-07-20 00:30:40 +00:00
|
|
|
|
2009-05-20 04:49:42 +00:00
|
|
|
extern int inotify_fd;
|
2009-02-18 05:00:23 +00:00
|
|
|
|
2009-07-27 11:34:20 +00:00
|
|
|
#define NOBATTERY 0
|
|
|
|
|
2009-08-03 18:57:22 +00:00
|
|
|
/* to get rid of 'unused variable' warnings */
|
2009-08-03 19:34:47 +00:00
|
|
|
#define UNUSED(a) (void)a
|
2009-08-03 19:48:18 +00:00
|
|
|
#define UNUSED_ATTR __attribute__ ((unused))
|
2009-08-03 18:56:41 +00:00
|
|
|
|
2009-02-22 16:53:30 +00:00
|
|
|
#endif /* _conky_h_ */
|