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