Revert "auesnthaeou"
[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 #ifdef NCURSES
128 #include <ncurses.h>
129 #endif
130
131 /* sony support */
132 #include "sony.h"
133
134 /* A size for temporary, static buffers to use when
135  * one doesn't know what to choose. Defaults to 256.  */
136 extern unsigned int text_buffer_size;
137
138 #ifdef X11
139 int get_stippled_borders(void);
140 #endif /* X11 */
141
142 /* defined in conky.c */
143 extern long default_fg_color, default_bg_color, default_out_color;
144 extern long color0, color1, color2, color3, color4, color5, color6, color7,
145            color8, color9;
146 void set_current_text_color(long colour);
147 long get_current_text_color(void);
148
149 void set_updatereset(int);
150 int get_updatereset(void);
151
152 char *get_global_text(void);
153 extern long global_text_lines;
154
155 //adds newstring to to the tree unless you can already see it when travelling back.
156 //if it's possible to attach it then it returns a pointer to the leaf, else it returns NULL
157 struct conftree* conftree_add(struct conftree* previous, const char* newstring);
158
159 extern struct conftree *currentconffile;
160
161 enum {
162         INFO_CPU = 0,
163         INFO_MAIL = 1,
164         INFO_MEM = 2,
165         INFO_NET = 3,
166         INFO_PROCS = 4,
167         INFO_RUN_PROCS = 5,
168         INFO_UPTIME = 6,
169         INFO_BUFFERS = 7,
170         INFO_FS = 8,
171         INFO_SYSFS = 9,
172         INFO_MIXER = 10,
173         INFO_LOADAVG = 11,
174         INFO_UNAME = 12,
175         INFO_FREQ = 13,
176 #ifdef MPD
177         INFO_MPD = 14,
178 #endif
179         INFO_TOP = 15,
180         INFO_WIFI = 16,
181         INFO_DISKIO = 17,
182         INFO_I8K = 18,
183 #ifdef TCP_PORT_MONITOR
184         INFO_TCP_PORT_MONITOR = 19,
185 #endif
186 #ifdef AUDACIOUS
187         INFO_AUDACIOUS = 20,
188 #endif
189 #ifdef BMPX
190         INFO_BMPX = 21,
191 #endif
192 #ifdef XMMS2
193         INFO_XMMS2 = 22,
194 #endif
195         INFO_ENTROPY = 23,
196 #ifdef IBM
197         INFO_SMAPI = 25,
198 #endif
199         INFO_USERS = 26,
200         INFO_GW = 27,
201 #ifdef NVIDIA
202         INFO_NVIDIA = 28,
203 #endif
204 #ifdef X11
205         INFO_X11 = 29,
206 #endif
207         INFO_DNS = 30,
208 #ifdef MOC
209         INFO_MOC = 31,
210 #endif
211 #ifdef APCUPSD
212         INFO_APCUPSD = 32,
213 #endif
214 #ifdef WEATHER
215         INFO_WEATHER = 33,
216 #endif
217 };
218
219 /* get_battery_stuff() item selector
220  * needed by conky.c, linux.c and freebsd.c */
221 enum {
222         BATTERY_STATUS,
223         BATTERY_TIME
224 };
225
226 /* if_up strictness selector
227  * needed by conky.c and linux.c (and potentially others) */
228 enum {
229         IFUP_UP,
230         IFUP_LINK,
231         IFUP_ADDR
232 } ifup_strictness;
233
234 #ifdef HAVE_LUA
235 #include "llua.h"
236 #endif /* HAVE_LUA */
237
238 /* needed by linux.c and top.c -> outsource somewhere */
239 enum {
240         /* set to true if kernel uses "long" format for /proc/stats */
241         KFLAG_IS_LONGSTAT = 0x01,
242         /* set to true if kernel shows # of threads for the proc value
243          * in sysinfo() call */
244         KFLAG_PROC_IS_THREADS = 0x02
245         /* bits 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 available for future use */
246         /* KFLAG_NEXT_ONE = 0x04 */
247 };
248 #define KFLAG_SETON(a) ctx->info.kflags |= a
249 #define KFLAG_SETOFF(a) ctx->info.kflags &= (~a)
250 #define KFLAG_FLIP(a) ctx->info.kflags ^= a
251 #define KFLAG_ISSET(a) ctx->info.kflags & a
252
253 /* defined in users.c */
254 void update_users(void);
255
256 extern int inotify_fd;
257
258 #define NOBATTERY 0
259
260 /* to get rid of 'unused variable' warnings */
261 #define UNUSED(a)  (void)a
262 #define UNUSED_ATTR __attribute__ ((unused))
263
264 #endif /* _conky_h_ */