update status slightly

This commit is contained in:
speedie 2022-12-19 23:01:29 +01:00
parent e4671e7030
commit b0b2a697a2
2 changed files with 24 additions and 8 deletions

View file

@ -15,6 +15,8 @@
#include <err.h>
#define LENGTH(X) (sizeof(X) / sizeof (X[0]))
int isquit = 0;
typedef struct {
char* icon;
char* command;
@ -56,6 +58,7 @@ static volatile int statusContinue = 1;
static pthread_mutex_t write_mut = PTHREAD_MUTEX_INITIALIZER;
static void (*writestatus) () = setroot;
void replace(char *str, char old, char new)
{
for(char * c = str; *c; c++)
@ -291,6 +294,8 @@ statusloop()
while(statusContinue) {
syncwrite();
if (isquit)
exit(0);
pause();
}
@ -318,11 +323,22 @@ int main(int argc, char** argv)
{
for(int i = 0; i < argc; i++)
{
if (!strcmp("-d",argv[i]))
separator = argv[++i];
else if(!strcmp("-p",argv[i]))
if(!strcmp("-p",argv[i]))
writestatus = pstdout;
else if(!strcmp("-pq",argv[i])) {
isquit = 1;
writestatus = pstdout;
} else if (!strcmp("-h", argv[i])) {
fputs("status: speedwm status bar\n"
"\nUsage:\n\n"
"status -h Get help with status.\n"
"status -p Run status bar and print text to stdout.\n"
"status -pq Run status bar once and print text to stdout.\n"
, stderr);
exit(0);
}
}
signal(SIGTERM, termhandler);
signal(SIGINT, termhandler);
statusloop();

View file

@ -24,9 +24,9 @@ static const Module modules[] = {
{ "<\x03", "module_bat --print", 2, 3 },
{ "<\x04", "module_vol --print", 1, 4 },
{ "<\x05", "module_ram --print", 6, 5 },
{ "<\x01", "module_net --print", 10, 6 },
//{ "<\x01", "module_net --print", 10, 6 },
{ "<\x02", "module_temp --print", 5, 7 },
{ "<\x03", "module_weather --print", 60, 8 },
//{ "<\x03", "module_weather --print", 60, 8 },
{ "<\x04", "module_music --print", 1, 9 },
{ "<\x05", "module_dfmpeg --print", 5, 10 },
{ "<\x01", "module_news --print", 30, 11 },