some improvements

This commit is contained in:
speedie 2022-12-16 20:01:45 +01:00
parent f17bd61314
commit 0c07a1740f
2 changed files with 31 additions and 7 deletions

View file

@ -44,7 +44,7 @@ PRINT() {
# argument 1
case "$1" in
"") CLICK ;;
"--print-file") PRINT > /tmp/module_bat ;;
"--print-file") PRINT > /tmp/module_email ;;
"--print") PRINT ;;
"--click") CLICK ;;
esac

View file

@ -172,6 +172,17 @@ int
getstatus(char *str, char *last)
{
strcpy(last, str);
const Module *module;
int ic = strlen(module->icon);
/*
if (s && hideemptymodule)
strcpy(output, module->icon);
else if (!hideemptymodule)
strcpy(output, module->icon);
*/
str[0] = '\0';
if (leftpadding[0] != '\0')
strcat(str, leftpadding);
@ -179,14 +190,28 @@ getstatus(char *str, char *last)
strcat(str, statusbar[i]);
if (i == LENGTH(modules) - 1)
strcat(str, " ");
if (str = ic && hideemptymodule) {
int i = 0, len = ic, j = 0;
for (i = 0; i < len; i++) {
if (str[i] == ic) {
for (j = i; j < len; j++)
str[j] = str[j + 1];
len--;
i;;
}
}
}
}
str[strlen(str)-1] = '\0';
if (rightpadding[0] != '\0')
strcat(str, rightpadding);
return strcmp(str, last);
}
void setroot()
void
setroot()
{
if (!getstatus(statusstr[0], statusstr[1]))
return;
@ -200,7 +225,8 @@ void setroot()
XCloseDisplay(dpy);
}
void pstdout()
void
pstdout()
{
if (!getstatus(statusstr[0], statusstr[1]))
return;
@ -209,11 +235,9 @@ void pstdout()
}
void statusloop()
void
statusloop()
{
#ifndef __OpenBSD__
setupsignals();
#endif
setupsignals();
getcmds();