Carlin Bingham [Mon, 12 Feb 2018 13:12:04 +0000 (02:12 +1300)]
OpenBSD: fix volume display on some hardware
On some hardware the AUDIO_MIXER_READ ioctl requires the current number
of channels to be set, and the mute device found needs to be checked if
it belongs to the master output device.
johcgt [Sun, 28 Jan 2018 14:37:51 +0000 (14:37 +0000)]
Treat zero battery capacity as "not available" (#259)
`print_battery_info` computes `batt_info.percentage_remaining` by
dividing batt_info.remaining by `full`. If `full` is `0` then the
battery remaining will be reported as "inf".
Before this, it tries to set `full` to either the design capacity or to
the last known good charge. It determines if these values are available
by checking whether their fields in `batt_info` are non-negative. As it
initialized `batt_info` with values of `-1`, a non-negative value
implies that something has provided a value.
`slurp_all_batteries` and `add_battery_info` however initialize these
fields to zero, so if these functions are called then
`batt_info.full_design` will always be used.
This means that on systems that don't provide a value for design
capacity the percentage remaining will be reported as "inf", unless the
user has set `last_full_capacity` to `true` in their `i3status.conf`.
This patch changes `print_battery_info` to expect values for the battery
capacity to be strictly greater than zero. This seems reasonable as a
battery with a capacity of zero isn't useful.
An alternative solution would be to change `slurp_all_batteries` and
`add_battery_info` to initialize `batt_info` with `-1`, as
`print_battery_info` does. This is less appealing as `add_battery_info`
is accumulating the values, so using `-1` would introduce off-by-one
errors without additional code to avoid them.
GuyOfThePery [Sat, 9 Dec 2017 11:24:11 +0000 (13:24 +0200)]
Fixed minor typos
"you can chose" -> "you can choose"
"You can either disable the default separator altogether setting it to the empty string." -> " You can also disable the default separator altogether by setting it to the empty string."
The orignal proposed code had a memory leak when returning true.
Furthermore I included the handy BEGINS_WITH macro of i3 which makes the
code (IMHO) a lot more readable.
The _first_ option for ethernet devices now uses the link in sysfs to determine
if it's a real device or just a virtual one (i.e veth** devices created by docker).
eplanet [Sun, 26 Mar 2017 10:54:07 +0000 (12:54 +0200)]
Multiple CPU support for cpu_usage (#209)
This change addresses the issue #199 asking for multiple CPU support. It
takes an arbitrary CPU number and outputs its usage using the same
arithmetics as for CPU aggregation. It currently doesn't support
FreeBSD.
Fixes a compilation error:
/usr/include/net80211/ieee80211_ioctl.h:339: warning: implicit declaration of function 'howmany'
/usr/include/net80211/ieee80211_ioctl.h:339: error: 'NBBY' undeclared here (not in a function)
/usr/include/net80211/ieee80211_ioctl.h:339: error: variably modified 'nr_rxmcs' at file scope
Tommie Gannert [Mon, 1 Aug 2016 17:03:03 +0000 (18:03 +0100)]
Implement aggregates for batteries.
Using title number all, this enables aggregates. Note that FreeBSD and
OpenBSD previously only reported aggregates, so this is bringing Linux
and NetBSD that functionality.
Changes the default battery reporting to the aggregate since most
users probably don't care about individual batteries. For single-battery
systems there should be no change.
Cihangir Akturk [Mon, 22 Aug 2016 17:23:59 +0000 (20:23 +0300)]
Parse uevent file to detect network device type (#153)
Currently i3status differentiates wireless and wired devices based
on the existence of wireless directory inside the device's sysfs
directory. This approach seems to cause 3g modems to be incorrectly
identified as the first ethernet device.
This commit solves this problem by using DEVTYPE variable from
uevent file.
VPN was removed because it pointed to vpnc, which hasn’t been updated
since 2008 and is long obsolete in favor of openconnect. Since different
people use different VPN solutions, though (and other modules configured
by default do actually work regardless of the system), let’s remove this
and have people who need it configure it explicitly.
DHCP was removed because modern systems often don’t use dhclient anymore
(but rather systemd-networkd’s DHCP client, which can also be used via
NetworkManager these days) and because it fails our philosophy test:
it’s not something which you would look at every now and then if
i3status didn’t expose it.
eplanet [Tue, 16 Aug 2016 07:29:08 +0000 (09:29 +0200)]
Print empty string for not mounted disks. (#148)
An empty string becomes the default value for format_not_mounted parameter
for any disk entry. This avoids printing erroneous values when a
filesystem is not mounted.
tommie [Mon, 15 Aug 2016 06:52:20 +0000 (07:52 +0100)]
Move time and ratio computations out of slurp_battery_info. (#151)
This allows OSes that support reporting multiple batteries to simply
sum into full_design,full_last,remaining and let print_battery_info
make computations.
Tommie Gannert [Mon, 1 Aug 2016 19:28:16 +0000 (20:28 +0100)]
Simplify string comparisons in slurp_battery_info for NetBSD.
Doing strlen(a) == strlen(b) && strncmp(a, b, N) seems to have no
benefits compared to just strcmp(a, b). The NetBSD cstring properties
come from the kernel, not the user.
The test for units did a prefix match, but that looked like a bug, the
unit is "Watt hour" in my Virtual box.
Tommie Gannert [Mon, 1 Aug 2016 00:00:31 +0000 (01:00 +0100)]
Remove emptytimebuf from print_battery_info.
This changes the behavior for NetBSD: previously this time was not
shown while charging. On Linux it was treated as "full time". This
change makes all OSes behave the same.
OpenBSD and FreeBSD did not support emptytime previously.