]> git.sur5r.net Git - i3/i3status/blob - i3status.h
Update debian packaging
[i3/i3status] / i3status.h
1 #ifndef _I3STATUS_H
2 #define _I3STATUS_H
3
4 #if !defined(DZEN) && !defined(XMOBAR)
5         #error "You have to enable either -DDZEN or -DXMOBAR"
6 #endif
7
8 #include <stdbool.h>
9 #include <confuse.h>
10
11 #ifdef DZEN
12         #define BAR "^fg(#333333)^p(5;-2)^ro(2)^p()^fg()^p(5)"
13 #elif XMOBAR
14         #define BAR "<fc=#333333> | </fc>"
15 #endif
16 #define BEGINS_WITH(haystack, needle) (strncmp(haystack, needle, strlen(needle)) == 0)
17 #define max(a, b) ((a) > (b) ? (a) : (b))
18
19 #if defined(LINUX)
20
21 #define THERMAL_ZONE "/sys/class/thermal/thermal_zone%d/temp"
22
23 #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
24
25 #define THERMAL_ZONE "hw.acpi.thermal.tz%d.temperature"
26 #define BATT_LIFE "hw.acpi.battery.life"
27 #define BATT_TIME "hw.acpi.battery.time"
28 #define BATT_STATE "hw.acpi.battery.state"
29
30 #endif
31
32 #if defined(__FreeBSD_kernel__) && defined(__GLIBC__)
33
34 #include <sys/stat.h>
35 #include <sys/param.h>
36
37 #endif
38
39 /* Allows for the definition of a variable without opening a new scope, thus
40  * suited for usage in a macro. Idea from wmii. */
41 #define with(type, var, init) \
42         for (type var = (type)-1; (var == (type)-1) && ((var=(init)) || 1); )
43
44 #define CASE_SEC(name) \
45         if (BEGINS_WITH(current, name)) \
46                 with(cfg_t *, sec, cfg_getsec(cfg, name)) \
47                         if (sec != NULL)
48
49 #define CASE_SEC_TITLE(name) \
50         if (BEGINS_WITH(current, name)) \
51                 with(const char *, title, current + strlen(name) + 1) \
52                         with(cfg_t *, sec, cfg_gettsec(cfg, name, title)) \
53                                 if (sec != NULL)
54
55
56 typedef enum { CS_DISCHARGING, CS_CHARGING, CS_FULL } charging_status_t;
57
58 /* src/general.c */
59 char *skip_character(char *input, char character, int amount);
60 void die(const char *fmt, ...);
61 bool slurp(char *filename, char *destination, int size);
62
63 /* src/output.c */
64 void print_seperator();
65 char *color(const char *colorstr);
66 char *endcolor() __attribute__ ((pure));
67
68 void print_ipv6_info(const char *format);
69 void print_disk_info(const char *path, const char *format);
70 void print_battery_info(int number, const char *format, bool last_full_capacity);
71 void print_time(const char *format);
72 const char *get_ip_addr();
73 void print_wireless_info(const char *interface, const char *format_up, const char *format_down);
74 void print_run_watch(const char *title, const char *pidfile, const char *format);
75 void print_cpu_temperature_info(int zone, const char *format);
76 void print_eth_info(const char *interface, const char *format_up, const char *format_down);
77 void print_load();
78 bool process_runs(const char *path);
79
80 /* socket file descriptor for general purposes */
81 extern int general_socket;
82
83 extern cfg_t *cfg, *cfg_general;
84
85 #endif