async (multithread) status bar

dm9pZCAq 0ddadb0052 version bump vor 3 Jahren
components 715d8d1b6f manage percent length from `config.h` instead of components vor 3 Jahren
.gitignore b1dc4a1153 finally its happened vor 4 Jahren
LICENSE ff14984243 added LICENSE vor 4 Jahren
Makefile e8d32fa88b Makefile: fix linking vor 3 Jahren
README.md 3f5af55eac move demo to ImgBB vor 3 Jahren
X.h 024f63aa8f use one connection to X server instead of two (aslstatus, keymap) vor 3 Jahren
arg.h 1dfac76ee4 add better handling of arguments vor 3 Jahren
aslstatus.1 2d69be3916 update man vor 3 Jahren
aslstatus.1.md 784feb733b add man page generation vor 3 Jahren
aslstatus.c 642d9810f9 aslstatus.c: add check to not exceed `MAXLEN` vor 3 Jahren
aslstatus.h 024f63aa8f use one connection to X server instead of two (aslstatus, keymap) vor 3 Jahren
components_config.h 2f89566e2a add `bspwm_ws` component for bspwm workspaces in lemonbar vor 3 Jahren
config.h 715d8d1b6f manage percent length from `config.h` instead of components vor 3 Jahren
config.mk 0ddadb0052 version bump vor 3 Jahren
os.h 940c8a0f4a fix static threads memory allocation vor 4 Jahren
thread_helper.h 647dd4cd1e finally add PulseAudio support vor 3 Jahren
util.c b167087e38 clang-format, replace `warn` with standard implementation vor 3 Jahren
util.h 03e1ffd1a1 move configurable options from source files to components_config.h vor 3 Jahren

README.md

ASLSTATUS


if you found any issues report it here

for all other questions, feel free to ask in matrix #aslstatus:matrix.org


demo


instalation

Gentoo

avaliable in my overlay:

eselect repository enable dm9pZCAq
emerge --sync dm9pZCAq
emerge app-admin/aslstatus::dm9pZCAq

if you wanna pack aslstatus for you distro, please do so and submit PR to add it here


compile

it is successfully compiling with

  • clang
  • tcc
  • gcc

needs pkg-config for LDLIBS

you can find out more in config.mk

make options

X

add support for X (needed for dwm WM_NAME)

you may want to set it to 0 if you use aslstatus in dvtm

  • default: 1
  • dependencies:
    • libxcb-dev

XKB

add support for keyboard (needed for keymap component)

works only if X=1

  • default: 1
  • dependencies:
    • libxcb-xkb-dev

AUDIO

select audio library

  • default: ALSA
  • possible values:
    • ALSA
    • PULSE
    • '' (empty) to use sys/soundcard.h or sys/audioio.h on OpenBSD
  • dependencies:
    • libasound-dev (if AUDIO=ALSA)
    • libpulse-dev (if AUDIO=PULSE)

config

for more info about configs see config.h and components_config.h

also you can change BUFF_SZ (see util.h)


components/

components were taken from slstatus and have been modified to work with pthread, some have been completely rewritten

all components are tested in Linux

if you are using OpenBSD or FreeBSD, please tell me if it works correctly, or if you have any problems


manual updating

just send USR1 signal to thread which you want to update


how to create you own component

create file with .c extension in components/

basic example

components/simple_module.c:

#include "../util.h"  /* you can find some useful functions in `util.c` */

void
function_name(char *out, const char __unused *arg,
		unsigned int __unused interval, void __unused *static_ptr)
{
	bprintf(out, "%s", "Hello, World!");
}

arg, interval and static_ptr is optional argument and if it is unused add __unused attribute

then put:

void function_name FUNC_ARGS;
#define function_name {function_name, "thread name", 0}

at the end of aslstatus.h

(FUNC_ARGS is already predefined)

complex example

components/my_module.c:

#include "../util.h"

void
my_module(char *out, const char *arg, unsigned int interval, void *static_ptr)
{
	float *static_data = static_ptr;
	if (!static_data)
		static_data = interval * 20.21;
	
	bprintf(
		out,
		"'%s' module with '%s' arg and '%u' interval, "
		"pointer to static_data is %p with '%f'",
		__FUNCTION__, arg, interval, static_ptr, static_data
	);
}

aslstatus.h:

/* ... */

void my_module FUNC_ARGS;
#define my_module {my_module, "My Module", sizeof(float)}

in define third field is size of static data to which point static_ptr

also in os.h defined 4 variables which can be used to set os specific data sizes in branchless way (see: this lines in aslstatus.h)


TODO

  • add pulseaudio support