Age | Commit message (Collapse) | Author |
|
|
|
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.
|
|
|
|
|
|
|
|
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.
|
|
free the interface list before returning from the function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
These functions take the raw number and a unit and automatically
print it out "scaled down" to a proper SI-prefix, for powers of 2
and 10 respectively.
Apply them to the 2-power cases and keep the 10-power for a later
commit.
|
|
Units should be added to the corresponding numbers
|
|
First dividing by interval before multiplying with 1000 decreases the
precision by +-(interval - 1) * 1000, as interval arithmetic always
applies the Gauß-function to the result.
This is not necessary and simply reordering the operations mitigates
this.
|
|
Within the components, snprintf() was unchecked and had inefficient
calls in some places.
We implement esnprintf() that does all the dirty laundry for us
and use it exclusively now.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
implemented additional error condition for openbsd netstat in case the
interface could not be found in the interface list or if_data is not
readable.
|
|
|
|
|
|
implemented the netspeed functionality for openbsd.
furthermore the static keyword was removed of the interval variable in
config.def.h for usage as extern variable.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Additionally unify the format of battery_state and uptime
|
|
|
|
when an AC is connected apm_info shows a non-valid value for remaining
minutes. it was decided that in that case the function should return an
empty string.
|
|
Tabs for indentation, spaces for alignment
|
|
Implementation of a battery_remaining function which returns the
remaining battery time in HH:MM format. Linux function still needs
implementation.
Move common code to load_apm_power_info
|
|
Given slstatus is a tool that runs in the background, most likely run
from .xinitrc, it's important to prepend the name of the tool to error
messages so it becomes clear where the error is coming from.
To make this much more consistent, this commit adds warn() and die()
utility functions consistent with other suckless projects and adapts all
calls to fprintf(stderr, *) to the warn() and die() functions, greatly
increasing the readability of the code.
|
|
1) Remove setlocale() (locales are harmful and any 'issues' shall
be fixed in different ways that are expected).
2) Disable buffering on stdout with setbuf() rather than flushing
it each time.
3) Make error messages more consistent.
4) Add error checks where applicable.
5) Make code a bit more readable where res is assigned.
6) Use XFlush() rather than XSync() (we don't need to wait for the
XServer to react, which could lead to long hangs on our side).
|
|
Posix guarantees that the resulting string is null-terminated, even if
we have an overflow. Instead of doing what has already been done,
properly warn when there has been an error or overflow, so the user can
do something about it.
|
|
Use variables named unused instead which is simpler
|
|
|
|
<sys/select.h> is needed before <net80211/ieee80211_ioctl.h> on OpenBSD
to define NBBY and shut up compiler warnings.
|
|
|
|
|