1 /* -*- mode: c; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
3 * Conky, a system monitor, based on torsmo
5 * Any original torsmo code is licensed under the BSD license
7 * All code written since the fork of torsmo is licensed under the GPL
9 * Please see COPYING for details
11 * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
12 * Copyright (c) 2005-2009 Brenden Matthews, Philip Kovacs, et. al.
14 * All rights reserved.
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.
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/>.
28 * vim: ts=4 sw=4 noet ai cindent syntax=c
35 #include "config.h" /* defines */
36 #include "common.h" /* at least for struct dns_data */
37 #include <sys/utsname.h> /* struct uname_s */
38 #include <arpa/inet.h>
40 #if defined(HAS_MCHECK_H)
42 #endif /* HAS_MCHECK_H */
47 #define EQUAL 0 //returnvalue of strcmp-variants when strings are equal
51 #define DEFAULT_BAR_WIDTH_NO_X 10
53 #if !defined(__GNUC__)
54 # define __attribute__(x) /* nothing */
58 // use our own strndup() if it's not available
59 char *strndup(const char *s, size_t n);
60 #endif /* HAVE_STRNDUP */
62 /* headers of optional features
63 * include them here, so we don't need to run the check
64 * in every code file optionally using the feature
68 #include "audacious.h"
96 #include "ccurl_thread.h"
97 #endif /* HAVE_CURL */
105 #error "WEATHER needs to be defined if XOAP is defined"
113 #ifdef TCP_PORT_MONITOR
114 #include "tcp-portmon.h"
137 /* A size for temporary, static buffers to use when
138 * one doesn't know what to choose. Defaults to 256. */
139 extern unsigned int text_buffer_size;
142 unsigned int entropy_avail;
143 unsigned int poolsize;
153 struct gateway_info {
160 struct monitor_info {
165 struct desktop_info {
174 struct monitor_info monitor;
175 struct desktop_info desktop;
178 int get_stippled_borders(void);
182 /* defined in conky.c */
183 extern long default_fg_color, default_bg_color, default_out_color;
184 extern long color0, color1, color2, color3, color4, color5, color6, color7,
186 void set_current_text_color(long colour);
187 long get_current_text_color(void);
189 void set_updatereset(int);
190 int get_updatereset(void);
194 struct conftree* horz_next;
195 struct conftree* vert_next;
196 struct conftree* back;
199 char load_config_file(const char *);
201 char *get_global_text(void);
202 extern long global_text_lines;
204 //adds newstring to to the tree unless you can already see it when travelling back.
205 //if it's possible to attach it then it returns a pointer to the leaf, else it returns NULL
206 struct conftree* conftree_add(struct conftree* previous, const char* newstring);
208 extern struct conftree *currentconffile;
210 #define MAX_TEMPLATES 10
211 char **get_templates(void);
235 #ifdef TCP_PORT_MONITOR
236 INFO_TCP_PORT_MONITOR = 19,
271 /* get_battery_stuff() item selector
272 * needed by conky.c, linux.c and freebsd.c */
278 /* if_up strictness selector
279 * needed by conky.c and linux.c (and potentially others) */
289 struct utsname uname_s;
295 /* memory information in kilobytes */
296 unsigned long long mem, memeasyfree, memfree, memmax, swap, swapfree, swapmax;
297 unsigned long long bufmem, buffers, cached;
299 unsigned short procs;
300 unsigned short run_procs;
303 /* struct cpu_stat cpu_summed; what the hell is this? */
304 unsigned int cpu_count;
309 int diskio_avg_samples;
316 struct xmms2_s xmms2;
319 AUDACIOUS_S audacious;
324 struct usr_info users;
325 struct gateway_info gw_info;
326 struct dns_data nameserver_info;
327 struct process *cpu[10];
328 struct process *memu[10];
329 struct process *time[10];
331 struct process *io[10];
333 struct process *first_process;
334 unsigned long looped;
335 struct entropy_s entropy;
336 double music_player_interval;
346 short kflags; /* kernel settings, see enum KFLAG */
351 #endif /* HAVE_LUA */
353 /* needed by linux.c and top.c -> outsource somewhere */
355 /* set to true if kernel uses "long" format for /proc/stats */
356 KFLAG_IS_LONGSTAT = 0x01,
357 /* set to true if kernel shows # of threads for the proc value
358 * in sysinfo() call */
359 KFLAG_PROC_IS_THREADS = 0x02
360 /* bits 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 available for future use */
361 /* KFLAG_NEXT_ONE = 0x04 */
363 #define KFLAG_SETON(a) info.kflags |= a
364 #define KFLAG_SETOFF(a) info.kflags &= (~a)
365 #define KFLAG_FLIP(a) info.kflags ^= a
366 #define KFLAG_ISSET(a) info.kflags & a
368 /* defined in conky.c, needed by top.c */
369 extern int top_cpu, top_mem, top_time;
374 /* defined in conky.c, needed by top.c */
375 extern int cpu_separate;
377 /* struct that has all info to be shared between
378 * instances of the same text object */
379 extern struct information info;
381 /* defined in users.c */
382 void update_users(void);
384 /* defined in conky.c */
385 extern double current_update_time, last_update_time, update_interval;
387 /* defined in conky.c */
388 int spaced_print(char *, int, const char *, int, ...)
389 __attribute__((format(printf, 3, 5)));
390 extern int inotify_fd;
392 /* defined in conky.c
393 * evaluates 'text' and places the result in 'buffer'
395 void evaluate(const char *text, char *buffer);
397 /* maximum size of config TEXT buffer, i.e. below TEXT line. */
398 extern unsigned int max_user_text;
400 /* path to config file */
401 extern char *current_config;
403 /* just a wrapper for read_exec() defined in conky.c */
404 void do_read_exec(const char *data, char *buf, const int size);
411 #define OVERWRITE_FILE 8
412 #define APPEND_FILE 16
414 #define TO_NCURSES 32
416 enum x_initialiser_state {
421 extern int output_methods;
422 extern enum x_initialiser_state x_initialised;
424 void set_update_interval(double interval);
426 #define DEFAULT_TEXT_BUFFER_SIZE_S "##DEFAULT_TEXT_BUFFER_SIZE"
430 /* to get rid of 'unused variable' warnings */
431 #define UNUSED(a) (void)a
432 #define UNUSED_ATTR __attribute__ ((unused))
434 #endif /* _conky_h_ */