thide battery string entirely - spoon - [fork] customized build of spoon, the dwm status utility
 (HTM) git clone git://src.adamsgaard.dk/spoon
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) LICENSE
       ---
 (DIR) commit 4619eab788eeec77c9eae7d7b5abf248f724c3de
 (DIR) parent 694c695730115e84ad356c805bc3bbc32f49cf8b
 (HTM) Author: Anders Damsgaard <anders@adamsgaard.dk>
       Date:   Fri,  8 Jan 2021 18:26:23 +0100
       
       hide battery string entirely
       
       Diffstat:
         M batt.c                              |       8 +++++---
         M config.h                            |       2 +-
       
       2 files changed, 6 insertions(+), 4 deletions(-)
       ---
 (DIR) diff --git a/batt.c b/batt.c
       t@@ -17,9 +17,9 @@ battprint(char *buf, size_t len, int acon, int life, int remain)
        
                c = acon ? '=' : ' ';
                if (c == ' ' && remain != 0)
       -                snprintf(buf, len, "%d%% %d:%02d", life, remain/60, remain%60);
       +                snprintf(buf, len, "%d%% %d:%02d |", life, remain/60, remain%60);
                else
       -                snprintf(buf, len, "%d%%", life);
       +                snprintf(buf, len, " %d%% |", life);
        
        }
        
       t@@ -50,7 +50,9 @@ battread(void *arg, char *buf, size_t len)
                }
                close(fd);
        
       -        if (info.battery_state != APM_BATTERY_ABSENT)
       +        if (info.battery_state == APM_BATTERY_ABSENT)
       +                snprintf(buf, len, "");
       +        else
                        battprint(buf, len, info.ac_state == APM_AC_ON,
                                  info.battery_life, info.minutes_left);
                return 0;
 (DIR) diff --git a/config.h b/config.h
       t@@ -15,7 +15,7 @@ struct ent ents[] = {
                /*{ .fmt = "[%s] ",        .read = cpuread,        .arg = "/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq" },*/
                { .fmt = " %s°C",        .read = tempread,        .arg = "/sys/class/hwmon/hwmon1/temp1_input" },
                { .fmt = " %s "SEP,        .read = loadread,        .arg = NULL },
       -        { .fmt = " %s "SEP,                .read = battread,        .arg = &(struct battarg){ .cap = "/sys/class/power_supply/BAT0/capacity", .ac = "/sys/class/power_supply/AC/online" } },
       +        { .fmt = "%s",                .read = battread,        .arg = &(struct battarg){ .cap = "/sys/class/power_supply/BAT0/capacity", .ac = "/sys/class/power_supply/AC/online" } },
                /*{ .fmt = "%s ",                .read = fileread,        .arg = "/etc/myname" },*/
                { .fmt = " %s "SEP,                .read = wifiread,        .arg = NULL },
                { .fmt = " %s",                .read = dateread,        .arg = &(struct datearg){ .fmt = "%Y-%m-%d %a %H:%M:%S %Z", .tz = NULL } },