Age | Commit message (Collapse) | Author |
|
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.
|
|
|
|
|
|
Only initialize variables at the beginning of a block
|
|
int for normal indexes
size_t for usage with the LEN macro
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Use block for single statement ifs
When functions return -1 for error test against 0 not -1
Newlines
|
|
|
|
|
|
display ESSID and signal strength percentage
|
|
The swapctl(2) function fills the swapent struct with 512KB blocks.
As we want to display in GB, i just modified the calculation for this to
get the expected output.
|
|
|
|
|
|
|
|
|
|
To reproduce the issue:
$ slstatus -s | tee
then it would print only when the stdout buffer is full, by block
of multiple lines.
fflush() makes sure the line is printed at every loop iteration
|
|
|
|
sys/sensors.h has two structs struct timeval: sensor and ksensor:
struct sensor {
...
struct timeval tv; /* sensor value last change time */
...
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- Sort Alphabetically
- Same indentation for preprocessor clauses
|
|
|
|
OpenBSD's entropy design is superior to Linux.
|
|
|
|
|
|
- Use block for single statement ifs
- Keep lines to reasonable length (current debate as to reasonable)
- When functions return -1 for error test against 0 not -1
- Do not indent cases another level
- Do not test against NULL and 0 explicitly
- Use tabs for indentation, use spaces for alignment
|
|
The third value from load_avg (idle) gives us almost the same
information as cpu_iowait. Plus OpenBSD does not offer an iowait value
as Linux and thus the corresponding function would not be portable.
|
|
|
|
In OpenBSD the CPU usage in percent is now computed using KERN_CPTIME
sysctl.
|
|
|