Commit Graph

872 Commits

Author SHA1 Message Date
eplanet
1b7501b7ea Corrections according to PR review 2018-11-15 22:27:23 +01:00
eplanet
ac6c2a7d46 Add timezone switch 2018-11-10 10:47:05 +01:00
Orestis
2d38178063
Merge pull request #319 from eplanet/fix-etc-mtab
Read /proc/mounts if /etc/mtab can't be read
2018-11-08 11:52:47 +02:00
Ingo Bürk
226cb229f7
Merge pull request #320 from eplanet/fix-error-msg
Fix error messages
2018-11-08 07:01:23 +00:00
eplanet
e545525148 Read /proc/mounts if /etc/mtab can't be read 2018-11-08 07:59:15 +01:00
eplanet
bc5cc6f238 Fix error messages 2018-11-07 23:01:36 +01:00
Orestis
1492868b80
Merge pull request #309 from TwentyFourD/NonConsecutiveCPUs
Support non-consecutive CPUs
2018-11-05 12:32:21 +02:00
TwentyFourD
6914f8e5b5
print_cpu_usage.c: Support non-consecutive CPUs
Fixes #308
2018-11-05 12:30:52 +02:00
Ingo Bürk
be5f38e0a6
Merge pull request #318 from gportay/fix-invalid-cpu-placeholder
print_cpu_usage: fix invalid %cpu placeholder output
2018-10-26 09:24:45 +02:00
Gaël PORTAY
aa572d24b5 Add testcase for invalid %cpu placeholder 2018-10-23 11:16:16 -04:00
Gaël PORTAY
0b8aa86ecb print_cpu_usage: fix invalid %cpu placeholder output
Currently, the module cpu_usage prints %cpu0 information for the invalid
%cpu placeholder (i.e. the cpu number is missing).

Consider the following configuration.

	order += "cpu_usage"

	cpu_usage {
		format = "cpu0=%cpu0 cpu1=%cpu1 cpu=%cpu"
		# missing cpu number -------------------^
	}

The configuration above produces the output below.

	$ i3status -c config
	i3status: trying to auto-detect output_format setting
	i3status: auto-detected "term"
	cpu0=-2% cpu1=-49% cpu=-2%
	cpu0=06% cpu1=02% cpu=06%
	cpu0=05% cpu1=06% cpu=05%
	...

The module prints %cpu0 at the third placeholder where it should report
an error.

This commit fixes this behavior by initializing `number' to -1. If the
cpu is missing in %cpu placeholder, the sscanf function does not set
`number'. Because `number' is -1 (lower to 0), an error is reported and
the placeholder is skipped.

	$ i3status -c ./config
	i3status: trying to auto-detect output_format setting
	i3status: auto-detected "term"
	provided CPU number '-1' above detected number of CPU 4
	cpu0= cpu1=-48% cpu=
	provided CPU number '-1' above detected number of CPU 4
	cpu0= cpu1=11% cpu=
	provided CPU number '-1' above detected number of CPU 4
	cpu0= cpu1=03% cpu=
	...
2018-10-21 20:51:53 -04:00
Orestis
13f720ab75
Merge pull request #315 from gportay/fix-typo-in-man
man: fix typo for max_threshold in load
2018-10-19 02:08:53 +03:00
Gaël PORTAY
446ef95621 man: fix typo for max_threshold in load
Floating values use a dot (not a comma).

Fixes:

	invalid floating point value for option 'max_threshold'
2018-10-18 17:29:21 -04:00
arcnmx
ddadc8e4d7 Provide a more natural volume percentage with ALSA.
The rationale of the code is explained in the header:
http://git.alsa-project.org/?p=alsa-utils.git;a=blob;f=alsamixer/volume_mapping.c;h=1c0d7c45e6686239464e1b0bbc8983ea57f3914f;hb=HEAD
> The mapping is designed so that the position in the interval is
> proportional to the volume as a human ear would perceive it (i.e., the
> position is the cubic root of the linear sample multiplication
> factor).

and the commit message:
http://git.alsa-project.org/?p=alsa-utils.git;a=commit;h=34bb514b5fd1d6f91ba9a7b3a70b0ea0c6014250
> use a mapping where the bar height is proportional to the audible
> volume, i.e., where the amplitude is the cube of the bar height.

and further explanation can be found in the pull request:
https://github.com/i3/i3status/pull/268#pullrequestreview-147429763
2018-10-11 00:21:03 +03:00
Orestis
494efd49a2 strncpy + strlen is pointless (#312)
strlen already assumes that the string is NULL-terminated.

Fixes -Wstringop-overflow warning
2018-10-07 20:26:24 +02:00
Ingo Bürk
5c9d12befa
Merge pull request #305 from David96/master
Add support for "POWER_SUPPLY_STATUS=Not charging" (fixes #304)
2018-09-04 11:58:58 +02:00
David96
02be7c6fdf Add testcase for #304 2018-09-03 20:51:48 +02:00
David96
6a5e5b8ac4 Add support for "POWER_SUPPLY_STATUS=Not charging" (fixes #304) 2018-09-03 20:50:36 +02:00
Ingo Bürk
38ead0249b
Merge pull request #302 from coderonline/master
Added %interface to the ethernet options
2018-08-27 11:11:41 +02:00
Max Christian Pohle
04d09aac49 Added %interface to the ethernet options 2018-08-24 23:43:35 +02:00
Ingo Bürk
fadd4d89b1
Merge pull request #301 from wmarvel/issue300
Fix for issue 300: Correctly print usage for cpu 10
2018-08-01 13:49:27 +02:00
=
d003edcba6 Fix for issue 300: Correctly print usage for cpu 10 2018-07-31 00:27:13 -05:00
Ingo Bürk
639a67f752
Merge pull request #296 from Stunkymonkey/include-order
switch to clang 3.8 & ignore include sort order
2018-07-16 16:18:06 +02:00
Ingo Bürk
0b25052cd0
Merge pull request #299 from tuxillo/patch-2
Detect interface type on DragonFly BSD
2018-07-16 16:13:47 +02:00
Antonio Huete Jimenez
afd7e44d97 Detect interface type on DragonFly BSD 2018-07-15 21:59:18 +00:00
Ingo Bürk
1174bfa7da
Merge pull request #298 from tuxillo/patch-1
Do not use pulseaudio for DragonFly BSD
2018-07-15 21:47:26 +02:00
Antonio Huete Jimenez
deca11c0a0 Do not use pulseaudio for DragonFly BSD 2018-07-14 20:23:22 +00:00
Felix Buehler
3fd61f86db clang-format-3.8 fix travis error 2018-07-13 16:28:22 +02:00
Ingo Bürk
fc9da67e65
Merge pull request #297 from Stunkymonkey/percent-first
able to print percentage
2018-07-13 15:17:51 +02:00
Felix Buehler
d099a907f6 fix clang errors 2018-07-13 15:11:43 +02:00
Felix Buehler
52e9f6f63b able to print percentage
its now possible to have percentage before and after a variable. except
for the date. But percentage with dates does not make much sense to me, so
i skipped it.
2018-07-13 15:03:31 +02:00
Ingo Bürk
9aafc38370
Merge pull request #256 from oyvinht/master
Read multiple batteries on DragonFly BSD.
2018-07-13 12:31:04 +02:00
Ingo Bürk
c7f04b7447
Merge pull request #295 from Stunkymonkey/fix-min_width-docs
fix min_width doc
2018-07-13 12:27:28 +02:00
Felix Buehler
a40d7d928f switch to clang 3.8 & ignore sort oder of includes 2018-07-08 13:48:28 +02:00
Felix Buehler
530c6f01d3 fix min_width doc 2018-07-07 22:57:39 +02:00
Ingo Bürk
c5ad20bf50
Merge pull request #294 from Stunkymonkey/remove_memory_discussion
forgot to remove memory discussion from man page (it is implemented)
2018-06-30 06:52:58 +02:00
Felix Buehler
4e62a853ee forgot to remove memory discussion from man page (it is implemented) 2018-06-30 00:52:59 +02:00
Ingo Bürk
302966374b
Merge pull request #292 from Stunkymonkey/format_quality
add format_quality option in wireless
2018-06-29 23:10:53 +02:00
Felix Buehler
4ea804b751 add format_quality option in wireless 2018-06-29 22:56:09 +02:00
Ingo Bürk
78c0a53c45
Merge pull request #293 from Stunkymonkey/hide_seconds_battery
hide seconds in battery by default
2018-06-29 22:49:52 +02:00
Ingo Bürk
a916481aab
Merge pull request #291 from duskCoder/cap_net_admin
Stop requiring CAP_NET_ADMIN
2018-06-29 22:43:39 +02:00
Felix Buehler
50b899ba42 hide seconds in battery by default 2018-06-29 14:37:48 +02:00
Olivier Gayot
03c8908ec6 Stop requiring CAP_NET_ADMIN
Since the following commit in the Linux kernel tree

  0fdc100bdc4b ethtool: allow non-netadmin to query settings

it is no longer necessary to have the CAP_NET_ADMIN capability to query
a device speed using ioctl(..., SIOCETHTOOL) in conjonction with the
ETHTOOL_GSET ethtool command.

The mentioned commit landed first in the 2.6.37 version of the Kernel.
This version is no longer maintained nowdays.

Since it is not necessary anymore, it is strongly prefered from a
security standpoint to drop the CAP_NET_ADMIN capability from the
binary.

Signed-off-by: Olivier Gayot <olivier.gayot@sigexec.com>
2018-06-25 11:53:05 +02:00
Ingo Bürk
4d3344ab9c
Merge pull request #290 from duskCoder/changes
Fix potential issues & avoid unnecessary instructions
2018-06-22 13:55:09 +02:00
Olivier Gayot
c221b4d331 Prevent potential crash if glob() fails
Calling globfree(NULL) is undefined behaviour. In Linux (glibc), it
results in a segmentation fault.

It is also undefined behaviour to call globfree(&pglob) if a previous
call to glob(&pglob) returned an error.

Signed-off-by: Olivier Gayot <olivier.gayot@sigexec.com>
2018-06-20 14:20:17 +02:00
Olivier Gayot
445b1925e3 Fix potential memory leak on Linux
The function slurp_all_batteries(), on Linux, allocates memory
dynamically

Signed-off-by: Olivier Gayot <olivier.gayot@sigexec.com>
2018-06-20 14:20:17 +02:00
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