]> git.sur5r.net Git - i3/i3status/blob - i3status.h
73221a50c9fba114c1ddee6af7da795f9df008fc
[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__)
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 typedef enum { CS_DISCHARGING, CS_CHARGING, CS_FULL } charging_status_t;
41 enum { ORDER_RUN, ORDER_WLAN, ORDER_ETH, ORDER_BATTERY, ORDER_CPU_TEMPERATURE, ORDER_LOAD, ORDER_TIME, ORDER_IPV6, MAX_ORDER };
42
43 struct battery {
44         char *path;
45         /* Use last full capacity instead of design capacity */
46         bool use_last_full;
47         SIMPLEQ_ENTRY(battery) batteries;
48 };
49
50 /* src/general.c */
51 char *skip_character(char *input, char character, int amount);
52 void die(const char *fmt, ...);
53 void create_file(const char *name);
54 char *order_to_str(int number, char *name);
55 void setup(void);
56 void write_to_statusbar(const char *name, const char *message, bool final_entry);
57 bool slurp(char *filename, char *destination, int size);
58
59 /* src/output.c */
60 void write_error_to_statusbar(const char *message);
61 char *color(const char *colorstr);
62 char *endcolor() __attribute__ ((pure));
63 void cleanup_rbar_dir();
64
65 /* src/config.c */
66 int load_configuration(const char *configfile);
67
68 const char *get_ipv6_addr();
69 const char *get_battery_info(struct battery *bat);
70 const char *get_ip_addr();
71 const char *get_wireless_info();
72 const char *get_cpu_temperature_info();
73 const char *get_eth_info();
74 const char *get_load();
75 bool process_runs(const char *path);
76
77 SIMPLEQ_HEAD(battery_head, battery);
78 extern struct battery_head batteries;
79
80 /* socket file descriptor for general purposes */
81 extern int general_socket;
82
83 extern int highest_order;
84
85 extern const char *wlan_interface;
86 extern const char *eth_interface;
87 extern const char *wmii_path;
88 extern const char *time_format;
89 extern bool use_colors;
90 extern bool get_ethspeed;
91 extern bool get_ipv6;
92 extern bool get_cpu_temperature;
93 extern char *thermal_zone;
94 extern const char *wmii_normcolors;
95 extern int order[MAX_ORDER];
96 extern const char **run_watches;
97 extern unsigned int num_run_watches;
98 extern unsigned int interval;
99
100 #endif