1 /* Conky, a system monitor, based on torsmo
3 * Any original torsmo code is licensed under the BSD license
5 * All code written since the fork of torsmo is licensed under the GPL
7 * Please see COPYING for details
9 * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
10 * Copyright (c) 2005-2009 Brenden Matthews, Philip Kovacs, et. al.
12 * All rights reserved.
14 * This program is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation, either version 3 of the License, or
17 * (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program. If not, see <http://www.gnu.org/licenses/>.
26 * vim: ts=4 sw=4 noet ai cindent syntax=c
33 #include "config.h" /* defines */
34 #include "common.h" /* at least for struct dns_data */
35 #include <sys/utsname.h> /* struct uname_s */
37 #if defined(HAS_MCHECK_H)
39 #endif /* HAS_MCHECK_H */
44 #define EQUAL 0 //returnvalue of strcmp-variants when strings are equal
48 #define DEFAULT_BAR_WIDTH_NO_X 10
50 #if !defined(__GNUC__)
51 # define __attribute__(x) /* nothing */
55 // use our own strndup() if it's not available
56 char *strndup(const char *s, size_t n);
57 #endif /* HAVE_STRNDUP */
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
65 #include "audacious.h"
93 #include "ccurl_thread.h"
94 #endif /* HAVE_CURL */
102 #error "WEATHER needs to be defined if XOAP is defined"
112 #endif /* HAVE_LUA */
114 #ifdef TCP_PORT_MONITOR
115 #include "tcp-portmon.h"
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;
139 unsigned int entropy_avail;
140 unsigned int poolsize;
150 struct gateway_info {
157 struct monitor_info {
162 struct desktop_info {
171 struct monitor_info monitor;
172 struct desktop_info desktop;
198 #ifdef TCP_PORT_MONITOR
199 INFO_TCP_PORT_MONITOR = 19,
234 /* get_battery_stuff() item selector
235 * needed by conky.c, linux.c and freebsd.c */
241 /* if_up strictness selector
242 * needed by conky.c and linux.c (and potentially others) */
252 struct utsname uname_s;
258 /* memory information in kilobytes */
259 unsigned long long mem, memeasyfree, memfree, memmax, swap, swapfree, swapmax;
260 unsigned long long bufmem, buffers, cached;
262 unsigned short procs;
263 unsigned short run_procs;
266 /* struct cpu_stat cpu_summed; what the hell is this? */
267 unsigned int cpu_count;
272 int diskio_avg_samples;
279 struct xmms2_s xmms2;
282 AUDACIOUS_S audacious;
287 struct usr_info users;
288 struct gateway_info gw_info;
289 struct dns_data nameserver_info;
290 struct process *cpu[10];
291 struct process *memu[10];
292 struct process *time[10];
294 struct process *io[10];
296 struct process *first_process;
297 unsigned long looped;
298 struct entropy_s entropy;
299 double music_player_interval;
309 short kflags; /* kernel settings, see enum KFLAG */
312 /* needed by linux.c and top.c -> outsource somewhere */
314 /* set to true if kernel uses "long" format for /proc/stats */
315 KFLAG_IS_LONGSTAT = 0x01,
316 /* set to true if kernel shows # of threads for the proc value
317 * in sysinfo() call */
318 KFLAG_PROC_IS_THREADS = 0x02
319 /* bits 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 available for future use */
320 /* KFLAG_NEXT_ONE = 0x04 */
322 #define KFLAG_SETON(a) info.kflags |= a
323 #define KFLAG_SETOFF(a) info.kflags &= (~a)
324 #define KFLAG_FLIP(a) info.kflags ^= a
325 #define KFLAG_ISSET(a) info.kflags & a
327 /* defined in conky.c, needed by top.c */
328 extern int top_cpu, top_mem, top_time;
333 /* defined in conky.c, needed by top.c */
334 extern int cpu_separate;
336 /* struct that has all info to be shared between
337 * instances of the same text object */
338 extern struct information info;
340 /* defined in users.c */
341 void update_users(void);
343 /* defined in conky.c */
344 extern double current_update_time, last_update_time, update_interval;
346 /* defined in conky.c */
347 int spaced_print(char *, int, const char *, int, ...)
348 __attribute__((format(printf, 3, 5)));
349 extern int inotify_fd;
351 /* defined in conky.c
352 * evaluates 'text' and places the result in 'buffer'
354 void evaluate(char *text, char *buffer);
356 /* maximum size of config TEXT buffer, i.e. below TEXT line. */
357 extern unsigned int max_user_text;
359 /* path to config file */
360 extern char *current_config;
367 #define OVERWRITE_FILE 8
368 #define APPEND_FILE 16
369 enum x_initialiser_state {
374 extern int output_methods;
375 extern enum x_initialiser_state x_initialised;
377 #define DEFAULT_TEXT_BUFFER_SIZE_S "##DEFAULT_TEXT_BUFFER_SIZE"
381 #endif /* _conky_h_ */