summaryrefslogtreecommitdiff
path: root/components/battery.c
diff options
context:
space:
mode:
authorAaron Marcher <me@drkhsh.at>2018-05-19 13:25:35 +0200
committerAaron Marcher <me@drkhsh.at>2018-05-19 13:25:35 +0200
commit74891945d897530b30c2c29844808d63bff625b7 (patch)
tree0a4a8f1ff82390d46f5c4aa2494078ee805614d7 /components/battery.c
parent06d4447f03669b72a885a997b666e4cbcc6b5ed1 (diff)
Revert aac29e2 as it is nonsense
Diffstat (limited to 'components/battery.c')
-rw-r--r--components/battery.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/components/battery.c b/components/battery.c
index b086a28..90e8590 100644
--- a/components/battery.c
+++ b/components/battery.c
@@ -5,14 +5,6 @@
#include "../util.h"
-static struct {
- char *state;
- char *symbol;
-} map[] = {
- { "Charging", "+" },
- { "Discharging", "-" },
-};
-
#if defined(__linux__)
#include <limits.h>
@@ -30,6 +22,13 @@ static struct {
const char *
battery_state(const char *bat)
{
+ static struct {
+ char *state;
+ char *symbol;
+ } map[] = {
+ { "Charging", "+" },
+ { "Discharging", "-" },
+ };
size_t i;
char path[PATH_MAX], state[12];
@@ -122,6 +121,13 @@ static struct {
const char *
battery_state(const char *unused)
{
+ struct {
+ unsigned int state;
+ char *symbol;
+ } map[] = {
+ { APM_AC_ON, "+" },
+ { APM_AC_OFF, "-" },
+ };
struct apm_power_info apm_info;
size_t i;