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