]> Dogcows Code - chaz/tint2/blob - src/battery/battery.h
add comment
[chaz/tint2] / src / battery / battery.h
1 /**************************************************************************
2 * Copyright (C) 2009 Sebastian Reichel <elektranox@gmail.com>
3 *
4 * Battery with functional data (percentage, time to life) and drawing data
5 * (area, font, ...). Each panel use his own drawing data.
6 * Need kernel > 2.6.23.
7 *
8 **************************************************************************/
9
10 #ifndef BATTERY_H
11 #define BATTERY_H
12
13 #include <sys/types.h>
14 #include <sys/stat.h>
15 #include <fcntl.h>
16
17 #include "common.h"
18 #include "area.h"
19
20
21 // battery drawing parameter (per panel)
22 typedef struct Battery {
23 // always start with area
24 Area area;
25
26 Color font;
27 int bat1_posy;
28 int bat2_posy;
29 } Battery;
30
31 enum chargestate {
32 BATTERY_UNKNOWN,
33 BATTERY_CHARGING,
34 BATTERY_DISCHARGING,
35 BATTERY_FULL
36 };
37
38 typedef struct battime {
39 int16_t hours;
40 int8_t minutes;
41 int8_t seconds;
42 } battime;
43
44 typedef struct batstate {
45 int percentage;
46 struct battime time;
47 enum chargestate state;
48 } batstate;
49
50 extern struct batstate battery_state;
51 extern PangoFontDescription *bat1_font_desc;
52 extern PangoFontDescription *bat2_font_desc;
53 extern int battery_enabled;
54 extern int percentage_hide;
55
56 extern int8_t battery_low_status;
57 extern char *battery_low_cmd;
58 extern char *path_energy_now, *path_energy_full, *path_current_now, *path_status;
59
60 // default global data
61 void default_battery();
62
63 // freed memory
64 void cleanup_battery();
65
66 // initialize clock : y position, ...
67 void update_battery();
68
69 void init_battery();
70 void init_battery_panel(void *panel);
71
72 void draw_battery(void *obj, cairo_t *c);
73
74 int resize_battery(void *obj);
75
76 #endif
This page took 0.033841 seconds and 4 git commands to generate.