Go to file
Tobias Stoeckmann 35295f1902 On success, fgets always terminates the result.
If fgets succeeds, then the resulting char array is always
terminated by a '\0'. No need to keep extra space, therefore
sizeof(buf) is the correct argument.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2017-04-04 21:27:31 +02:00
.gitignore added config.def.h handling and fixed typo 2016-03-04 18:36:47 +01:00
CONTRIBUTING.md README.md reloaded 2016-09-18 17:51:25 +02:00
CONTRIBUTORS.md homepage update 2016-12-27 20:20:45 +03:00
LICENSE happy new year! 2017-01-07 21:28:22 +01:00
Makefile Makefile fix and vol_perc fix for mute 2017-01-09 12:05:29 +01:00
README.md Added keyboard_indicators (Fixes #31) 2017-01-16 12:10:56 +01:00
TODO.md todo 2017-01-07 22:34:45 +01:00
arg.h removed ./extern/ 2017-01-07 22:33:28 +01:00
config.def.h Added keyboard_indicators (Fixes #31) 2017-01-16 12:10:56 +01:00
config.mk saner makefile: cleaner, simpler, suckless 2017-01-07 21:49:10 +01:00
slstatus.1 why releases for such a small project? useless and overhead! 2016-12-29 23:36:05 +01:00
slstatus.c On success, fgets always terminates the result. 2017-04-04 21:27:31 +02:00
slstatus.png added my fancy icon 2016-09-09 21:12:13 +02:00

README.md

slstatus

slstatus is a suckless and lightweight status monitor for window managers that use WM_NAME as statusbar (e.g. DWM) or any other status bars if they support reading/piping from slstatus. It is written in pure C without any extern programs being executed and only reads from files most of the time. slstatus is meant to be a better alternative to Bash scripts (inefficient) and Conky (bloated and written in C++).

If you write a bash script that shows system information in WM_NAME (or any other status bar), it executes a huge amount of external commands (top, free etc.) every few seconds. This results in high system resource usage. slstatus solves this problem by only using C libraries and/or reading from files in sysfs/procfs most of the time.

Looking at the LOC (lines of code) of the Conky project, it is very interesting: 28346 lines C++, 219 lines Python and 110 lines Lua. slstatus currently has about 800 lines of clean documented C code and even includes additional possibilities as it can be customized and extended very easily. Configuring it by customizing the config.h (C header) file is very secure and fast as no config files are parsed at runtime.

The following information is included:

  • Battery percentage/state
  • CPU usage (in percent)
  • Custom shell commands
  • Date and time
  • Disk[s] status (free storage, percentage, total storage and used storage)
  • Available entropy
  • Username/GID/UID
  • Hostname
  • IP addresses
  • Kernel version
  • Keyboard indicators
  • Load averages
  • Memory status (free memory, percentage, total memory and used memory)
  • Swap status (free swap, percentage, total swap and used swap)
  • Temperature
  • Uptime
  • Volume percentage (OSS/ALSA)
  • WiFi signal percentage and ESSID

Multiple entries per function (e.g. multiple batteries) are supported and everything can be reordered and customized via a C header file (similar to other suckless programs).

Usage

Installation

Be sure you satisfy the dependencies: X11 and optionally ALSA (for volume percentage, I will not support PulseAudio). Also you should have basic development tools like a C compiler and GNU make installed. Then copy config.def.h to config.h and customize it to your needs. (Re)Compile (and install) it (after modifications):

$ make clean all
# make install

Starting

If you use DWM or any other window manager that uses WM_NAME, write the following code to ~/.xinitrc (or any other initialization script) to start slstatus automatically:

slstatus -d

If you use any other status bar or window manager you will have to figure it out yourself. Something like this could fit your requirements:

slstatus -o | other_status_bar &

Specific function quirks

  • Volume percentage

If there is no /dev/mixer on your system and you use ALSA, it means you have to load the OSS compatibility module by issuing:

# modprobe snd-pcm-oss

Contributing

Hunt FIXME's in the code or do WTF you want! If it is useful, I will merge.

People who contributed are listed in CONTRIBUTORS.md. Please add yourself to this list afterwards.

For detailed information about coding style and restrictions see CONTRIBUTING.md.

License

See LICENSE.