]> git.sur5r.net Git - i3/i3status/blob - i3status.h
Fix compilation warning
[i3/i3status] / i3status.h
1 #ifndef _I3STATUS_H
2 #define _I3STATUS_H
3
4 #include <stdbool.h>
5
6 #include "queue.h"
7
8 #ifdef DZEN
9         #define BAR "^fg(#333333)^p(5;-2)^ro(2)^p()^fg()^p(5)"
10 #elif XMOBAR
11         #define BAR "<fc=#333333> | </fc>"
12 #endif
13 #define BEGINS_WITH(haystack, needle) (strncmp(haystack, needle, strlen(needle)) == 0)
14 #define max(a, b) (a > b ? a : b)
15
16 #define generate(orderidx, name, function) \
17         do { \
18                 write_to_statusbar(order_to_str(order[orderidx], name), function, (j == (highest_order-1))); \
19         } while (0)
20
21 #define generate_order(condition, orderidx, name, function) \
22         do { \
23                 if (j == order[orderidx] && condition) \
24                         generate(orderidx, name, function); \
25         } while (0)
26
27 #if defined(LINUX)
28
29 #define THERMAL_ZONE "/sys/class/thermal/thermal_zone%d/temp"
30
31 #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
32
33 #define THERMAL_ZONE "hw.acpi.thermal.tz%d.temperature"
34 #define BATT_LIFE "hw.acpi.battery.life"
35 #define BATT_TIME "hw.acpi.battery.time"
36 #define BATT_STATE "hw.acpi.battery.state"
37
38 #endif
39
40 #if defined(__FreeBSD_kernel__) && defined(__GLIBC__)
41
42 #include <sys/stat.h>
43 #include <sys/param.h>
44
45 #endif
46
47 typedef enum { CS_DISCHARGING, CS_CHARGING, CS_FULL } charging_status_t;
48 enum { ORDER_RUN, ORDER_WLAN, ORDER_ETH, ORDER_BATTERY, ORDER_CPU_TEMPERATURE, ORDER_LOAD, ORDER_TIME, ORDER_IPV6, MAX_ORDER };
49
50 struct battery {
51         char *path;
52         /* Use last full capacity instead of design capacity */
53         bool use_last_full;
54         SIMPLEQ_ENTRY(battery) batteries;
55 };
56
57 /* src/general.c */
58 char *skip_character(char *input, char character, int amount);
59 void die(const char *fmt, ...);
60 void create_file(const char *name);
61 char *order_to_str(int number, char *name);
62 void setup(void);
63 void write_to_statusbar(const char *name, const char *message, bool final_entry);
64 bool slurp(char *filename, char *destination, int size);
65
66 /* src/output.c */
67 void write_error_to_statusbar(const char *message);
68 char *color(const char *colorstr);
69 char *endcolor() __attribute__ ((pure));
70 void cleanup_rbar_dir();
71
72 /* src/config.c */
73 int load_configuration(const char *configfile);
74
75 const char *get_ipv6_addr();
76 const char *get_battery_info(struct battery *bat);
77 const char *get_ip_addr();
78 const char *get_wireless_info();
79 const char *get_cpu_temperature_info();
80 const char *get_eth_info();
81 const char *get_load();
82 bool process_runs(const char *path);
83
84 SIMPLEQ_HEAD(battery_head, battery);
85 extern struct battery_head batteries;
86
87 /* socket file descriptor for general purposes */
88 extern int general_socket;
89
90 extern int highest_order;
91
92 extern const char *wlan_interface;
93 extern const char *eth_interface;
94 extern char *wmii_path;
95 extern const char *time_format;
96 extern bool use_colors;
97 extern bool get_ethspeed;
98 extern bool get_ipv6;
99 extern bool get_cpu_temperature;
100 extern char *thermal_zone;
101 extern const char *wmii_normcolors;
102 extern int order[MAX_ORDER];
103 extern const char **run_watches;
104 extern unsigned int num_run_watches;
105 extern unsigned int interval;
106
107 #endif