when a desktop is focused but not occupied, include it in the display

This commit is contained in:
randomuser 2022-09-20 16:40:18 -05:00
parent c97943855f
commit 474ac61f6e
1 changed files with 10 additions and 4 deletions

14
bspc.c
View File

@ -309,14 +309,20 @@ int bspwm_update(struct module *module) {
current[1] = '\0';
for(int i = 0; i < MODULE_BUFFER_LEN; i++) {
if(module->buffer[i] == '\0') {
/* XXX: susceptible to buffer underflow */
if(i) module->buffer[i - 1] = '\0';
if(module->buffer[i] == '\0' && i) {
if(*current != '\0' && i <= MODULE_BUFFER_LEN - 2) {
module->buffer[i - 1] = ' ';
module->buffer[i] = *current;
module->buffer[i + 1] = '<';
module->buffer[i + 2] = '\0';
} else module->buffer[i - 1] = '\0';
break;
}
if(isdigit(module->buffer[i]) && *current == module->buffer[i])
if(isdigit(module->buffer[i]) && *current == module->buffer[i]) {
/* XXX: susceptible to buffer overflow */
if(i == MODULE_BUFFER_LEN) module->buffer[i + 1] = '<';
*current = '\0';
}
if(module->buffer[i] == '\n')
module->buffer[i] = ' ';
}