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.
Gereon Kremer [Thu, 14 Nov 2013 23:41:33 +0000 (00:41 +0100)]
Added different format string for volume in case it is muted.
If the volume is muted, the volume level would simply be displayed as zero and the color changed to color_degraded.
This patch lets the user define a custom format string for when the volume is muted.
The default value is "♪: 0%" ("♪: %volume" being the usual format).
format detection: simplify code, handle "sh" processes in the hierarchy
i3 starts processes using /bin/sh now, not $SHELL. This increases the
likelihood with which we are started by dash, which tends to leave its
processes in the hierarchy, e.g.:
michael 1524 i3bar --bar_id=bar-0 --socket=/run/user/1000/i3/ipc-s
michael 1525 \_ /bin/sh -c i3status
michael 1526 \_ i3status
This case is now handled correctly — when the parent is “sh”, the parent
of sh will be used instead.
Axel Wagner [Tue, 11 Jun 2013 14:08:14 +0000 (16:08 +0200)]
Bugfix: In term-output, clear line before drawing new one
If we don't do this, the output of i3status will remain on the terminal,
which is really ugly if the statusline becomes shorter after a while
(for example a connection get's lost), because there will be garbage.
Jakob Haufe [Thu, 28 Feb 2013 13:15:22 +0000 (14:15 +0100)]
Fix FTBFS on Hurd
On GNU/Hurd, THERMAL_ZONE is undefined. This makes compilation fail as
outwalk is declared inside of #ifdef THERMAL_ZONE, but it's used outside
of it (by OUTPUT_FULL_TEXT).
This moves the declaration outside the #ifdef to allow for successful
compilation on Hurd again.
Simon Elsbrock [Tue, 16 Oct 2012 20:45:19 +0000 (22:45 +0200)]
bugfix: colorize output even without discharge rate (thanks f8l)
On some systems, the discharge rate may be missing, although the battery
is still working. This leads to an edge case on Linux systems in which
the output may not be colorized although a threshold was defined.
This commit fixes the behavior by colorizing output if threshold_type is
set to "percentage". Since we cannot calculate remaining time without
discharge rate, output is still uncolorized in case of threshold_type
set to "time".
i3status - More temperature related fixes for OpenBSD, and a general feature
- Temperature sensors can now set a 'max_threshold' value to color the output red if exceeded.
- Allow for arbitrary temperature sensors nodes to be selected with 'path' on OpenBSD.
Piotr Domagalski [Tue, 28 Aug 2012 20:07:33 +0000 (22:07 +0200)]
Eat unnecessary space from the battery format str.
If the battery is not discharging it may be not possible to give information on
remaining time or consumption. The resulting strings (%remaining, %consumption,
%emptytime) are empty then. But because they are in the format string, the
output string contains unnecessary spaces in this case.
Simon Elsbrock [Thu, 23 Aug 2012 14:42:38 +0000 (16:42 +0200)]
add additional battery threshold type "percentage"
The battery threshold can now be configured as type "time" or
"percentage", but defaults to "time" to prevent unexpected behavior.
Also, low_threshold was set to a more reasonable default of 30.