Commit Graph

856 Commits

Author SHA1 Message Date
Olivier Gayot
49cf3d7edb Mention the return value of the slurp function and the implications
Signed-off-by: Olivier Gayot <olivier.gayot@sigexec.com>
2019-09-19 15:48:59 +02:00
Olivier Gayot
4cf8bebf71 Do not return true from slurp() if it failed to read
Failing to read() some data into the destination buffer from the slurp()
function was not considered an error. This means that we were
potentially leaving the caller with an uninitialized destination buffer
without letting him know it's uninitialized.

It is quite unlikely that a single call to read() would ever fail right
after a successful call to open(..., O_RDONLY). However, one practical
example of this happening is when the file being opened is actually a
directory.

Fixed by propagating the error (i.e. returning false from slurp()) if
the call to read() fails.

Signed-off-by: Olivier Gayot <olivier.gayot@sigexec.com>
2019-09-19 15:47:14 +02:00
Thomas Klausner
5aec4a5da3 Improve NetBSD port. (#361)
Detect and link against ossaudio.

Comment out unused code and functions.
2019-07-29 13:46:20 -07:00
Michael Stapelberg
e84f9588df print_cpu_usage: use buffered file API
fixes #343
fixes #344
2019-07-29 21:46:08 +02:00
Michael Stapelberg
23da59920c make pulseaudio an optional dependency, follow best practices
For my thoughts about optional dependencies, see
https://michael.stapelberg.ch/posts/2019-05-23-optional-dependencies/

This commit follows the best practices outlined in that article:

1. The travis config was modified to verify both code paths build and link/don’t
   link against pulseaudio.

2. If pulseaudio is missing, the build fails until packagers explicitly pass a
   --disable flag. In practice, I think the only situation when this flag should
   be set is in source-based linux distributions where users can express
   package-level compilation preferences (e.g. Gentoo USE flags).

3. The --version output now reflects the status of the optional dependency.

fixes #359
2019-07-29 21:07:40 +02:00
Ingo Bürk
40aeb7bc44
Merge pull request #360 from 0-wiz-0/master
On NetBSD, include sys/socket.h for AF_INET{,6}.
2019-07-22 10:09:56 +02:00
Thomas Klausner
667e38abab On NetBSD, include sys/socket.h for AF_INET{,6}. 2019-07-21 21:17:59 +02:00
Ingo Bürk
86a4ff0333
Merge pull request #355 from jasperla/header_fix
Fix headers meant for OpenBSD, but snuck in for FreeBSD
2019-07-21 15:28:40 +02:00
Michael Stapelberg
54e798e3a6 configure: disable pulse on OpenBSD and DragonFlyBSD
This matches the conditional compilation in the code and is more correct than
distinguishing linux vs. non-linux (which breaks on Debian’s kFreeBSD and hurd
variants).

Thanks to sdk for providing an OpenBSD 6.5 environment for verification. This
has not been tested on DragonFlyBSD.

related to #352
2019-07-12 14:46:55 +02:00
Michael Stapelberg
02a47cd196 battery: include sys/sysctl.h on OpenBSD
This is required so that CTL_HW and others are defined (ran into this on OpenBSD
6.5).
2019-07-12 14:44:03 +02:00
Michael Stapelberg
1999d5cf55 conditionally compile pulse.c only when using pulseaudio
fixes #352
2019-07-11 15:23:08 +02:00
Jasper Lievisse Adriaanse
70b954b122 Fix headers meant for OpenBSD, but snuck in for FreeBSD 2019-07-08 20:14:59 +02:00
Jasper Lievisse Adriaanse
3a51673c05 Extend battery handling on OpenBSD (#351)
If acpibat watts value is not available, try current (for batteries
that report in amps), then convert to watts.

originally submitted by @jcs
2019-07-08 17:53:25 +02:00
Michael Stapelberg
f791b4af3f release v2.13 2019-06-30 19:55:28 +02:00
Ingo Bürk
bd7de0c8ff
Merge pull request #347 from thrasymache/overflow
print_file_contents: allocate enough to include \0
2019-06-18 09:33:47 +02: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
Michael Stapelberg
9d28a661a7 configure.ac: complain when asciidoc cannot be found
related to #338
2019-02-11 21:45:20 +01:00
Michael Stapelberg
fd484c6c58 configure.ac: complain when xmlto cannot be found
related to #338
2019-02-11 21:43:35 +01:00
Michael Stapelberg
4c047e3aa4 Makefile.am: s/I3LOCK/I3STATUS/ 2019-02-11 19:52:19 +01:00
Michael Stapelberg
ee946d0d8c README: update build instructions 2019-02-11 09:52:23 +01:00
Ingo Bürk
49461ac56f
Merge pull request #336 from gokcehan/patch-1
default config: move disk info out of network info
2019-02-03 14:42:32 +01:00
gokcehan
478064800b
default config: move disk info out of network info
By default, disk info is found in a strange place in between ipv6 and wireless information. This commit puts it in between other performance meters. Settings in the file are also now sorted according to their places in the order.
2019-02-03 16:38:17 +03:00
Ingo Bürk
1f3fe73b36
Merge pull request #334 from stapelberg/speed
fix ethernet speed display for 100 Gbit/s cards
2019-01-27 22:40:46 +01:00
Michael Stapelberg
0e4fd9ad4a fix ethernet speed display for 100 Gbit/s cards
Before this fix, i3status would display 34464 Mbit/s instead of 100000 Mbit/s,
because it was only looking at ecmd.speed, ignoring ecmd.speed_hi.
2019-01-27 22:32:47 +01:00
Ingo Bürk
e36966d49c
Merge pull request #333 from stapelberg/sysconfdir
fix: use SYSCONFDIR in error message
2019-01-27 22:22:34 +01:00
Michael Stapelberg
0f4fbf70af fix: use SYSCONFDIR in error message 2019-01-27 22:19:12 +01:00
Orestis
3d5c908af5
Merge pull request #332 from eplanet/fix-macos-build
Fix non Linux build for #309
2019-01-23 11:59:09 +02:00
eplanet
96923a5bc0 Fix non Linux build for #309 2019-01-23 10:44:48 +01:00
Michael Stapelberg
a57cdc84e2
Switch to autotools (#316) 2019-01-23 08:56:40 +01:00
Denton Liu
7efbeeaf6c Implement %devicename specifier for volume module (#325)
This commit implements the %devicename specifier for the volume module
for both PulseAudio and ALSA. This way, i3status will be able to display
the specific device that corresponds to the volume indicator.

Note that this is not implemented for the OSS API but is left in a state
where someone can pick it up for the future.
2019-01-23 08:45:51 +01:00
Ingo Bürk
be0be599d9
Merge pull request #328 from jdevelop/fix/capture-volume-status
Fixed ALSA capture device monitoring.
2019-01-13 18:54:14 +01:00
Eugene Dzhurinsky
696ddf461f
Fixed ALSA capture device monitoring.
When using ALSA, the "Capture" mixer doesn't have the playback channel,
instead "capture"-related methods should be used to get information
about the current volume / state of the mixer.
2019-01-03 21:59:33 -05:00
Ingo Bürk
a84ad18fbf
Merge pull request #321 from eplanet/autodisplay-tz
Add timezone switch
2018-11-17 16:28:38 +01:00
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