suckless/slstatus.git
5 years agoAdd OS-support notice to README
Aaron Marcher [Sat, 16 Feb 2019 16:05:04 +0000 (17:05 +0100)]
Add OS-support notice to README

5 years agoAdd ram and swap components on FreeBSD
Michael Buch [Sat, 16 Feb 2019 01:26:44 +0000 (01:26 +0000)]
Add ram and swap components on FreeBSD

5 years agocpu_perc: Check for division by zero
Ingo Feinerer [Thu, 14 Feb 2019 18:25:51 +0000 (19:25 +0100)]
cpu_perc: Check for division by zero

5 years agoFix CPU frequency on OpenBSD
Ingo Feinerer [Wed, 13 Feb 2019 14:45:40 +0000 (15:45 +0100)]
Fix CPU frequency on OpenBSD

5 years agoclose file descriptors and fix return values
Michael Buch [Wed, 13 Feb 2019 14:16:17 +0000 (14:16 +0000)]
close file descriptors and fix return values

5 years agoAdd native OpenBSD support for mute/volume
Ingo Feinerer [Fri, 8 Feb 2019 14:37:17 +0000 (15:37 +0100)]
Add native OpenBSD support for mute/volume

Based on functionality in dstat by Joerg Jung.

5 years agowifi component on FreeBSD
Michael Buch [Wed, 13 Feb 2019 00:47:23 +0000 (00:47 +0000)]
wifi component on FreeBSD

5 years agoAdd FreeBSD support for netspeeds, entropy and ip components
Michael Buch [Wed, 30 Jan 2019 11:21:54 +0000 (11:21 +0000)]
Add FreeBSD support for netspeeds, entropy and ip components

5 years agoUpdate LICENSE
Aaron Marcher [Tue, 5 Feb 2019 08:32:47 +0000 (09:32 +0100)]
Update LICENSE

5 years agoAdd support for cpu and uptime components on FreeBSD
Michael Buch [Tue, 5 Feb 2019 02:44:37 +0000 (02:44 +0000)]
Add support for cpu and uptime components on FreeBSD

5 years agoAdd FreeBSD support for temperature and battery components
Michael Buch [Sun, 27 Jan 2019 15:44:39 +0000 (15:44 +0000)]
Add FreeBSD support for temperature and battery components

6 years agoram: Consistency with line breaks
Aaron Marcher [Sun, 8 Jul 2018 15:45:32 +0000 (17:45 +0200)]
ram: Consistency with line breaks

6 years agoFix whitespace
Aaron Marcher [Sun, 8 Jul 2018 15:44:53 +0000 (17:44 +0200)]
Fix whitespace

6 years agoConsistency with 80 char limit and breaks
Aaron Marcher [Sun, 8 Jul 2018 15:42:58 +0000 (17:42 +0200)]
Consistency with 80 char limit and breaks

6 years agowifi_perc: Simplify on Linux
Aaron Marcher [Sat, 7 Jul 2018 12:05:53 +0000 (14:05 +0200)]
wifi_perc: Simplify on Linux

Remove unnecessary variable

6 years agoSimplify format specifiers for uintmax_t
Aaron Marcher [Sat, 7 Jul 2018 09:08:26 +0000 (11:08 +0200)]
Simplify format specifiers for uintmax_t

6 years agocpu_freq: Simplify with E-notation
Aaron Marcher [Sat, 7 Jul 2018 08:56:10 +0000 (10:56 +0200)]
cpu_freq: Simplify with E-notation

Thanks to the FRIGN

6 years agocpu_freq: Change to 64 bit integers
Aaron Marcher [Sat, 7 Jul 2018 08:54:12 +0000 (10:54 +0200)]
cpu_freq: Change to 64 bit integers

Remove unnecessary cast to size_t

6 years agoChange uint64_t to uintmax_t
Aaron Marcher [Sat, 7 Jul 2018 08:50:25 +0000 (10:50 +0200)]
Change uint64_t to uintmax_t

6 years agobattery: 64 bit ints on Linux
Aaron Marcher [Sat, 7 Jul 2018 08:31:57 +0000 (10:31 +0200)]
battery: 64 bit ints on Linux

6 years agocpu: Use uint64_t on OpenBSD
Aaron Marcher [Fri, 6 Jul 2018 22:24:36 +0000 (00:24 +0200)]
cpu: Use uint64_t on OpenBSD

6 years agobattery: Remove unnecessary defines for paths
Aaron Marcher [Fri, 6 Jul 2018 21:55:18 +0000 (23:55 +0200)]
battery: Remove unnecessary defines for paths

6 years agouptime: Improve typing and sort headers
Aaron Marcher [Fri, 6 Jul 2018 21:47:52 +0000 (23:47 +0200)]
uptime: Improve typing and sort headers

6 years agotemperature: Improve types
Aaron Marcher [Fri, 6 Jul 2018 21:41:02 +0000 (23:41 +0200)]
temperature: Improve types

6 years agoram: Check for theoretical division by zero
Aaron Marcher [Fri, 6 Jul 2018 21:38:12 +0000 (23:38 +0200)]
ram: Check for theoretical division by zero

6 years agoram: Use POSIX types
Aaron Marcher [Fri, 6 Jul 2018 21:37:05 +0000 (23:37 +0200)]
ram: Use POSIX types

6 years agoentropy: Use POSIX types for format specifiers
Aaron Marcher [Fri, 6 Jul 2018 21:26:12 +0000 (23:26 +0200)]
entropy: Use POSIX types for format specifiers

6 years agoentropy: Improve types
Aaron Marcher [Fri, 6 Jul 2018 21:17:08 +0000 (23:17 +0200)]
entropy: Improve types

6 years agoConsistent paramter naming for components
Aaron Marcher [Fri, 6 Jul 2018 06:08:48 +0000 (08:08 +0200)]
Consistent paramter naming for components

6 years agoslstatus.h: Fix coding style
Aaron Marcher [Fri, 6 Jul 2018 06:03:31 +0000 (08:03 +0200)]
slstatus.h: Fix coding style

Function declarations should include variable names.
For functions with different parameters on different platfroms they are
left out.

6 years agofmt_human: Improve types
Aaron Marcher [Fri, 6 Jul 2018 05:56:46 +0000 (07:56 +0200)]
fmt_human: Improve types

size_t may not be enough, use 64 bit integers

6 years agoAdd Ian Remmler to LICENSE
Aaron Marcher [Mon, 4 Jun 2018 12:07:20 +0000 (14:07 +0200)]
Add Ian Remmler to LICENSE

6 years agoAdd flexible formatting to keyboard_indicators.
Ian Remmler [Mon, 4 Jun 2018 01:02:34 +0000 (20:02 -0500)]
Add flexible formatting to keyboard_indicators.

Updated for style.

6 years agouptime: unification of the uptime function for linux/openbsd
Tobias Tschinkowitz [Fri, 1 Jun 2018 18:10:34 +0000 (20:10 +0200)]
uptime: unification of the uptime function for linux/openbsd

6 years agowifi: fixed disconnected wifi status on openbsd
Tobias Tschinkowitz [Thu, 31 May 2018 11:53:49 +0000 (13:53 +0200)]
wifi: fixed disconnected wifi status on openbsd

6 years agoClean up header includes
Aaron Marcher [Wed, 30 May 2018 17:35:37 +0000 (19:35 +0200)]
Clean up header includes

 - Remove <errno.h> because related functions are in util.c now
 - Remove corresponding <string.h> if not used otherwise

6 years agoUpdate LICENSE for Quentin
Aaron Marcher [Tue, 29 May 2018 20:26:40 +0000 (22:26 +0200)]
Update LICENSE for Quentin

6 years agoFlush the output stream instead of arbitrarily disabling buffering
Quentin Rameau [Tue, 29 May 2018 19:32:29 +0000 (21:32 +0200)]
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.

6 years agoDon't explicitly list each component-target
Laslo Hunhold [Tue, 29 May 2018 19:24:43 +0000 (21:24 +0200)]
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 0efd64ffaa04715eff9c834c437562952c4531cd.

6 years agoswap: removed unused include
Tobias Tschinkowitz [Tue, 29 May 2018 12:28:39 +0000 (14:28 +0200)]
swap: removed unused include

6 years agoRefactor swap.c to use getline() instead of buf-filling
Laslo Hunhold [Mon, 28 May 2018 19:16:02 +0000 (21:16 +0200)]
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.

6 years agoUpdate LICENSE for Tobias
Aaron Marcher [Mon, 28 May 2018 14:17:03 +0000 (16:17 +0200)]
Update LICENSE for Tobias

6 years agoFix object order and stop using a GNU make idiom
Laslo Hunhold [Mon, 28 May 2018 13:58:28 +0000 (15:58 +0200)]
Fix object order and stop using a GNU make idiom

6 years agoExplicitly list component-objects in the Makefile
Laslo Hunhold [Sun, 27 May 2018 20:40:00 +0000 (22:40 +0200)]
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.

6 years agoUse E-notation for large powers of 10
Laslo Hunhold [Sun, 27 May 2018 15:57:52 +0000 (17:57 +0200)]
Use E-notation for large powers of 10

6 years agoRevert "Add basic backlight percentage support"
Aaron Marcher [Sun, 27 May 2018 14:46:03 +0000 (16:46 +0200)]
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 37724ac2c3f496f4736223d0d8e5d8fecb933590 for now.

6 years agoram: fixed int overflow on pagetok macro
Tobias Tschinkowitz [Thu, 24 May 2018 10:09:26 +0000 (12:09 +0200)]
ram: fixed int overflow on pagetok macro

6 years agoRefactor keymap.c
Laslo Hunhold [Wed, 23 May 2018 13:29:37 +0000 (15:29 +0200)]
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

6 years agoRefactor snprintf-usage in util.c
Laslo Hunhold [Wed, 23 May 2018 11:51:50 +0000 (13:51 +0200)]
Refactor snprintf-usage in util.c

6 years agokeymap: Add braces for for loop
Aaron Marcher [Wed, 23 May 2018 11:30:45 +0000 (13:30 +0200)]
keymap: Add braces for for loop

6 years agoAdd keymap to README
Aaron Marcher [Wed, 23 May 2018 09:50:08 +0000 (11:50 +0200)]
Add keymap to README

6 years agoAdd Michael Buch to LICENSE
Aaron Marcher [Wed, 23 May 2018 08:12:20 +0000 (10:12 +0200)]
Add Michael Buch to LICENSE

6 years agoAdd keymap component
Michael Buch [Wed, 23 May 2018 06:16:30 +0000 (07:16 +0100)]
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.

6 years agoRemove o-flag as it is redundant
Laslo Hunhold [Mon, 21 May 2018 19:31:53 +0000 (21:31 +0200)]
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 fa8b939990ed0648f99b0cbeba4efed807160db3.

6 years agoCheck printf() for output errors
Laslo Hunhold [Tue, 22 May 2018 10:50:43 +0000 (12:50 +0200)]
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.

6 years agonetspeeds: Fix indentation
Aaron Marcher [Tue, 22 May 2018 10:42:31 +0000 (12:42 +0200)]
netspeeds: Fix indentation

6 years agoAdd basic backlight percentage support
David Demelier [Tue, 22 May 2018 07:23:29 +0000 (09:23 +0200)]
Add basic backlight percentage support

At the moment linux only, but will add support for OpenBSD as well.

6 years agoChange to fmt_human in netspeeds on OpenBSD
Aaron Marcher [Tue, 22 May 2018 10:21:52 +0000 (12:21 +0200)]
Change to fmt_human in netspeeds on OpenBSD

Thanks to Hiltjo

6 years agoswap.c: Refactor getstats() and its usage
Laslo Hunhold [Mon, 21 May 2018 21:03:34 +0000 (23:03 +0200)]
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.

6 years agoRefactor fmt_human() and fix a bug
Laslo Hunhold [Mon, 21 May 2018 18:08:56 +0000 (20:08 +0200)]
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.

6 years agoMerge fmt_human_2 and fmt_human_10 to one function
Aaron Marcher [Mon, 21 May 2018 12:44:21 +0000 (14:44 +0200)]
Merge fmt_human_2 and fmt_human_10 to one function

Now only one function, fmt_human, takes an additional argument "base".

6 years agoRemove fmt from load_avgs for consistency
Aaron Marcher [Mon, 21 May 2018 12:14:45 +0000 (14:14 +0200)]
Remove fmt from load_avgs for consistency

In a later commit something like that will be enabled for every
component

6 years agoAdd option to output only once and exit
Aaron Marcher [Mon, 21 May 2018 12:07:41 +0000 (14:07 +0200)]
Add option to output only once and exit

6 years agobattery_remaining: check for division by zero
Aaron Marcher [Sun, 20 May 2018 22:42:06 +0000 (00:42 +0200)]
battery_remaining: check for division by zero

6 years agobattery_remaining: Change float to double
Aaron Marcher [Sun, 20 May 2018 22:41:03 +0000 (00:41 +0200)]
battery_remaining: Change float to double

6 years agobattery: Minor coding style fixes
Aaron Marcher [Sun, 20 May 2018 22:36:59 +0000 (00:36 +0200)]
battery: Minor coding style fixes

- Line length
- Spacing and indentation
- No explicit checks for NULL

6 years agoIncrease readability for load_uvmexp return
Aaron Marcher [Sun, 20 May 2018 22:29:54 +0000 (00:29 +0200)]
Increase readability for load_uvmexp return

6 years agoRemove units from numbers
Aaron Marcher [Sun, 20 May 2018 22:16:54 +0000 (00:16 +0200)]
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.

6 years agoswap_perc: check for division by zero on obsd too
Aaron Marcher [Sun, 20 May 2018 22:02:33 +0000 (00:02 +0200)]
swap_perc: check for division by zero on obsd too

6 years agoswap_perc: check for division by zero
Aaron Marcher [Sun, 20 May 2018 21:53:26 +0000 (23:53 +0200)]
swap_perc: check for division by zero

6 years agoAdd David Demelier to LICENSE
Aaron Marcher [Sun, 20 May 2018 20:16:39 +0000 (22:16 +0200)]
Add David Demelier to LICENSE

6 years agoSupport energy_now/power_now in battery_remaining
David Demelier [Sun, 20 May 2018 07:42:16 +0000 (09:42 +0200)]
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.

6 years agoip: fixed memory leak
Tobias Tschinkowitz [Sun, 20 May 2018 13:53:48 +0000 (15:53 +0200)]
ip: fixed memory leak

free the interface list before returning from the function

6 years agoCheck return value of pclose()
Laslo Hunhold [Sat, 19 May 2018 22:57:24 +0000 (00:57 +0200)]
Check return value of pclose()

6 years agoRefactor ram.c
Aaron Marcher [Sat, 19 May 2018 22:42:07 +0000 (00:42 +0200)]
Refactor ram.c

6 years agoMake temp more readable on Linux
Aaron Marcher [Sat, 19 May 2018 22:30:16 +0000 (00:30 +0200)]
Make temp more readable on Linux

6 years agoRefactor entropy.c
Laslo Hunhold [Sat, 19 May 2018 22:18:08 +0000 (00:18 +0200)]
Refactor entropy.c

6 years agoRemove initialization to 0 for static vars
Aaron Marcher [Sat, 19 May 2018 22:17:35 +0000 (00:17 +0200)]
Remove initialization to 0 for static vars

6 years agoRemove unnecessary "valid" variable in cpu_perc
Aaron Marcher [Sat, 19 May 2018 22:16:20 +0000 (00:16 +0200)]
Remove unnecessary "valid" variable in cpu_perc

6 years agoAdd unit to temperature
Aaron Marcher [Sat, 19 May 2018 22:02:49 +0000 (00:02 +0200)]
Add unit to temperature

6 years agoImplement scaling for cpu_freq
Aaron Marcher [Sat, 19 May 2018 21:58:14 +0000 (23:58 +0200)]
Implement scaling for cpu_freq

6 years agoImplement fmt_human_2() and fmt_human_10()
Laslo Hunhold [Sat, 19 May 2018 20:52:17 +0000 (22:52 +0200)]
Implement fmt_human_2() and fmt_human_10()

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.

6 years agoAdd the percent sign to *_perc functions
Aaron Marcher [Sat, 19 May 2018 18:33:06 +0000 (20:33 +0200)]
Add the percent sign to *_perc functions

Units should be added to the corresponding numbers

6 years agoIncrease precision in netspeeds.c
Laslo Hunhold [Sat, 19 May 2018 18:09:38 +0000 (20:09 +0200)]
Increase precision in netspeeds.c

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.

6 years agoImplement esnprintf() and make formatted calls more efficient
Laslo Hunhold [Sat, 19 May 2018 17:33:04 +0000 (19:33 +0200)]
Implement esnprintf() and make formatted calls more efficient

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.

6 years agoSimplify ipv* functions
Aaron Marcher [Sat, 19 May 2018 11:34:18 +0000 (13:34 +0200)]
Simplify ipv* functions

6 years agoUse `int` for flags
Aaron Marcher [Sat, 19 May 2018 11:29:21 +0000 (13:29 +0200)]
Use `int` for flags

6 years agoRevert aac29e2 as it is nonsense
Aaron Marcher [Sat, 19 May 2018 11:25:35 +0000 (13:25 +0200)]
Revert aac29e2 as it is nonsense

6 years agoSet {r,t}xbytes 0 before incrementing them on OBSD
Aaron Marcher [Sat, 19 May 2018 11:19:53 +0000 (13:19 +0200)]
Set {r,t}xbytes 0 before incrementing them on OBSD

6 years agoMissing assignment for last commit
Aaron Marcher [Sat, 19 May 2018 11:12:06 +0000 (13:12 +0200)]
Missing assignment for last commit

6 years agoUnify and simplify netspeed logic and types
Aaron Marcher [Sat, 19 May 2018 11:07:05 +0000 (13:07 +0200)]
Unify and simplify netspeed logic and types

6 years agonetspeeds: added error condition for openbsd
Tobias Tschinkowitz [Sat, 19 May 2018 09:23:16 +0000 (11:23 +0200)]
netspeeds: added error condition for openbsd

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.

6 years agouptime: Format function is static
Aaron Marcher [Fri, 18 May 2018 23:55:31 +0000 (01:55 +0200)]
uptime: Format function is static

6 years agobattery: Move out struct as common code
Aaron Marcher [Fri, 18 May 2018 23:49:46 +0000 (01:49 +0200)]
battery: Move out struct as common code

6 years agoimplemented openbsd netspeed functions
Tobias Tschinkowitz [Fri, 18 May 2018 23:29:20 +0000 (01:29 +0200)]
implemented openbsd netspeed functions

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.

6 years agoAdd netspeeds to config.def.h
Aaron Marcher [Fri, 18 May 2018 22:40:59 +0000 (00:40 +0200)]
Add netspeeds to config.def.h

6 years agoAdd network speed functions
Aaron Marcher [Fri, 18 May 2018 22:31:33 +0000 (00:31 +0200)]
Add network speed functions

6 years agoImplement fmt_scaled for ram_* functions
Aaron Marcher [Fri, 18 May 2018 21:38:59 +0000 (23:38 +0200)]
Implement fmt_scaled for ram_* functions

6 years agoFix ram_free for Linux
Aaron Marcher [Fri, 18 May 2018 21:32:00 +0000 (23:32 +0200)]
Fix ram_free for Linux

6 years agoImplement fmt_scaled for swap_* functions
Aaron Marcher [Fri, 18 May 2018 21:19:18 +0000 (23:19 +0200)]
Implement fmt_scaled for swap_* functions