Commit Graph

24 Commits

Author SHA1 Message Date
Michael Nolan
e19539e5f6
Add support for batteries outputting Time to empty on linux (#378)
* Add support for batteries outputting Time to empty on linux

The battery in the pinebook pro does not output the remaining charge
in Wh or mAh, so i3 cannot calculate the time remaining. However, it
does directly output the number of minutes remaining on in
POWER_SUPPLY_TIME_TO_EMPTY. This adds support for reading this field
and converting it to seconds_remaining.

* Add testcase for POWER_SUPPLY_TIME_TO_EMTY_NOW
2020-06-15 09:09:06 +02:00
Felix Buehler
d1165232ee format_placeholder percent tests 2020-04-07 23:06:37 +02:00
Ingo Bürk
ae67594b6d
Merge pull request #386 from Stunkymonkey/format_placeholder-date
use format_placeholder for ddate
2020-02-21 17:35:20 +01:00
Felix Buehler
3ceb0b8fcf use format_placeholder for ddate 2020-02-18 20:22:36 +01:00
Felix Buehler
2ef1d7440a use format_placeholder for cpu_temperature 2020-02-18 17:51:12 +01:00
Felix Buehler
b5a804d1af use format_placeholder for battery 2020-02-10 21:05:18 +01:00
Sam Newbold
300b31b2df
print_file_contents: allocate enough to include \0
related to #331
Previously, if max_chars was read, the null byte would be written
past the end of buf.
2019-06-10 16:36:18 +02:00
Dennis Vesterlund
9b5f6ae5f4 Added function to print content from file (#331)
Added a function to print file contents to status bar without newlines.
Added tests for print file contents function
Added manpage entry for file contents
2019-02-21 15:34:32 +01:00
Gaël PORTAY
aa572d24b5 Add testcase for invalid %cpu placeholder 2018-10-23 11:16:16 -04:00
David96
02be7c6fdf Add testcase for #304 2018-09-03 20:51:48 +02:00
=
d003edcba6 Fix for issue 300: Correctly print usage for cpu 10 2018-07-31 00:27:13 -05:00
Felix Buehler
50b899ba42 hide seconds in battery by default 2018-06-29 14:37:48 +02:00
johcgt
d5c69a9d60 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.
2018-01-28 15:37:51 +01:00
Emeric Planet
6464ae2df9 Add network test cases (#246) 2017-11-20 19:51:48 +01:00
Emeric Planet
884e4da673 Fix CPU unit tests (#239)
Support any amount of available cores on testing machine.
2017-08-29 19:01:30 +02:00
Emeric Planet
c7dea74751 Add battery capacity parsing (#216)
The Linux power supply class defines three entries to provide battery status.
One of them wasn't used: POWER_SUPPLY_CAPACITY.

https://www.kernel.org/doc/Documentation/power/power_supply_class.txt
2017-04-13 21:46:21 +02:00
eplanet
94651257ce 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.
2017-03-26 06:54:07 -04:00
eplanet
6f7724ec64 Adding documentation for PR #179 (#182) 2016-11-19 06:02:10 -08:00
Michael Stapelberg
b91e2a4b71 Merge pull request #179 from mihaicmn/feature-threshold-format
Provide format_above_threshold/format_below_threshold options
2016-11-16 13:45:59 -08:00
Mihai Coman
562f6e383d Add unit tests for threshold format 2016-11-15 13:34:06 +02:00
eplanet
9c47240523 Added test case for run_watch
The valid test case assumes pid 1 exists, which should always
be true on Unix environment.
2016-11-14 21:33:09 +00:00
eplanet
243d08e1ad Added unit test case for path_exists 2016-11-14 21:24:16 +00:00
eplanet
7c9108c9b9 Added unit test case for CPU temperature 2016-11-14 20:58:58 +00:00
eplanet
b0af4e4c85 Unit testing in Travis (#170) 2016-11-14 00:13:44 -08:00