mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-16 01:57:09 +00:00
Merge remote branch 'origin/master' into lua-config
This commit is contained in:
commit
d22369333d
@ -30,10 +30,6 @@
|
||||
#ifndef _ALGEBRA_H
|
||||
#define _ALGEBRA_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum match_type {
|
||||
OP_LT = 1, /* < */
|
||||
OP_GT = 2, /* > */
|
||||
@ -53,8 +49,4 @@ enum arg_type {
|
||||
int compare(const char *);
|
||||
int check_if_match(struct text_object *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _ALGEBRA_H */
|
||||
|
@ -25,10 +25,6 @@
|
||||
#ifndef APCUPSD_H_
|
||||
#define APCUPSD_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int apcupsd_scan_arg(const char *);
|
||||
|
||||
/* Service routine for the conky main thread */
|
||||
@ -48,8 +44,4 @@ void print_apcupsd_timeleft(struct text_object *, char *, int);
|
||||
void print_apcupsd_temp(struct text_object *, char *, int);
|
||||
void print_apcupsd_lastxfer(struct text_object *, char *, int);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*APCUPSD_H_*/
|
||||
|
@ -26,10 +26,6 @@
|
||||
#ifndef BMPX_H_
|
||||
#define BMPX_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void update_bmpx(void);
|
||||
struct bmpx_s {
|
||||
char *title;
|
||||
@ -47,8 +43,4 @@ void print_bmpx_uri(struct text_object *, char *, int);
|
||||
void print_bmpx_track(struct text_object *, char *, int);
|
||||
void print_bmpx_bitrate(struct text_object *, char *, int);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*BMPX_H_*/
|
||||
|
@ -71,12 +71,6 @@ static void set_up_gradient(void)
|
||||
greenmask = greenmask << (colour_depth / 3);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* this function is used in C code, use C calling conventions */
|
||||
|
||||
/* adjust colour values depending on colour depth */
|
||||
unsigned int adjust_colours(unsigned int colour)
|
||||
{
|
||||
@ -96,10 +90,6 @@ unsigned int adjust_colours(unsigned int colour)
|
||||
return colour;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/* this function returns the next colour between two colours for a gradient */
|
||||
unsigned long *do_gradient(int width, unsigned long first_colour, unsigned long last_colour)
|
||||
{
|
||||
|
@ -30,17 +30,7 @@
|
||||
#ifndef _COLOURS_H
|
||||
#define _COLOURS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* this function is used in C code, use C calling conventions */
|
||||
unsigned int adjust_colours(unsigned int);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
unsigned long *do_gradient(int, unsigned long, unsigned long);
|
||||
|
||||
long get_x11_color(const char *);
|
||||
|
@ -32,16 +32,8 @@
|
||||
#include <sys/socket.h>
|
||||
#include "text_object.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void print_to_bytes(struct text_object *, char *, int);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
void add_update_callback(void (*func)(void));
|
||||
void free_update_callbacks(void);
|
||||
void start_update_threading(void);
|
||||
|
50
src/conky.cc
50
src/conky.cc
@ -33,6 +33,8 @@
|
||||
#include "conky.h"
|
||||
#include "common.h"
|
||||
#include "timed-thread.h"
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
#include <stdarg.h>
|
||||
#include <cmath>
|
||||
#include <ctime>
|
||||
@ -389,7 +391,7 @@ unsigned int max_user_text;
|
||||
unsigned int text_buffer_size = DEFAULT_TEXT_BUFFER_SIZE;
|
||||
|
||||
/* UTF-8 */
|
||||
int utf8_mode = 0;
|
||||
bool utf8_mode = false;
|
||||
|
||||
/* no buffers in used memory? */
|
||||
int no_buffers;
|
||||
@ -2449,19 +2451,19 @@ void clean_up(void *memtofree1, void* memtofree2)
|
||||
free_and_zero(global_cpu);
|
||||
}
|
||||
|
||||
static int string_to_bool(const char *s)
|
||||
static bool string_to_bool(const char *s)
|
||||
{
|
||||
if (!s) {
|
||||
// Assumes an option without a true/false means true
|
||||
return 1;
|
||||
return true;
|
||||
} else if (strcasecmp(s, "yes") == EQUAL) {
|
||||
return 1;
|
||||
return true;
|
||||
} else if (strcasecmp(s, "true") == EQUAL) {
|
||||
return 1;
|
||||
return true;
|
||||
} else if (strcasecmp(s, "1") == EQUAL) {
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef BUILD_X11
|
||||
@ -4116,13 +4118,22 @@ void initialisation(int argc, char **argv) {
|
||||
#endif /* BUILD_LUA */
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
#ifdef BUILD_X11
|
||||
char *s, *temp;
|
||||
unsigned int x;
|
||||
bool isutf8(const char* envvar) {
|
||||
char *s = getenv(envvar);
|
||||
if(s) {
|
||||
std::string temp = s;
|
||||
std::transform(temp.begin(), temp.end(), temp.begin(), ::tolower);
|
||||
if( (temp.find("utf-8") != std::string::npos) || (temp.find("utf8") != std::string::npos) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
argc_copy = argc;
|
||||
argv_copy = argv;
|
||||
g_signal_pending = 0;
|
||||
@ -4139,21 +4150,8 @@ int main(int argc, char **argv)
|
||||
|
||||
/* handle command line parameters that don't change configs */
|
||||
#ifdef BUILD_X11
|
||||
if (((s = getenv("LC_ALL")) && *s) || ((s = getenv("LC_CTYPE")) && *s)
|
||||
|| ((s = getenv("LANG")) && *s)) {
|
||||
temp = (char *) malloc((strlen(s) + 1) * sizeof(char));
|
||||
if (temp == NULL) {
|
||||
NORM_ERR("malloc failed");
|
||||
}
|
||||
for (x = 0; x < strlen(s); x++) {
|
||||
temp[x] = tolower(s[x]);
|
||||
}
|
||||
temp[x] = 0;
|
||||
if (strstr(temp, "utf-8") || strstr(temp, "utf8")) {
|
||||
utf8_mode = 1;
|
||||
}
|
||||
|
||||
free(temp);
|
||||
if(isutf8("LC_ALL") || isutf8("LC_CTYPE") || isutf8("LANG")) {
|
||||
utf8_mode = true;
|
||||
}
|
||||
if (!setlocale(LC_CTYPE, "")) {
|
||||
NORM_ERR("Can't set the specified locale!\nCheck LANG, LC_CTYPE, LC_ALL.");
|
||||
|
18
src/conky.h
18
src/conky.h
@ -86,10 +86,6 @@ struct text_object;
|
||||
#include "mpd.h"
|
||||
#endif /* BUILD_MPD */
|
||||
|
||||
#ifdef __cplusplus
|
||||
/* this hack exists only to get around a compilation issue with some files
|
||||
* being converted to C++, will need a better solution */
|
||||
|
||||
/* C++ headers */
|
||||
#ifdef BUILD_CURL
|
||||
#include "ccurl_thread.h"
|
||||
@ -99,8 +95,6 @@ struct text_object;
|
||||
#include "audacious.h"
|
||||
#endif /* BUILD_AUDACIOUS */
|
||||
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#ifdef BUILD_RSS
|
||||
#include "rss.h"
|
||||
#endif /* BUILD_RSS */
|
||||
@ -196,9 +190,6 @@ enum {
|
||||
BATTERY_TIME
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
/* this hack exists only to get around a compilation issue with some files
|
||||
* being converted to C++, will need a better solution */
|
||||
struct information {
|
||||
unsigned int mask;
|
||||
|
||||
@ -255,7 +246,6 @@ struct information {
|
||||
|
||||
short kflags; /* kernel settings, see enum KFLAG */
|
||||
};
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* needed by linux.c and top.c -> outsource somewhere */
|
||||
enum {
|
||||
@ -289,10 +279,6 @@ extern struct information info;
|
||||
/* defined in conky.c */
|
||||
extern double current_update_time, last_update_time, update_interval;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* if_up strictness selector
|
||||
* needed by conky.c and linux.c (and potentially others) */
|
||||
enum _ifup_strictness {
|
||||
@ -332,10 +318,6 @@ void generate_text_internal(char *, int, struct text_object);
|
||||
int percent_print(char *, int, unsigned);
|
||||
void human_readable(long long, char *, int);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/* maximum size of config TEXT buffer, i.e. below TEXT line. */
|
||||
extern unsigned int max_user_text;
|
||||
|
||||
|
@ -38,18 +38,10 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
||||
|
||||
size_t remove_comments(char *string);
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int extract_variable_text_internal(struct text_object *retval, const char *const_p);
|
||||
|
||||
void free_text_objects(struct text_object *root);
|
||||
|
||||
const char *dev_name(const char *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _CONKY_CORE_H_ */
|
||||
|
@ -1,4 +1,5 @@
|
||||
/* -*- mode: c; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
|
||||
* vim: ts=4 sw=4 noet ai cindent syntax=cpp
|
||||
*
|
||||
* Conky, a system monitor, based on torsmo
|
||||
*
|
||||
@ -24,10 +25,6 @@
|
||||
#ifndef _EVE_H
|
||||
#define _EVE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define EVEURL_TRAINING "http://api.eve-online.com/char/SkillInTraining.xml.aspx"
|
||||
#define EVEURL_SKILLTREE "http://api.eve-online.com/eve/Skilltree.xml.aspx"
|
||||
#define EVE_OUTPUT_FORMAT "%s %d in %s"
|
||||
@ -36,8 +33,4 @@ void scan_eve(struct text_object *, const char *);
|
||||
void print_eve(struct text_object *, char *, int);
|
||||
void free_eve(struct text_object *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _EVE_H */
|
||||
|
@ -32,10 +32,6 @@
|
||||
|
||||
#include "x11.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* for fonts */
|
||||
struct font_list {
|
||||
|
||||
@ -83,9 +79,5 @@ void set_first_font(const char *);
|
||||
void free_fonts(void);
|
||||
void load_fonts(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _FONTS_H */
|
||||
#endif /* BUILD_X11 */
|
||||
|
@ -13,15 +13,7 @@
|
||||
#include <machine/apm_bios.h>
|
||||
#endif /* i386 || __i386__ */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int get_entropy_avail(unsigned int *);
|
||||
int get_entropy_poolsize(unsigned int *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*FREEBSD_H_*/
|
||||
|
@ -26,10 +26,6 @@
|
||||
#ifndef _IBM_H
|
||||
#define _IBM_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void get_ibm_acpi_fan(struct text_object *, char *, int);
|
||||
void get_ibm_acpi_temps(void);
|
||||
void get_ibm_acpi_volume(struct text_object *, char *, int);
|
||||
@ -37,8 +33,5 @@ void get_ibm_acpi_brightness(struct text_object *, char *, int);
|
||||
|
||||
void parse_ibm_temps_arg(struct text_object *, const char *);
|
||||
void print_ibm_temps(struct text_object *, char *, int);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _IBM_H */
|
||||
|
@ -72,10 +72,6 @@
|
||||
#define MPD_ACK_ERROR_PLAYER_SYNC 55
|
||||
#define MPD_ACK_ERROR_EXIST 56
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum mpd_TagItems {
|
||||
MPD_TAG_ITEM_ARTIST,
|
||||
MPD_TAG_ITEM_ALBUM,
|
||||
@ -632,8 +628,4 @@ void mpd_sendPlaylistMoveCommand(mpd_Connection *connection, char *playlist,
|
||||
void mpd_sendPlaylistDeleteCommand(mpd_Connection *connection, char *playlist,
|
||||
int pos);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -32,10 +32,6 @@
|
||||
|
||||
#include "mail.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void clean_up(void *memtofree1, void* memtofree2);
|
||||
|
||||
#define NORM_ERR(...) { \
|
||||
@ -59,8 +55,4 @@ extern int global_debug_level;
|
||||
#define DBGP(...) __DBGP(0, __VA_ARGS__)
|
||||
#define DBGP2(...) __DBGP(1, __VA_ARGS__)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _LOGGING_H */
|
||||
|
13
src/nc.h
13
src/nc.h
@ -1,11 +1,14 @@
|
||||
/* -*- mode: c; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*- */
|
||||
/* -*- mode: c; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
|
||||
* vim: ts=4 sw=4 noet ai cindent syntax=cpp
|
||||
*/
|
||||
|
||||
#ifndef CONKY_NC_H
|
||||
#define CONKY_NC_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void _nc_free_and_exit(int);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CONKY_NC_H */
|
||||
|
@ -30,15 +30,7 @@
|
||||
#include "conky.h"
|
||||
#include "common.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int get_entropy_avail(unsigned int *);
|
||||
int get_entropy_poolsize(unsigned int *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*NETBSD_H_*/
|
||||
|
@ -32,16 +32,8 @@
|
||||
#ifndef NVIDIA_CONKY_H
|
||||
#define NVIDIA_CONKY_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int set_nvidia_type(struct text_object *, const char *);
|
||||
void print_nvidia_value(struct text_object *, char *, int);
|
||||
void free_nvidia(struct text_object *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -9,10 +9,6 @@
|
||||
#include <sys/sensors.h>
|
||||
#include <machine/apmvar.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void parse_obsd_sensor(struct text_object *, const char *);
|
||||
void print_obsd_sensors_temp(struct text_object *, char *, int);
|
||||
void print_obsd_sensors_fan(struct text_object *, char *, int);
|
||||
@ -27,8 +23,4 @@ typedef struct apm_power_info *apm_info_t;
|
||||
int get_entropy_avail(unsigned int *);
|
||||
int get_entropy_poolsize(unsigned int *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*OPENBSD_H_*/
|
||||
|
11
src/proc.h
11
src/proc.h
@ -28,14 +28,13 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef CONKY_PROC_H
|
||||
#define CONKY_PROC_H
|
||||
|
||||
#define PROCDIR "/proc"
|
||||
#define READERR "Can't read '%s'"
|
||||
#define READSIZE 128
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void print_pid_chroot(struct text_object *obj, char *p, int p_max_size);
|
||||
void print_pid_cmdline(struct text_object *obj, char *p, int p_max_size);
|
||||
void print_pid_cwd(struct text_object *obj, char *p, int p_max_size);
|
||||
@ -79,7 +78,5 @@ void print_pid_write(struct text_object *obj, char *p, int p_max_size);
|
||||
|
||||
void scan_cmdline_to_pid_arg(struct text_object *obj, const char *arg, void* free_at_crash);
|
||||
void print_cmdline_to_pid(struct text_object *obj, char *p, int p_max_size);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CONKY_PROC_H */
|
||||
|
@ -26,18 +26,10 @@
|
||||
#ifndef RSS_H_
|
||||
#define RSS_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void rss_scan_arg(struct text_object *, const char *);
|
||||
void rss_print_info(struct text_object *, char *, int);
|
||||
void rss_free_obj_info(struct text_object *);
|
||||
|
||||
void rss_free_info(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*RSS_H_*/
|
||||
|
@ -31,14 +31,6 @@
|
||||
#ifndef _SONY_H
|
||||
#define _SONY_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void get_sony_fanspeed(struct text_object *, char *, int);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _SONY_H */
|
||||
|
@ -33,10 +33,6 @@
|
||||
#include "config.h" /* for the defines */
|
||||
#include "specials.h" /* enum special_types */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* text object callbacks */
|
||||
struct obj_cb {
|
||||
/* text object: print obj's output to p */
|
||||
@ -116,8 +112,4 @@ int ifblock_stack_empty(void **opaque);
|
||||
/* make the given object be a plain text object printing given string */
|
||||
void obj_be_plain_text(struct text_object *, const char *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _TEXT_OBJECT_H */
|
||||
|
@ -31,10 +31,6 @@
|
||||
|
||||
#include <xmmsclient/xmmsclient.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct xmms2_s {
|
||||
char *artist;
|
||||
char *album;
|
||||
@ -83,8 +79,4 @@ int if_xmms2_connected(struct text_object *);
|
||||
|
||||
void free_xmms2(struct text_object *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*XMMS2_H_*/
|
||||
|
Loading…
Reference in New Issue
Block a user