async (multithread) status bar for dwm

dm9pZCAq 6f309c457f README.md: add info about static data allocation 2 months ago
TODO b1dc4a1153 finally its happened 9 months ago
components d6ecef2aa8 components/wifi.c: add unused args 2 months ago
imgs e2e804c010 demonstration 9 months ago
.gitignore b1dc4a1153 finally its happened 9 months ago
LICENSE ff14984243 added LICENSE 9 months ago
Makefile 29f16b8f1f refactor Makefile 2 months ago
README.md 6f309c457f README.md: add info about static data allocation 2 months ago
aslstatus.1 2955fcd1de fixed manual 9 months ago
aslstatus.c 940c8a0f4a fix static threads memory allocation 2 months ago
aslstatus.h 384b798760 aslstatus.h: fix cpu_perc on BSD 2 months ago
config.h 839bbe7661 components/temperature: added ability to specify thermal device 4 months ago
config.mk 29f16b8f1f refactor Makefile 2 months ago
os.h 940c8a0f4a fix static threads memory allocation 2 months ago
util.c b1dc4a1153 finally its happened 9 months ago
util.h 940c8a0f4a fix static threads memory allocation 2 months ago

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


compile

it is successfully compiling with

  • clang
  • tcc
  • gcc

you can find out more in config.mk

and add some optimization with uncommenting LTO and OPT


config

for more info about configs see config.h

also you can change BUFF_SZ (see util.h)

to use ALSA:

make AUDIO=ALSA

pulseaudio in development (see there)


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)


pulseaudio

not yet implemented at all with C (see components/volume.c), but you can temporary use run_command with pulse_volume (see config.h)

if anyone can help me with it, then i will gladly accept yours pull requests (if they don't suck to much)

you can find some demo code in TODO/pulse.c

but it has problems using with threads as component


TODO

  • rewrite run_command to redirect stderr to /dev/null
  • add pulseaudio support