1
0
Fork 0
Commit graph

578 commits

Author SHA1 Message Date
Aaron Marcher
d1e3398822 temperature: Improve types 2018-07-06 23:41:02 +02:00
Aaron Marcher
ab4f24a612 ram: Check for theoretical division by zero 2018-07-06 23:38:12 +02:00
Aaron Marcher
fa7c266e2b ram: Use POSIX types 2018-07-06 23:37:05 +02:00
Aaron Marcher
b65c058598 entropy: Use POSIX types for format specifiers 2018-07-06 23:26:12 +02:00
Aaron Marcher
c59b64e643 entropy: Improve types 2018-07-06 23:17:08 +02:00
Aaron Marcher
51ff7ce2b9 Consistent paramter naming for components 2018-07-06 08:08:48 +02:00
Aaron Marcher
efa26f4f35 slstatus.h: Fix coding style
Function declarations should include variable names.
For functions with different parameters on different platfroms they are
left out.
2018-07-06 08:03:31 +02:00
Aaron Marcher
381c2fa12a fmt_human: Improve types
size_t may not be enough, use 64 bit integers
2018-07-06 07:56:46 +02:00
Aaron Marcher
1452a44832 Add Ian Remmler to LICENSE 2018-06-04 14:07:20 +02:00
Ian Remmler
32e0a2bfcc Add flexible formatting to keyboard_indicators.
Updated for style.
2018-06-04 14:06:11 +02:00
Tobias Tschinkowitz
005b541717 uptime: unification of the uptime function for linux/openbsd 2018-06-01 20:17:25 +02:00
Tobias Tschinkowitz
8c8091f4f1 wifi: fixed disconnected wifi status on openbsd 2018-05-31 15:10:04 +02:00
Aaron Marcher
b0401b13bb Clean up header includes
- Remove <errno.h> because related functions are in util.c now
 - Remove corresponding <string.h> if not used otherwise
2018-05-30 19:35:37 +02:00
Aaron Marcher
c0436810ef Update LICENSE for Quentin 2018-05-29 22:26:40 +02:00
Quentin Rameau
7fe240856e Flush the output stream instead of arbitrarily disabling buffering
This is (arguably) more elegant and it matches Xlib output logic.
Also use puts instead of printf as we don't do formating there.
2018-05-29 22:26:05 +02:00
Laslo Hunhold
81d5b427cb Don't explicitly list each component-target
I made a mistake while reading the Posix spec. In fact, the implicit
prerequisite imposed by the .c.o-rule is evaluated as expected, even if
the .c is not given in the target rule.

This partially reverts 0efd64ffaa.
2018-05-29 21:25:39 +02:00
Tobias Tschinkowitz
0c29fc56f9 swap: removed unused include 2018-05-29 14:43:14 +02:00
Laslo Hunhold
a18439af11 Refactor swap.c to use getline() instead of buf-filling
This drops a lot of code and even though we are using a common function,
the specification of only the needed things keeps it very efficient and
even more efficient in memory and time than the previous solution.
2018-05-28 22:21:34 +02:00
Aaron Marcher
5d6415608b Update LICENSE for Tobias 2018-05-28 16:17:03 +02:00
Laslo Hunhold
cd884c2f0a Fix object order and stop using a GNU make idiom 2018-05-28 16:16:20 +02:00
Laslo Hunhold
0efd64ffaa Explicitly list component-objects in the Makefile
There was a long tinkering process at farbfeld about this, but the sad
truth is that it's the only way to make the Makefile truly portable.
Listing it just as

   $(COM:=.o): config.mk $(REQ:=.h)

omits the dependency on the c-file itself, which incurs that strictly
speaking the object file is not depending on the source file, which is
nonsense.

You don't see strictly Posix compliant Makefiles around very often and
most use nasty GNU-extensions everywhere. It is a good idea to go ahead
as a fitting example and show how to write them portably.
2018-05-27 22:55:15 +02:00
Laslo Hunhold
682c0fedde Use E-notation for large powers of 10 2018-05-27 19:53:36 +02:00
Aaron Marcher
c28643ce5b Revert "Add basic backlight percentage support"
On OpenBSD the backlight percentage cannot be retrieved in a simple way.
The only two solutions we are aware of for now are:

 - reading from /dev/ttyC0: which isn't possible without changing
 permissions or running slstatus as root
 - linking against xcb-xrandr: which is bloat and does not work in every
 case appearently

This reverts commit 37724ac2c3 for now.
2018-05-27 16:46:03 +02:00
Tobias Tschinkowitz
5db729fedb ram: fixed int overflow on pagetok macro 2018-05-24 14:51:30 +02:00
Laslo Hunhold
f17f39d0a2 Refactor keymap.c
- Get rid of camel-casing
 - Don't use all-caps for variable names
 - use LEN()-macro
 - use strncmp() rather than strstr() for prefix-checking
 - clean up the tokenizer-loop and don't use copies
 - make the loop more readable by separating different breaking
   conditions
 - stricter error-checking and cleanup
 - store the layout directly with bprintf rather than having
   a separate buffer
2018-05-23 19:56:16 +02:00
Laslo Hunhold
13d77cd268 Refactor snprintf-usage in util.c 2018-05-23 19:56:04 +02:00
Aaron Marcher
d6ad87ce06 keymap: Add braces for for loop 2018-05-23 13:30:45 +02:00
Aaron Marcher
385aedffd9 Add keymap to README 2018-05-23 11:50:08 +02:00
Aaron Marcher
cf2b604507 Add Michael Buch to LICENSE 2018-05-23 10:12:20 +02:00
Michael Buch
943b42de05 Add keymap component
Adding a new keymap component that will
indicate the current keyboard layout (language)
and variant if any was set. I use the
standard X11 XKB APIs to retrieve and parse
the xkb_symbols set with setxkbmap.
2018-05-23 10:09:13 +02:00
Laslo Hunhold
57f69e900b Remove o-flag as it is redundant
Even if we extend the flag to be an n-flag with a numerical input, we
already have other Unix-tools to take care of us much more flexibly,
e.g. with head(1) you can easily get the first 10 outputs with

	slstatus -s | head -n 10,

but also e.g. discard the first one and then get the consecutive 10
outputs.

For the X11-root-window-name, you can limit the runtime with timeout(1)
or a comparable solution.

This reverts commit fa8b939990.
2018-05-22 13:27:11 +02:00
Laslo Hunhold
9c9ce8a125 Check printf() for output errors
This way cases like

	$ slstatus -s > /dev/full

are properly caught and the program terminated with the proper return
code.
2018-05-22 13:25:47 +02:00
Aaron Marcher
825f637e20 netspeeds: Fix indentation 2018-05-22 12:42:31 +02:00
David Demelier
37724ac2c3 Add basic backlight percentage support
At the moment linux only, but will add support for OpenBSD as well.
2018-05-22 12:40:31 +02:00
Aaron Marcher
cbbf59fd3d Change to fmt_human in netspeeds on OpenBSD
Thanks to Hiltjo
2018-05-22 12:21:52 +02:00
Laslo Hunhold
7f91ce265e swap.c: Refactor getstats() and its usage
Add a return value so we are able to check any errors and actually fail
when there has been a critical error instead of carrying on uselessly.
2018-05-21 23:05:39 +02:00
Laslo Hunhold
ceb13206a4 Refactor fmt_human() and fix a bug
It is not necessary to copy memory or anything. Just keep a pointer to
the active prefix-array and assign the length of the arrays to a
variable.

Make the code more readable by using a switch, be more strict when an
invalid base is passed to it and fix a small oversight in the bottom of
the code where the base 1024 was forgotten to generalized.
2018-05-21 20:28:57 +02:00
Aaron Marcher
10dbc9543e Merge fmt_human_2 and fmt_human_10 to one function
Now only one function, fmt_human, takes an additional argument "base".
2018-05-21 14:44:21 +02:00
Aaron Marcher
fc0dde5a60 Remove fmt from load_avgs for consistency
In a later commit something like that will be enabled for every
component
2018-05-21 14:14:45 +02:00
Aaron Marcher
fa8b939990 Add option to output only once and exit 2018-05-21 14:07:41 +02:00
Aaron Marcher
aa8654795d battery_remaining: check for division by zero 2018-05-21 00:42:06 +02:00
Aaron Marcher
a546d4b585 battery_remaining: Change float to double 2018-05-21 00:41:03 +02:00
Aaron Marcher
103945e7bb battery: Minor coding style fixes
- Line length
- Spacing and indentation
- No explicit checks for NULL
2018-05-21 00:38:13 +02:00
Aaron Marcher
bae576cd22 Increase readability for load_uvmexp return 2018-05-21 00:29:54 +02:00
Aaron Marcher
ec5c35ec9f Remove units from numbers
This is a first step to decouple formatting from information because of
two reasons:

 1. The components should only gather and return the values by design
 2. Fine grained user control should be a focus

Scaling will be implemented in a different way in a later commit.
2018-05-21 00:16:54 +02:00
Aaron Marcher
4bd234c7ef swap_perc: check for division by zero on obsd too 2018-05-21 00:02:33 +02:00
Aaron Marcher
806815778f swap_perc: check for division by zero 2018-05-20 23:53:26 +02:00
Aaron Marcher
d8ce4e6942 Add David Demelier to LICENSE 2018-05-20 22:16:39 +02:00
David Demelier
f386a03a20 Support energy_now/power_now in battery_remaining
On some laptops (mostly thinkpads), the remaining time may be
expressed in µWh using energy_now and power_now files rather than µAh
for charge_now and current_now.

Add pick function to conditionally select appropriate one.
2018-05-20 22:12:44 +02:00
Tobias Tschinkowitz
1cd8a7b510 ip: fixed memory leak
free the interface list before returning from the function
2018-05-20 22:06:54 +02:00