+2018-05-11 i3status 2.12
+
+ • fix NULL value on OpenBSD when there is no acpitz0
+ • show IP address when address has a label
+ • man: explicitly use format_up/format_down in ethernet, wireless conf
+ • man: remove SLOC comment
+ • treat zero battery capacity as "not available"
+ • add IPv6 address when IPv4 isn't available
+ • call tzset at each time print to pick up time zone changes
+ • doc: fixed minor typos
+ • be more cautious about handling invalid battery measurements.
+ • Makefile: make PKG_CONFIG overridable
+ • fix CPU unit tests
+ • use local timezone for battery %emptytime
+ • fix memory leak/use BEGINS_WITH macro
+ • _first_: add check for virtual ethernet devices
+ • add battery capacity parsing
+ • multiple CPU support for cpu_usage
+ • remove useless checks (we use char, not unsigned char) to fix compilation warnings
+ • disk: sanitize trailing slashes
+ • plug an fd leak in the OpenBSD-specific code for
+ • suppress printing :00 seconds of remaining battery lifetime, as apm(4)'s
+ estimate only has a granularity of minutes.
+ • fix the deciKelvin to Celsius conversion on FreeBSD
+ • make first_eth_interface() work on OpenBSD
+ • include sys/select.h on OpenBSD
+
2017-01-21 i3status 2.11
• re-add forgotten wakeup call from SIGUSR1 handler
-2.11-non-git
+2.12-non-git
<refentrytitle>{mantitle}</refentrytitle>
<manvolnum>{manvolnum}</manvolnum>
<refmiscinfo class="source">i3status</refmiscinfo>
-<refmiscinfo class="version">v2.11</refmiscinfo>
+<refmiscinfo class="version">v2.12</refmiscinfo>
<refmiscinfo class="manual">i3 Manual</refmiscinfo>
</refmeta>
<refnamediv>
i3status(1)
===========
Michael Stapelberg <michael@i3wm.org>
-v2.11, January 2017
+v2.12, May 2018
== NAME
*Example order*: +wireless wlan0+
-*Example format*: +W: (%quality at %essid, %bitrate / %frequency) %ip+
+*Example format_up*: +W: (%quality at %essid, %bitrate / %frequency) %ip+
+
+*Example format_down*: +W: down+
=== Ethernet
*Example order*: +ethernet eth0+
-*Example format*: +E: %ip (%speed)+
+*Example format_up*: +E: %ip (%speed)+
+
+*Example format_down*: +E: down+
=== Battery
#include "i3status.h"
-#ifdef __linux__
-#define LOOPBACK_DEV "lo"
-#else
+#ifdef __OpenBSD__
#define LOOPBACK_DEV "lo0"
+#else
+#define LOOPBACK_DEV "lo"
#endif
static bool sysfs_devtype(char *dest, size_t n, const char *ifnam) {
}
static net_type_t iface_type(const char *ifname) {
-#ifdef __linux__
- char devtype[32];
-
- if (!sysfs_devtype(devtype, sizeof(devtype), ifname))
- return NET_TYPE_OTHER;
-
- /* Default to Ethernet when no devtype is available */
- if (!devtype[0])
- return NET_TYPE_ETHERNET;
-
- if (strcmp(devtype, "wlan") == 0)
- return NET_TYPE_WIRELESS;
-
- if (strcmp(devtype, "wwan") == 0)
- return NET_TYPE_OTHER;
-
- return NET_TYPE_OTHER;
-#elif __OpenBSD__
+#ifdef __OpenBSD__
/*
*First determine if the device is a wireless device by trying two ioctl(2)
* commands against it. If either succeeds we can be sure it's a wireless
return NET_TYPE_ETHERNET;
}
#else
-#error Missing implementation to determine interface type.
+ char devtype[32];
+
+ if (!sysfs_devtype(devtype, sizeof(devtype), ifname))
+ return NET_TYPE_OTHER;
+
+ /* Default to Ethernet when no devtype is available */
+ if (!devtype[0])
+ return NET_TYPE_ETHERNET;
+
+ if (strcmp(devtype, "wlan") == 0)
+ return NET_TYPE_WIRELESS;
+
+ if (strcmp(devtype, "wwan") == 0)
+ return NET_TYPE_OTHER;
+
+ return NET_TYPE_OTHER;
#endif
+ return NET_TYPE_OTHER;
}
const char *first_eth_interface(const net_type_t type) {
/* 'path' is the node within the full path (defaults to acpitz0). */
if (BEGINS_WITH(sensordev.xname, thermal_zone)) {
mib[3] = SENSOR_TEMP;
- /* Limit to temo0, but should retrieve from a full path... */
+ /* Limit to temp0, but should retrieve from a full path... */
for (numt = 0; numt < 1 /*sensordev.maxnumt[SENSOR_TEMP]*/; numt++) {
mib[4] = numt;
if (sysctl(mib, 5, &sensor, &slen, NULL, 0) == -1) {
/*
* Reads the CPU temperature from /sys/class/thermal/thermal_zone%d/temp (or
- * the user provided path) and returns the temperature in degree celcius.
+ * the user provided path) and returns the temperature in degree celsius.
*
*/
void print_cpu_temperature_info(yajl_gen json_gen, char *buffer, int zone, const char *path, const char *format, const char *format_above_threshold, int max_threshold) {
bool colorful_output = false;
char *thermal_zone;
temperature_t temperature;
+ temperature.raw_value = 0;
+ sprintf(temperature.formatted_value, "%.2f", 0.0);
if (path == NULL)
asprintf(&thermal_zone, THERMAL_ZONE, zone);
struct ifaddrs *ifaddr, *addrp;
bool found = false;
+ int interface_len = strlen(interface);
getifaddrs(&ifaddr);
for (addrp = ifaddr;
(addrp != NULL &&
- (strcmp(addrp->ifa_name, interface) != 0 ||
+ (strncmp(addrp->ifa_name, interface, interface_len) != 0 ||
addrp->ifa_addr == NULL ||
addrp->ifa_addr->sa_family != family));
addrp = addrp->ifa_next) {
/* Check if the interface is down */
- if (strcmp(addrp->ifa_name, interface) != 0)
+ if (strncmp(addrp->ifa_name, interface, interface_len) != 0)
continue;
found = true;
if ((addrp->ifa_flags & IFF_RUNNING) == 0) {
#endif
#ifdef __APPLE__
+#include <sys/socket.h>
#define IW_ESSID_MAX_SIZE 32
#endif