Uhh..ansohus
[monky] / src / conky.h
1 /* -*- mode: c; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
2  *
3  * Conky, a system monitor, based on torsmo
4  *
5  * Any original torsmo code is licensed under the BSD license
6  *
7  * All code written since the fork of torsmo is licensed under the GPL
8  *
9  * Please see COPYING for details
10  *
11  * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
12  * Copyright (c) 2005-2009 Brenden Matthews, Philip Kovacs, et. al.
13  *      (see AUTHORS)
14  * All rights reserved.
15  *
16  * This program is free software: you can redistribute it and/or modify
17  * it under the terms of the GNU General Public License as published by
18  * the Free Software Foundation, either version 3 of the License, or
19  * (at your option) any later version.
20  *
21  * This program is distributed in the hope that it will be useful,
22  * but WITHOUT ANY WARRANTY; without even the implied warranty of
23  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24  * GNU General Public License for more details.
25  * You should have received a copy of the GNU General Public License
26  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
27  *
28  * vim: ts=4 sw=4 noet ai cindent syntax=c
29  *
30  */
31
32 #ifndef _conky_h_
33 #define _conky_h_
34
35 #include "config.h"     /* defines */
36
37 #if defined(HAS_MCHECK_H)
38 #include <mcheck.h>
39 #endif /* HAS_MCHECK_H */
40
41 #undef EQUAL
42 #undef FALSE
43 #undef TRUE
44 #define EQUAL 0 //returnvalue of strcmp-variants when strings are equal
45 #define FALSE 0
46 #define TRUE 1
47
48 #define DEFAULT_BAR_WIDTH_NO_X 10
49
50 #if !defined(__GNUC__)
51 #  define __attribute__(x) /* nothing */
52 #endif
53
54 #ifndef HAVE_STRNDUP
55 // use our own strndup() if it's not available
56 char *strndup(const char *s, size_t n);
57 #endif /* HAVE_STRNDUP */
58
59 /* headers of optional features
60  * include them here, so we don't need to run the check
61  * in every code file optionally using the feature
62  */
63
64 #ifdef AUDACIOUS
65 #include "audacious.h"
66 #endif
67
68 #ifdef BMPX
69 #include "bmpx.h"
70 #endif
71
72 #ifdef EVE
73 #include "eve.h"
74 #endif
75
76 #ifdef HDDTEMP
77 #include "hddtemp.h"
78 #endif /* HDDTEMP */
79
80 #ifdef MOC
81 #include "moc.h"
82 #endif
83
84 #ifdef MPD
85 #include "mpd.h"
86 #endif
87
88 #ifdef NVIDIA
89 #include "nvidia.h"
90 #endif
91
92 #ifdef HAVE_CURL
93 #include "ccurl_thread.h"
94 #endif /* HAVE_CURL */
95
96 #ifdef RSS
97 #include "rss.h"
98 #endif /* RSS */
99
100 #ifdef XOAP
101 #ifndef WEATHER
102 #error "WEATHER needs to be defined if XOAP is defined"
103 #endif /* WEATHER */
104 #endif /* XOAP */
105
106 #ifdef WEATHER
107 #include "weather.h"
108 #endif /* WEATHER */
109
110 #ifdef TCP_PORT_MONITOR
111 #include "tcp-portmon.h"
112 #endif
113
114 #ifdef XMMS2
115 #include "xmms2.h"
116 #endif
117
118 #ifdef IBM
119 #include "ibm.h"
120 #include "smapi.h"
121 #endif
122
123 #ifdef APCUPSD
124 #include "apcupsd.h"
125 #endif
126
127 /* sony support */
128 #include "sony.h"
129
130 /* A size for temporary, static buffers to use when
131  * one doesn't know what to choose. Defaults to 256.  */
132 extern unsigned int text_buffer_size;
133
134 #ifdef X11
135 int get_stippled_borders(void);
136 #endif /* X11 */
137
138 /* defined in conky.c */
139 extern long default_fg_color, default_bg_color, default_out_color;
140 extern long color0, color1, color2, color3, color4, color5, color6, color7,
141            color8, color9;
142 void set_current_text_color(long colour);
143 long get_current_text_color(void);
144
145 void set_updatereset(int);
146 int get_updatereset(void);
147
148 char *get_global_text(void);
149 extern long global_text_lines;
150
151 //adds newstring to to the tree unless you can already see it when travelling back.
152 //if it's possible to attach it then it returns a pointer to the leaf, else it returns NULL
153 struct conftree* conftree_add(struct conftree* previous, const char* newstring);
154
155 extern struct conftree *currentconffile;
156
157 enum {
158         INFO_CPU = 0,
159         INFO_MAIL = 1,
160         INFO_MEM = 2,
161         INFO_NET = 3,
162         INFO_PROCS = 4,
163         INFO_RUN_PROCS = 5,
164         INFO_UPTIME = 6,
165         INFO_BUFFERS = 7,
166         INFO_FS = 8,
167         INFO_SYSFS = 9,
168         INFO_MIXER = 10,
169         INFO_LOADAVG = 11,
170         INFO_UNAME = 12,
171         INFO_FREQ = 13,
172 #ifdef MPD
173         INFO_MPD = 14,
174 #endif
175         INFO_TOP = 15,
176         INFO_WIFI = 16,
177         INFO_DISKIO = 17,
178         INFO_I8K = 18,
179 #ifdef TCP_PORT_MONITOR
180         INFO_TCP_PORT_MONITOR = 19,
181 #endif
182 #ifdef AUDACIOUS
183         INFO_AUDACIOUS = 20,
184 #endif
185 #ifdef BMPX
186         INFO_BMPX = 21,
187 #endif
188 #ifdef XMMS2
189         INFO_XMMS2 = 22,
190 #endif
191         INFO_ENTROPY = 23,
192 #ifdef IBM
193         INFO_SMAPI = 25,
194 #endif
195         INFO_USERS = 26,
196         INFO_GW = 27,
197 #ifdef NVIDIA
198         INFO_NVIDIA = 28,
199 #endif
200 #ifdef X11
201         INFO_X11 = 29,
202 #endif
203         INFO_DNS = 30,
204 #ifdef MOC
205         INFO_MOC = 31,
206 #endif
207 #ifdef APCUPSD
208         INFO_APCUPSD = 32,
209 #endif
210 #ifdef WEATHER
211         INFO_WEATHER = 33,
212 #endif
213 };
214
215 /* get_battery_stuff() item selector
216  * needed by conky.c, linux.c and freebsd.c */
217 enum {
218         BATTERY_STATUS,
219         BATTERY_TIME
220 };
221
222 /* if_up strictness selector
223  * needed by conky.c and linux.c (and potentially others) */
224 enum {
225         IFUP_UP,
226         IFUP_LINK,
227         IFUP_ADDR
228 } ifup_strictness;
229
230 #ifdef HAVE_LUA
231 #include "llua.h"
232 #endif /* HAVE_LUA */
233
234 /* needed by linux.c and top.c -> outsource somewhere */
235 enum {
236         /* set to true if kernel uses "long" format for /proc/stats */
237         KFLAG_IS_LONGSTAT = 0x01,
238         /* set to true if kernel shows # of threads for the proc value
239          * in sysinfo() call */
240         KFLAG_PROC_IS_THREADS = 0x02
241         /* bits 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 available for future use */
242         /* KFLAG_NEXT_ONE = 0x04 */
243 };
244 #define KFLAG_SETON(a) ctx->info.kflags |= a
245 #define KFLAG_SETOFF(a) ctx->info.kflags &= (~a)
246 #define KFLAG_FLIP(a) ctx->info.kflags ^= a
247 #define KFLAG_ISSET(a) ctx->info.kflags & a
248
249 /* defined in users.c */
250 void update_users(void);
251
252 extern int inotify_fd;
253
254 #define NOBATTERY 0
255
256 /* to get rid of 'unused variable' warnings */
257 #define UNUSED(a)  (void)a
258 #define UNUSED_ATTR __attribute__ ((unused))
259
260 #endif /* _conky_h_ */