Fix slow loading on first status printing.
This commit is contained in:
parent
5465c43cff
commit
62b67552e6
2
config.h
2
config.h
|
@ -1,7 +1,7 @@
|
|||
#define CMDLENGTH 50
|
||||
#define delimiter " "
|
||||
|
||||
static const Block blocks[] = {
|
||||
const Block blocks[] = {
|
||||
{"sb-mail", 1800, 1},
|
||||
{"sb-music", 0, 2},
|
||||
{"sb-disk", 1800, 4},
|
||||
|
|
6
main.c
6
main.c
|
@ -70,8 +70,7 @@ void getCommands(int time) {
|
|||
const Block *current;
|
||||
for (int i = 0; i < len(blocks); i++) {
|
||||
current = blocks + i;
|
||||
if ((current->interval != 0 && time % current->interval == 0) ||
|
||||
time == -1)
|
||||
if (time == -1 || (current->interval != 0 && time % current->interval == 0))
|
||||
getCommand(current, statusbar[i]);
|
||||
}
|
||||
}
|
||||
|
@ -177,6 +176,8 @@ void setupSignals() {
|
|||
|
||||
void statusLoop() {
|
||||
setupSignals();
|
||||
getCommands(-1);
|
||||
writeStatus();
|
||||
|
||||
unsigned int sleepInterval = -1;
|
||||
for (int i = 0; i < len(blocks); i++)
|
||||
|
@ -186,7 +187,6 @@ void statusLoop() {
|
|||
unsigned int i = 0;
|
||||
struct timespec sleepTime = {sleepInterval, 0};
|
||||
struct timespec toSleep = sleepTime;
|
||||
getCommands(-1);
|
||||
|
||||
while (statusContinue) {
|
||||
// Sleep for `sleepTime` even on being interrupted
|
||||
|
|
Loading…
Reference in New Issue