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