Commit Graph

726 Commits

Author SHA1 Message Date
Olivier Gayot
c64195d147 Fix invalid handling of glob() errors on Linux
The manual of glob(3) says that the function returns 0 on successful
completion. Any other integer value should be considered an error, not
only negative integers.

In practice, *BSD systems use negative values but Linux uses positive
integers.

Signed-off-by: Olivier Gayot <olivier.gayot@sigexec.com>
2018-06-20 14:20:17 +02:00
Olivier Gayot
95c068358a Fix use of undefined macro __OpenBSD__
Compiling on Linux with -Wundef produces the following warning:

  warning: "__OpenBSD__" is not defined, evaluates to 0 [-Wundef]

Signed-off-by: Olivier Gayot <olivier.gayot@sigexec.com>
2018-06-20 14:20:17 +02:00
Olivier Gayot
a6dd14c8c6 Avoid assigning a new value to a var before using the old value
Signed-off-by: Olivier Gayot <olivier.gayot@sigexec.com>
2018-06-20 14:20:17 +02:00
Olivier Gayot
598b76cc53 Make sure the arguments passed to printf/die(...) match the format
Signed-off-by: Olivier Gayot <olivier.gayot@sigexec.com>
2018-06-20 14:20:17 +02:00
Olivier Gayot
ca8c3e7337 No longer use a temporary buffer in the die() function
Before the following change

  f947d0a Breaks configfiles! Major refactoring of i3status, see below

The die(fmt, ...) function was outputting the reason to the status bar
in addition to stderr. For this reason, it was meaningful to create a
temporary string according to the format string and then passing it
around to the different functions.

Nowadays, we only display the error message to stderr so calling
fprintf(stderr, ...) is much simpler.

Signed-off-by: Olivier Gayot <olivier.gayot@sigexec.com>
2018-06-20 11:01:59 +02:00
Ingo Bürk
64fd6e1047
Merge pull request #289 from bebehei/testsuite
Testsuite
2018-06-20 08:39:59 +02:00
Benedikt Heine
bffc9ed962 Show differing results, if testcase fails 2018-06-19 17:17:51 +02:00
Benedikt Heine
a073acd406 Run all travis tests and expose the final result as exit code 2018-06-19 17:17:51 +02:00
Benedikt Heine
adc9348e80 Expose the testsuite in the Makefile 2018-06-19 17:17:51 +02:00
Benedikt Heine
bc29d468ca Fail the tests, if i3status actually crashes 2018-06-19 16:47:02 +02:00
Ingo Bürk
f300f6e466
Merge pull request #287 from eplanet/emeric/man_typo
Fix man typo
2018-06-16 14:49:09 +02:00
eplanet
5b4eb1069d Fix man typo 2018-06-14 22:09:03 +02:00
Ingo Bürk
ac78e1abe3
Merge pull request #286 from duskCoder/#283
Fix issue #283 (shown IP belonging to wrong network interface)
2018-06-11 22:18:53 +02:00
Olivier Gayot
451ff9be0b Fix shown IP address belonging to wrong interface
The following commit:

  6a75ea9 Show IP address when address has a label

introduced a way to show the IP address of an interface when a label is
associated to the IP.

When a label is associated to an IP, the structure returned by
getifaddrs() has the label concatenated to the interface name in the
.ifa_name field as in the following example:

    struct ifaddrs ifaddr = {
       .ifa_name = "eth0:mylabel",
    };

As a consequence, using a strict comparison between the interface name
and the .ifa_name field yields a falsy result. However, checking if the
.ifa_name starts with the interface name (e.g. eth0) does not work
either because other network interfaces can have a name which starts
with eth0.

This commit solves the issue by stripping out the optional label from
the .ifa_name field before making a strict comparison with the interface
name.

Fix #283

Signed-off-by: Olivier Gayot <olivier.gayot@sigexec.com>
2018-06-11 22:06:57 +02:00
Olivier Gayot
99a6fb5e49 Simplify the algorithm used to determine the IP address
Signed-off-by: Olivier Gayot <olivier.gayot@sigexec.com>
2018-06-04 19:59:09 +02:00
Ingo Bürk
9f08fe297a
Merge pull request #282 from Stunkymonkey/mem-support
fix wrong memory-documentation
2018-05-22 06:57:45 +02:00
Felix Buehler
c7253ac5e4 fix wrong memory-documentation 2018-05-22 02:07:28 +02:00
Ingo Bürk
b850f5852d
Merge pull request #270 from Stunkymonkey/mem-support
initial support of memory-usage for linux
2018-05-19 22:08:42 +02:00
Orestis
ffe41cc944
Merge pull request #281 from eplanet/fix_warnings
Fix MacOS build
2018-05-15 14:46:06 +03:00
eplanet
9a8106fab9 Fix MacOS build 2018-05-15 13:34:36 +02:00
Michael Stapelberg
c983ff96f2 release v2.12 2018-05-11 11:07:22 +02:00
Benedikt Heine
cba8f55938 Simplify the memory thresholds 2018-05-04 18:46:59 +02:00
Benedikt Heine
7839e93c9b Rename ram variables consistently 2018-05-04 18:46:38 +02:00
Felix Buehler
c55754542e Implement support for memory-usage on Linux 2018-04-11 22:36:41 +02:00
Ingo Bürk
82d25dc362
Merge pull request #275 from winks/patch-2
Fix NULL value on OpenBSD when there is no acpitz0
2018-04-08 15:53:19 +02:00
Florian Anderiasch
46b5c264d1 Fix NULL value on OpenBSD when there is no acpitz0
Using %degrees on OpenBSD resulted in garbage values if sysctl doesn't
know about any cpu temperature sensors.
2018-04-06 19:56:55 +02:00
Ingo Bürk
199a6a2713
Merge pull request #213 from dlrobertson/addr_description
Show IP address when address has a label
2018-03-29 12:50:56 +02:00
Dan Robertson
6a75ea9aea
Show IP address when address has a label
If an address has been added with a label, ensure the correct address is
shown.
2018-03-29 10:46:36 +00:00
Øyvin Halfdan Thuv
3e1213123f Read multiple batteries on DragonFly BSD.
Using ACPI to read individual battery information instead of just
accumulations from sysctl.
2018-03-27 11:52:08 +02:00
Ingo Bürk
5abed82419
Merge pull request #264 from foutaise/master
Make iface_type() work on FreeBSD
2018-03-27 09:27:43 +02:00
Ingo Bürk
4345fa9d97
Merge branch 'master' into master 2018-03-27 09:26:55 +02:00
Ingo Bürk
279e2fccf4
Merge pull request #251 from tomaskrizek/man-eth-wireless-format
man: explicitly use format_up/format_down in ethernet, wireless conf
2018-03-27 09:10:51 +02:00
Ingo Bürk
3aec438a51
Merge pull request #243 from jasperla/fei_error
Remove overly aggressive #error
2018-03-27 09:07:53 +02:00
Ingo Bürk
2cb0ffa01a
Merge pull request #266 from moreais/master
OpenBSD: fix volume display on some hardware
2018-02-12 16:32:01 +01:00
Carlin Bingham
5b416d4ac0 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.
2018-02-13 02:12:04 +13:00
Gerome Fournier
9212ee658b Make iface_type() work on FreeBSD 2018-02-07 11:26:34 +01:00
Ingo Bürk
0880b0ec03
Merge pull request #262 from foutaise/master
Add check for interval value
2018-02-06 12:56:53 +01:00
foutaise
e23eea9438 Add check for interval value 2018-02-06 12:30:04 +01:00
Ingo Bürk
1522f58ef0
Merge pull request #261 from tylerbrazier/no-sloc
Remove SLOC comment from man page
2018-02-03 09:36:36 +01:00
Tyler Brazier
d35e0ab9b6 Remove SLOC comment from man page
This changed happened for the readme in
73620dc876
2018-02-02 13:05:46 -06: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
Ingo Bürk
ef8f9ddcd7
Merge pull request #255 from eplanet/update_readme
Get rid of the SLOC comment
2017-12-12 18:07:19 +01:00
eplanet
73620dc876 Get rid of the SLOC comment 2017-12-11 22:50:16 +01:00
Emeric Planet
657c0498db Update comment as in #247 (#254) 2017-12-11 12:16:00 +01:00
Emeric Planet
53fb9b4f18 Add IPv6 address when IPv4 isn't available (#247) 2017-12-11 11:38:31 +01:00
Ingo Bürk
c3424e10be
Merge pull request #253 from eplanet/always_reload_tz
Call tzset at each time print
2017-12-09 16:17:42 +01:00
eplanet
20a701bdf0 Call tzset at each time print 2017-12-09 15:48:18 +01:00
Ingo Bürk
35bb9a06fb
Merge pull request #252 from GuyOfThePery/patch-1
Fixed minor typos
2017-12-09 13:36:27 +01:00
GuyOfThePery
223de595f0
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."
2017-12-09 13:24:11 +02:00
Tomas Krizek
b9b676af20
man: explicitly use format_up/format_down in ethernet, wireless conf
Clearly indicate format_up and format_down are used for configuring ethernet
and wireless sections instead of format.

Signed-off-by: Tomas Krizek <tomas.krizek@mailbox.org>
2017-12-03 14:49:40 +01:00