2009-07-21 17:07:30 +00:00
|
|
|
|
#ifndef _I3STATUS_H
|
|
|
|
|
#define _I3STATUS_H
|
|
|
|
|
|
2016-12-13 18:32:57 +00:00
|
|
|
|
typedef enum {
|
|
|
|
|
O_DZEN2,
|
|
|
|
|
O_XMOBAR,
|
|
|
|
|
O_I3BAR,
|
|
|
|
|
O_LEMONBAR,
|
|
|
|
|
O_TERM,
|
|
|
|
|
O_NONE
|
|
|
|
|
} output_format_t;
|
|
|
|
|
extern output_format_t output_format;
|
|
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
|
M_PANGO,
|
|
|
|
|
M_NONE
|
|
|
|
|
} markup_format_t;
|
|
|
|
|
extern markup_format_t markup_format;
|
|
|
|
|
|
|
|
|
|
extern char *pct_mark;
|
2015-10-02 06:28:53 +00:00
|
|
|
|
|
2009-07-21 17:07:30 +00:00
|
|
|
|
#include <stdbool.h>
|
2009-10-11 20:11:09 +00:00
|
|
|
|
#include <confuse.h>
|
2011-04-21 18:49:22 +00:00
|
|
|
|
#include <time.h>
|
2012-03-25 18:55:55 +00:00
|
|
|
|
#include <yajl/yajl_gen.h>
|
2012-04-08 12:05:47 +00:00
|
|
|
|
#include <yajl/yajl_version.h>
|
2012-03-25 18:55:55 +00:00
|
|
|
|
#include <unistd.h>
|
|
|
|
|
#include <string.h>
|
2015-03-11 16:29:32 +00:00
|
|
|
|
#include <pthread.h>
|
|
|
|
|
#include <stdint.h>
|
2009-07-21 17:07:30 +00:00
|
|
|
|
|
2008-10-04 16:42:12 +00:00
|
|
|
|
#define BEGINS_WITH(haystack, needle) (strncmp(haystack, needle, strlen(needle)) == 0)
|
2009-10-11 20:11:09 +00:00
|
|
|
|
#define max(a, b) ((a) > (b) ? (a) : (b))
|
2009-07-21 18:23:08 +00:00
|
|
|
|
|
2015-03-11 16:29:32 +00:00
|
|
|
|
#define DEFAULT_SINK_INDEX UINT32_MAX
|
2015-04-19 14:32:51 +00:00
|
|
|
|
#define COMPOSE_VOLUME_MUTE(vol, mute) ((vol) | ((mute) ? (1 << 30) : 0))
|
|
|
|
|
#define DECOMPOSE_VOLUME(cvol) ((cvol) & ~(1 << 30))
|
|
|
|
|
#define DECOMPOSE_MUTED(cvol) (((cvol) & (1 << 30)) != 0)
|
2019-01-23 07:45:51 +00:00
|
|
|
|
#define MAX_SINK_DESCRIPTION_LEN (128) /* arbitrary */
|
2015-03-11 16:29:32 +00:00
|
|
|
|
|
2019-01-23 07:56:40 +00:00
|
|
|
|
#if defined(__linux__)
|
2009-07-23 16:40:49 +00:00
|
|
|
|
|
|
|
|
|
#define THERMAL_ZONE "/sys/class/thermal/thermal_zone%d/temp"
|
|
|
|
|
|
2012-11-14 01:29:55 +00:00
|
|
|
|
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
|
2009-07-23 16:40:49 +00:00
|
|
|
|
|
2011-12-09 23:30:22 +00:00
|
|
|
|
/* this needs the coretemp module to be loaded */
|
2012-11-14 01:29:55 +00:00
|
|
|
|
#if defined(__DragonFly__)
|
|
|
|
|
#define THERMAL_ZONE "hw.sensors.cpu%d.temp0"
|
|
|
|
|
#else
|
2011-12-09 23:30:22 +00:00
|
|
|
|
#define THERMAL_ZONE "dev.cpu.%d.temperature"
|
2012-11-14 01:29:55 +00:00
|
|
|
|
#endif
|
2009-07-23 16:40:49 +00:00
|
|
|
|
#define BATT_LIFE "hw.acpi.battery.life"
|
|
|
|
|
#define BATT_TIME "hw.acpi.battery.time"
|
|
|
|
|
#define BATT_STATE "hw.acpi.battery.state"
|
|
|
|
|
|
2014-04-29 22:30:11 +00:00
|
|
|
|
#elif defined(__OpenBSD__) || defined(__NetBSD__)
|
2012-10-10 07:57:32 +00:00
|
|
|
|
/* Default to acpitz(4) if no path is set. */
|
2012-10-10 07:53:34 +00:00
|
|
|
|
#define THERMAL_ZONE "acpitz%d"
|
2009-07-23 16:40:49 +00:00
|
|
|
|
#endif
|
2009-07-21 18:23:08 +00:00
|
|
|
|
|
2009-08-31 17:34:57 +00:00
|
|
|
|
#if defined(__FreeBSD_kernel__) && defined(__GLIBC__)
|
|
|
|
|
|
|
|
|
|
#include <sys/stat.h>
|
|
|
|
|
#include <sys/param.h>
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
2009-10-11 20:11:09 +00:00
|
|
|
|
/* Allows for the definition of a variable without opening a new scope, thus
|
|
|
|
|
* suited for usage in a macro. Idea from wmii. */
|
|
|
|
|
#define with(type, var, init) \
|
2015-09-20 17:56:44 +00:00
|
|
|
|
for (type var = (type)-1; (var == (type)-1) && ((var = (init)) || 1); var = (type)1)
|
2009-10-11 20:11:09 +00:00
|
|
|
|
|
2015-03-16 09:00:32 +00:00
|
|
|
|
#define CASE_SEC(name) \
|
|
|
|
|
if (BEGINS_WITH(current, name)) \
|
|
|
|
|
with(cfg_t *, sec, cfg_section = cfg_getsec(cfg, name)) if (sec != NULL)
|
2009-07-21 17:07:30 +00:00
|
|
|
|
|
2015-03-16 09:00:32 +00:00
|
|
|
|
#define CASE_SEC_TITLE(name) \
|
|
|
|
|
if (BEGINS_WITH(current, name)) \
|
|
|
|
|
with(const char *, title, current + strlen(name) + 1) \
|
|
|
|
|
with(cfg_t *, sec, cfg_section = cfg_gettsec(cfg, name, title)) if (sec != NULL)
|
2009-10-11 20:11:09 +00:00
|
|
|
|
|
2012-03-25 18:55:55 +00:00
|
|
|
|
/* Macro which any plugin can use to output the full_text part (when the output
|
|
|
|
|
* format is JSON) or just output to stdout (any other output format). */
|
2018-07-08 11:59:21 +00:00
|
|
|
|
#define OUTPUT_FULL_TEXT(text) \
|
|
|
|
|
do { \
|
|
|
|
|
/* Terminate the output buffer here in any case, so that it’s \
|
|
|
|
|
* not forgotten in the module */ \
|
|
|
|
|
*outwalk = '\0'; \
|
|
|
|
|
if (output_format == O_I3BAR) { \
|
|
|
|
|
char *_markup = cfg_getstr(cfg_general, "markup"); \
|
|
|
|
|
yajl_gen_string(json_gen, (const unsigned char *)"markup", strlen("markup")); \
|
|
|
|
|
yajl_gen_string(json_gen, (const unsigned char *)_markup, strlen(_markup)); \
|
|
|
|
|
yajl_gen_string(json_gen, (const unsigned char *)"full_text", strlen("full_text")); \
|
|
|
|
|
yajl_gen_string(json_gen, (const unsigned char *)text, strlen(text)); \
|
|
|
|
|
} else { \
|
|
|
|
|
printf("%s", text); \
|
|
|
|
|
} \
|
2015-03-16 09:00:32 +00:00
|
|
|
|
} while (0)
|
|
|
|
|
|
2018-07-08 11:59:21 +00:00
|
|
|
|
#define SEC_OPEN_MAP(name) \
|
|
|
|
|
do { \
|
|
|
|
|
if (output_format == O_I3BAR) { \
|
|
|
|
|
yajl_gen_map_open(json_gen); \
|
|
|
|
|
yajl_gen_string(json_gen, (const unsigned char *)"name", strlen("name")); \
|
|
|
|
|
yajl_gen_string(json_gen, (const unsigned char *)name, strlen(name)); \
|
|
|
|
|
} \
|
2015-03-16 09:00:32 +00:00
|
|
|
|
} while (0)
|
|
|
|
|
|
2018-07-08 11:59:21 +00:00
|
|
|
|
#define SEC_CLOSE_MAP \
|
|
|
|
|
do { \
|
|
|
|
|
if (output_format == O_I3BAR) { \
|
|
|
|
|
char *_align = cfg_getstr(sec, "align"); \
|
|
|
|
|
if (_align) { \
|
|
|
|
|
yajl_gen_string(json_gen, (const unsigned char *)"align", strlen("align")); \
|
|
|
|
|
yajl_gen_string(json_gen, (const unsigned char *)_align, strlen(_align)); \
|
|
|
|
|
} \
|
|
|
|
|
struct min_width *_width = cfg_getptr(sec, "min_width"); \
|
|
|
|
|
if (_width) { \
|
|
|
|
|
/* if the value can be parsed as a number, we use the numerical value */ \
|
|
|
|
|
if (_width->num > 0) { \
|
|
|
|
|
yajl_gen_string(json_gen, (const unsigned char *)"min_width", strlen("min_width")); \
|
|
|
|
|
yajl_gen_integer(json_gen, _width->num); \
|
|
|
|
|
} else { \
|
|
|
|
|
yajl_gen_string(json_gen, (const unsigned char *)"min_width", strlen("min_width")); \
|
|
|
|
|
yajl_gen_string(json_gen, (const unsigned char *)_width->str, strlen(_width->str)); \
|
|
|
|
|
} \
|
|
|
|
|
} \
|
|
|
|
|
if (cfg_size(sec, "separator") > 0) { \
|
|
|
|
|
yajl_gen_string(json_gen, (const unsigned char *)"separator", strlen("separator")); \
|
|
|
|
|
yajl_gen_bool(json_gen, cfg_getbool(sec, "separator")); \
|
|
|
|
|
} \
|
|
|
|
|
if (cfg_size(sec, "separator_block_width") > 0) { \
|
|
|
|
|
yajl_gen_string(json_gen, (const unsigned char *)"separator_block_width", strlen("separator_block_width")); \
|
|
|
|
|
yajl_gen_integer(json_gen, cfg_getint(sec, "separator_block_width")); \
|
|
|
|
|
} \
|
|
|
|
|
const char *_sep = cfg_getstr(cfg_general, "separator"); \
|
|
|
|
|
if (strlen(_sep) == 0) { \
|
|
|
|
|
yajl_gen_string(json_gen, (const unsigned char *)"separator", strlen("separator")); \
|
|
|
|
|
yajl_gen_bool(json_gen, false); \
|
|
|
|
|
} \
|
|
|
|
|
yajl_gen_map_close(json_gen); \
|
|
|
|
|
} \
|
2015-03-16 09:00:32 +00:00
|
|
|
|
} while (0)
|
|
|
|
|
|
2018-07-08 11:59:21 +00:00
|
|
|
|
#define START_COLOR(colorstr) \
|
|
|
|
|
do { \
|
|
|
|
|
if (cfg_getbool(cfg_general, "colors")) { \
|
|
|
|
|
const char *_val = NULL; \
|
|
|
|
|
if (cfg_section) \
|
|
|
|
|
_val = cfg_getstr(cfg_section, colorstr); \
|
|
|
|
|
if (!_val) \
|
|
|
|
|
_val = cfg_getstr(cfg_general, colorstr); \
|
|
|
|
|
if (output_format == O_I3BAR) { \
|
|
|
|
|
yajl_gen_string(json_gen, (const unsigned char *)"color", strlen("color")); \
|
|
|
|
|
yajl_gen_string(json_gen, (const unsigned char *)_val, strlen(_val)); \
|
|
|
|
|
} else { \
|
|
|
|
|
outwalk += sprintf(outwalk, "%s", color(colorstr)); \
|
|
|
|
|
} \
|
|
|
|
|
} \
|
2015-03-16 09:00:32 +00:00
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
|
|
#define END_COLOR \
|
|
|
|
|
do { \
|
|
|
|
|
if (cfg_getbool(cfg_general, "colors") && output_format != O_I3BAR) { \
|
|
|
|
|
outwalk += sprintf(outwalk, "%s", endcolor()); \
|
|
|
|
|
} \
|
|
|
|
|
} while (0)
|
|
|
|
|
|
2018-07-08 11:59:21 +00:00
|
|
|
|
#define INSTANCE(instance) \
|
|
|
|
|
do { \
|
|
|
|
|
if (output_format == O_I3BAR) { \
|
|
|
|
|
yajl_gen_string(json_gen, (const unsigned char *)"instance", strlen("instance")); \
|
|
|
|
|
yajl_gen_string(json_gen, (const unsigned char *)instance, strlen(instance)); \
|
|
|
|
|
} \
|
2015-03-16 09:00:32 +00:00
|
|
|
|
} while (0)
|
|
|
|
|
|
2021-11-02 18:40:40 +00:00
|
|
|
|
#define OUTPUT_FORMATTED \
|
|
|
|
|
do { \
|
|
|
|
|
const size_t remaining = ctx->buflen - (outwalk - ctx->buf); \
|
|
|
|
|
strncpy(outwalk, formatted, remaining); \
|
|
|
|
|
outwalk += strlen(formatted); \
|
|
|
|
|
} while (0)
|
|
|
|
|
|
2014-03-05 19:53:07 +00:00
|
|
|
|
/*
|
|
|
|
|
* The "min_width" module option may either be defined as a string or a number.
|
|
|
|
|
*/
|
|
|
|
|
struct min_width {
|
|
|
|
|
long num;
|
|
|
|
|
const char *str;
|
|
|
|
|
};
|
|
|
|
|
|
2009-07-21 17:07:30 +00:00
|
|
|
|
/* src/general.c */
|
|
|
|
|
char *skip_character(char *input, char character, int amount);
|
2018-06-12 07:41:44 +00:00
|
|
|
|
|
|
|
|
|
void die(const char *fmt, ...) __attribute__((format(printf, 1, 2), noreturn));
|
2010-11-28 15:45:34 +00:00
|
|
|
|
bool slurp(const char *filename, char *destination, int size);
|
2020-05-01 10:15:30 +00:00
|
|
|
|
char *resolve_tilde(const char *path);
|
|
|
|
|
void *scalloc(size_t size);
|
|
|
|
|
char *sstrdup(const char *str);
|
2009-07-21 17:07:30 +00:00
|
|
|
|
|
|
|
|
|
/* src/output.c */
|
2014-03-01 10:05:03 +00:00
|
|
|
|
void print_separator(const char *separator);
|
2009-07-21 17:07:30 +00:00
|
|
|
|
char *color(const char *colorstr);
|
2015-03-16 09:00:32 +00:00
|
|
|
|
char *endcolor() __attribute__((pure));
|
2013-05-16 20:49:13 +00:00
|
|
|
|
void reset_cursor(void);
|
2015-10-05 08:10:01 +00:00
|
|
|
|
void maybe_escape_markup(char *text, char **buffer);
|
2011-07-13 01:27:57 +00:00
|
|
|
|
|
2020-02-10 17:52:04 +00:00
|
|
|
|
char *rtrim(const char *s);
|
|
|
|
|
char *ltrim(const char *s);
|
|
|
|
|
char *trim(const char *s);
|
|
|
|
|
|
|
|
|
|
// copied from i3:libi3/format_placeholders.c
|
|
|
|
|
/* src/format_placeholders.c */
|
|
|
|
|
typedef struct {
|
|
|
|
|
/* The placeholder to be replaced, e.g., "%title". */
|
2020-04-30 22:36:38 +00:00
|
|
|
|
const char *name;
|
2020-02-10 17:52:04 +00:00
|
|
|
|
/* The value this placeholder should be replaced with. */
|
2020-04-30 22:36:38 +00:00
|
|
|
|
const char *value;
|
2020-02-10 17:52:04 +00:00
|
|
|
|
} placeholder_t;
|
|
|
|
|
char *format_placeholders(const char *format, placeholder_t *placeholders, int num);
|
|
|
|
|
|
2011-07-13 01:27:57 +00:00
|
|
|
|
/* src/auto_detect_format.c */
|
|
|
|
|
char *auto_detect_format();
|
2009-07-21 17:07:30 +00:00
|
|
|
|
|
2013-01-13 13:18:38 +00:00
|
|
|
|
/* src/print_time.c */
|
2013-02-10 16:19:56 +00:00
|
|
|
|
void set_timezone(const char *tz);
|
2013-01-13 13:18:38 +00:00
|
|
|
|
|
2014-12-07 14:14:02 +00:00
|
|
|
|
/* src/first_network_device.c */
|
|
|
|
|
typedef enum {
|
2015-03-16 09:00:32 +00:00
|
|
|
|
NET_TYPE_WIRELESS = 0,
|
2016-08-22 17:23:59 +00:00
|
|
|
|
NET_TYPE_ETHERNET = 1,
|
|
|
|
|
NET_TYPE_OTHER = 2
|
2014-12-07 14:14:02 +00:00
|
|
|
|
} net_type_t;
|
|
|
|
|
const char *first_eth_interface(const net_type_t type);
|
|
|
|
|
|
2021-11-02 19:23:33 +00:00
|
|
|
|
typedef struct {
|
|
|
|
|
yajl_gen json_gen;
|
|
|
|
|
char *buf;
|
|
|
|
|
const size_t buflen;
|
|
|
|
|
const char *format_up;
|
|
|
|
|
const char *format_down;
|
|
|
|
|
} ipv6_info_ctx_t;
|
|
|
|
|
|
|
|
|
|
void print_ipv6_info(ipv6_info_ctx_t *ctx);
|
|
|
|
|
|
2021-11-02 20:16:25 +00:00
|
|
|
|
typedef struct {
|
|
|
|
|
yajl_gen json_gen;
|
|
|
|
|
char *buf;
|
|
|
|
|
const size_t buflen;
|
|
|
|
|
const char *path;
|
|
|
|
|
const char *format;
|
|
|
|
|
const char *format_below_threshold;
|
|
|
|
|
const char *format_not_mounted;
|
|
|
|
|
const char *prefix_type;
|
|
|
|
|
const char *threshold_type;
|
|
|
|
|
const double low_threshold;
|
|
|
|
|
} disk_info_ctx_t;
|
|
|
|
|
|
|
|
|
|
void print_disk_info(disk_info_ctx_t *ctx);
|
2021-11-02 19:48:50 +00:00
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
yajl_gen json_gen;
|
|
|
|
|
char *buf;
|
|
|
|
|
const size_t buflen;
|
|
|
|
|
int number;
|
|
|
|
|
const char *path;
|
|
|
|
|
const char *format;
|
|
|
|
|
const char *format_down;
|
|
|
|
|
const char *status_chr;
|
|
|
|
|
const char *status_bat;
|
|
|
|
|
const char *status_unk;
|
|
|
|
|
const char *status_full;
|
|
|
|
|
int low_threshold;
|
|
|
|
|
char *threshold_type;
|
|
|
|
|
bool last_full_capacity;
|
|
|
|
|
const char *format_percentage;
|
|
|
|
|
bool hide_seconds;
|
|
|
|
|
} battery_info_ctx_t;
|
|
|
|
|
|
|
|
|
|
void print_battery_info(battery_info_ctx_t *ctx);
|
|
|
|
|
|
2018-11-15 21:27:23 +00:00
|
|
|
|
void print_time(yajl_gen json_gen, char *buffer, const char *title, const char *format, const char *tz, const char *locale, const char *format_time, bool hide_if_equals_localtime, time_t t);
|
2013-01-13 13:18:38 +00:00
|
|
|
|
void print_ddate(yajl_gen json_gen, char *buffer, const char *format, time_t t);
|
2017-12-11 10:38:31 +00:00
|
|
|
|
const char *get_ip_addr(const char *interface, int family);
|
2021-11-02 19:48:50 +00:00
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
yajl_gen json_gen;
|
|
|
|
|
char *buf;
|
|
|
|
|
const size_t buflen;
|
|
|
|
|
const char *interface;
|
|
|
|
|
const char *format_up;
|
|
|
|
|
const char *format_down;
|
|
|
|
|
const char *format_bitrate;
|
|
|
|
|
const char *format_noise;
|
|
|
|
|
const char *format_quality;
|
|
|
|
|
const char *format_signal;
|
|
|
|
|
} wireless_info_ctx_t;
|
|
|
|
|
|
|
|
|
|
void print_wireless_info(wireless_info_ctx_t *ctx);
|
|
|
|
|
|
2021-11-02 19:53:06 +00:00
|
|
|
|
typedef struct {
|
|
|
|
|
yajl_gen json_gen;
|
|
|
|
|
char *buf;
|
|
|
|
|
const size_t buflen;
|
|
|
|
|
const char *title;
|
|
|
|
|
const char *pidfile;
|
|
|
|
|
const char *format;
|
|
|
|
|
const char *format_down;
|
|
|
|
|
} run_watch_ctx_t;
|
|
|
|
|
|
|
|
|
|
void print_run_watch(run_watch_ctx_t *ctx);
|
|
|
|
|
|
2021-11-02 20:05:52 +00:00
|
|
|
|
typedef struct {
|
|
|
|
|
yajl_gen json_gen;
|
|
|
|
|
char *buf;
|
|
|
|
|
const size_t buflen;
|
|
|
|
|
const char *title;
|
|
|
|
|
const char *path;
|
|
|
|
|
const char *format;
|
|
|
|
|
const char *format_down;
|
|
|
|
|
} path_exists_ctx_t;
|
|
|
|
|
|
|
|
|
|
void print_path_exists(path_exists_ctx_t *ctx);
|
|
|
|
|
|
2016-11-14 20:10:19 +00:00
|
|
|
|
void print_cpu_temperature_info(yajl_gen json_gen, char *buffer, int zone, const char *path, const char *format, const char *format_above_threshold, int);
|
2021-11-02 20:20:26 +00:00
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
yajl_gen json_gen;
|
|
|
|
|
char *buf;
|
|
|
|
|
const size_t buflen;
|
|
|
|
|
const char *format;
|
|
|
|
|
const char *format_above_threshold;
|
|
|
|
|
const char *format_above_degraded_threshold;
|
|
|
|
|
const char *path;
|
|
|
|
|
const float max_threshold;
|
|
|
|
|
const float degraded_threshold;
|
|
|
|
|
} cpu_usage_ctx_t;
|
|
|
|
|
|
|
|
|
|
void print_cpu_usage(cpu_usage_ctx_t *ctx);
|
2021-11-02 19:29:00 +00:00
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
yajl_gen json_gen;
|
|
|
|
|
char *buf;
|
|
|
|
|
const size_t buflen;
|
|
|
|
|
const char *interface;
|
|
|
|
|
const char *format_up;
|
|
|
|
|
const char *format_down;
|
|
|
|
|
} eth_info_ctx_t;
|
|
|
|
|
|
|
|
|
|
void print_eth_info(eth_info_ctx_t *ctx);
|
|
|
|
|
|
2021-11-02 20:25:15 +00:00
|
|
|
|
typedef struct {
|
|
|
|
|
yajl_gen json_gen;
|
|
|
|
|
char *buf;
|
|
|
|
|
const size_t buflen;
|
|
|
|
|
const char *format;
|
|
|
|
|
const char *format_above_threshold;
|
|
|
|
|
const float max_threshold;
|
|
|
|
|
} load_ctx_t;
|
|
|
|
|
|
|
|
|
|
void print_load(load_ctx_t *ctx);
|
|
|
|
|
|
2021-11-02 20:30:22 +00:00
|
|
|
|
typedef struct {
|
|
|
|
|
yajl_gen json_gen;
|
|
|
|
|
char *buf;
|
|
|
|
|
const size_t buflen;
|
|
|
|
|
const char *format;
|
|
|
|
|
const char *format_degraded;
|
|
|
|
|
const char *threshold_degraded;
|
|
|
|
|
const char *threshold_critical;
|
|
|
|
|
const char *memory_used_method;
|
|
|
|
|
const char *unit;
|
|
|
|
|
const int decimals;
|
|
|
|
|
} memory_ctx_t;
|
|
|
|
|
|
|
|
|
|
void print_memory(memory_ctx_t *ctx);
|
2021-11-02 20:11:06 +00:00
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
yajl_gen json_gen;
|
|
|
|
|
char *buf;
|
|
|
|
|
const size_t buflen;
|
|
|
|
|
const char *fmt;
|
|
|
|
|
const char *fmt_muted;
|
|
|
|
|
const char *device;
|
|
|
|
|
const char *mixer;
|
|
|
|
|
int mixer_idx;
|
|
|
|
|
} volume_ctx_t;
|
|
|
|
|
|
|
|
|
|
void print_volume(volume_ctx_t *ctx);
|
|
|
|
|
|
2009-07-21 17:07:30 +00:00
|
|
|
|
bool process_runs(const char *path);
|
2016-09-14 07:26:45 +00:00
|
|
|
|
int volume_pulseaudio(uint32_t sink_idx, const char *sink_name);
|
2019-01-23 07:45:51 +00:00
|
|
|
|
bool description_pulseaudio(uint32_t sink_idx, const char *sink_name, char buffer[MAX_SINK_DESCRIPTION_LEN]);
|
2015-03-11 16:29:32 +00:00
|
|
|
|
bool pulse_initialize(void);
|
2021-11-02 18:40:40 +00:00
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
yajl_gen json_gen;
|
|
|
|
|
char *buf;
|
2021-11-02 19:23:33 +00:00
|
|
|
|
const size_t buflen;
|
2021-11-02 18:40:40 +00:00
|
|
|
|
const char *title;
|
|
|
|
|
const char *path;
|
|
|
|
|
const char *format;
|
|
|
|
|
const char *format_bad;
|
|
|
|
|
const int max_chars;
|
|
|
|
|
} file_contents_ctx_t;
|
|
|
|
|
|
|
|
|
|
void print_file_contents(file_contents_ctx_t *ctx);
|
2009-07-21 17:07:30 +00:00
|
|
|
|
|
|
|
|
|
/* socket file descriptor for general purposes */
|
|
|
|
|
extern int general_socket;
|
|
|
|
|
|
2012-10-18 20:55:41 +00:00
|
|
|
|
extern cfg_t *cfg, *cfg_general, *cfg_section;
|
2009-07-21 17:07:30 +00:00
|
|
|
|
|
2014-12-07 20:32:19 +00:00
|
|
|
|
extern void **cur_instance;
|
|
|
|
|
|
2016-01-12 13:35:02 +00:00
|
|
|
|
extern pthread_t main_thread;
|
2009-07-21 17:07:30 +00:00
|
|
|
|
#endif
|