1/* See LICENSE for license details. */ 2 3/* Delay (in seconds) used between updates of the status text. */ 4static const int delay = 5; 5 6/* Separator to use between different status function outputs. */ 7static const char *statsep = " | "; 8 9/* Format to use in the curtime function for the current time. */10static const char *timefmt = "%a %d %b -- %H:%M:%S";1112/* Path to power supply battery file in /sys. */13static const char *sysbat = "/sys/class/power_supply/BAT0";1415/* Path to control file for current charge. */16static const char *syscur = "charge_now";1718/* Path to control file for full charge. */19static const char *sysfull = "charge_full_design";2021/* Sound card to use for alsa output. */22static const unsigned int sndcrd = 0;2324/* Name of the control channel to use for alsa output. */25static const char* swtchname = "Master Playback Switch";26static const char* volumname = "Master Playback Volume";2728/* Only use batcap function if the device has a battery. */29static size_t batcapmay(char *dest, size_t n) {30 size_t ret;31 static int hasbat = -1;3233 if (hasbat == -1) {34 if (access(sysbat, F_OK)) {35 hasbat = 0;36 return 0;37 }38 hasbat = 1;39 } else if (!hasbat) {40 return 0;41 }4243 ret = batcap(dest, n);44 if (ret)45 ret += separator(&dest[ret], n - ret);4647 return ret;48}4950/* Array of functions to use in the status bar text. */51static size_t (* const sfuncs[])(char*, size_t) = {52 batcapmay,53 alsavol,54 separator,55 loadavg,56 separator,57 curtime,58};