John Baldwin [Tue, 15 Sep 2015 20:39:01 +0000 (13:39 -0700)]
Fix various issues with wireless information under FreeBSD:
- Instead of hoping that the currently associated AP will show up as
the first AP in the list of scan results, fetch the BSSID of the
currently associated AP and use that to fetch station info for the
AP. This provides more frequently updated signal strength
information than scan results and reliably provides information when
multiple APs are in range.
- Do not treat the RSSI value as a raw signal value in dBm. Instead, use
the same formula as ifconfig(8) to compute a signal value.
- Do not report the beacon interval value as a signal quality level.
John Baldwin [Tue, 15 Sep 2015 17:48:16 +0000 (10:48 -0700)]
Fix some issues with displaying Ethernet media status on recent FreeBSD kernels.
- Don't apply IFM_SUBTYPE to the raw subtype in the description table.
IFM_SUBTYPE() requires a fully populated word and was truncating values
in the table when comparing resulting in false matches (notably
"10GBase-KX4" for the no media case) after recent changes to add extended
Ethernet media states in FreeBSD.
- Explicitly check for IFM_ETHER.
- Use SIOCGIFXMEDIA when present to obtain extended media states on newer
kernels.
- Explicitly handle "no carrier".
On laptops one may want to have all interfaces up in order to let network
prioritization manage switching between wired and wireless connection. In such
cases lack of IP address is a useful hint about currently used interface, and
color-coding makes it stand out more.
Ingo Bürk [Fri, 29 May 2015 06:41:11 +0000 (08:41 +0200)]
Use format_not_mounted if the directory for a disk_info block does not exist.
This is useful for dynamically mounted devices like thumb drives that get mounted into a directory such as
'/media/$UID/$NAME'.
Avoid use of uninitialized variable in print_battery_info
The boolean flag 'watt_as_unit' may be used without being initialized if the
configured battery path does not contain expected statistics (for example if
it is misconfigured and points to AC adapter info or simply an unrelated file).
Even though it does not cause ill effects, it causes a warning (true positive)
when running i3status under Valgrind. Initialize the variable to make code
well-defined.
support the special interface name _first_ for ethernet/wireless
Since we have deterministic device names in Linux, these strings are a
much better default in the i3status config than "eth0" and "wlan0" (what
we used before).
i3status: Support %frequency for wireless interfaces
In many public WiFis, the 2.4 GHz wireless band is slow due to
congestion, while there is still plenty of bandwidth available on the
5 GHz area. So when debugging wireless issues it's convenient to have
i3status display the frequency of the access point that the interface is
connected to.
This patch adds support for the %frequency tag for wireless interfaces,
so for example:
format_up = "WLAN: %essid - %quality / %frequency"
would result in:
"WLAN: eduroam - 074% / 2.4 GHz"
Cyril Andreatta [Tue, 7 Oct 2014 13:47:58 +0000 (15:47 +0200)]
Created three individual Strings for each battery status (charging, dicharching, full)
Replaced hard coded status strings (CHR, BAT, FULL) in
print_battery_info.c with user defined strings. The new strings are
'status_chr', 'status_bat' and 'status_full' and can be set in i3status.conf.
e.g.
status_chr = "⚡ CHR"
If any of the new status strings is omitted the standard strings (CHR,
BAT, FULL) are used.
Klemen Košir [Mon, 25 Aug 2014 17:03:11 +0000 (19:03 +0200)]
Fix battery indicator on systems without POWER_SUPPLY_VOLTAGE_NOW.
In my case, the voltage variable would stay initialized as -1,
which caused the calculation of battery charge percentage to be
incorrect (I would get the message that there is no battery present
or even -0% charge).
I have no idea how this would affect other systems, since I don't
have a chance to test this.
Robin Hahling [Mon, 4 Aug 2014 14:54:08 +0000 (16:54 +0200)]
Fix Dragonfly BSD CPU temperature gauge
This patch fixes CPU temperature gauge for DragonFly BSD.
Commit 0eeded8 assumed that fetching CPU temperature for DragonFly
BSD was similar to that of FreeBSD but this assumption is false.
This patch fixes a bug in which multiple (conflicting) CPU temps may be
included in the output for the "cpu temperature" module.
The bug is due to the way that the code parsed the envsys(4)-returned data,
and would manifest itself on x86-based NetBSD machines, since those use
cputemp(4) as well as acpitz(4), thereby creating multiple envsys(4) entries
with identical descriptions but which refer to different physical sensors.
Instead of matching the description attribute of each device returned by
envsys(4) against the target format, this patch throws away non-matching keys
in the first instruction inside the dict walk. This has the benefit of sparing
unnecessary CPU cycles, and preventing other sensors from being included
erroneously.
Additionally, the THERMAL_ZONE format is now joined with OpenBSD in that it
uses acpitz(4) explicitly. This is prefered since it is much older (dating
back to NetBSD 2.0), and does not exclude x86-based users (as with cputemp(4)).
This patch takes a similar approach as the NetBSD CPU temperature
code in that it uses proplib(3) to walk dictionaries supplied by
envsys(4).
In addition to providing the basic functionality, it:
* Provides all existing format specifiers (%emptytime %consumption
%status %percentage %remaining)
* Respects all existing config options (hide_seconds, low_threshold,
integer_battery_capacity, last_full_capacity)
* Projects "time until full" when battery status is CS_CHARGING
Marco Hunsicker [Wed, 5 Mar 2014 19:53:07 +0000 (20:53 +0100)]
Support align and min_width module options
This patch enables users to define "align" and "min_width" options
right in the i3status module config sections.
Specifically this patch:
* Adds macros for the two new options that are used in the option
definitions. As the min_width option can take either a string or a
number, a custom type has been added along with a corresponding callback
function that parses the provided value (and provides input validation).
The align option also uses a callback for input validation
* Expands all module config option definitions to include the new
options
* Extends the SEC_CLOSE_MAP() macro to generate the JSON for the new
options as necessary
* Updates the manpage to explain the new options
Marco Hunsicker [Sat, 1 Mar 2014 08:55:29 +0000 (09:55 +0100)]
i3status: Allow customization of module separator
This patch adds the ability to customize the separator that is placed
between modules.
Specifically this patch:
* adds the "separator" general directive
* moves the definition of the default separator for the different
output formats (excluding color formatting) to src/i3status.c
* updates the SEC_CLOSE_MAP macro to disable the separator for the
i3bar output format if the separator directive dictates so
* changes print_seperator() in src/output.c to take a separator
parameter in order to disable the output of the separator if
the separator is empty and to use the provided separator
otherwise
* updates the manpage to explain the new directive
Marco Hunsicker [Tue, 25 Feb 2014 19:43:48 +0000 (20:43 +0100)]
i3status: Bugfix: Reading multiple temperature sensors not possible
This patch inlines the creation of the thermal zone string in order
to force computation on each invocation. This is necessary to be able
to read the values of several temperature sensors.