mirror of
https://github.com/mintycube/dwmblocks.git
synced 2024-10-22 14:05:47 +02:00
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 CMDLENGTH 50
|
||||||
#define delimiter " "
|
#define delimiter " "
|
||||||
|
|
||||||
static const Block blocks[] = {
|
const Block blocks[] = {
|
||||||
{"sb-mail", 1800, 1},
|
{"sb-mail", 1800, 1},
|
||||||
{"sb-music", 0, 2},
|
{"sb-music", 0, 2},
|
||||||
{"sb-disk", 1800, 4},
|
{"sb-disk", 1800, 4},
|
||||||
|
6
main.c
6
main.c
@ -70,8 +70,7 @@ void getCommands(int time) {
|
|||||||
const Block *current;
|
const Block *current;
|
||||||
for (int i = 0; i < len(blocks); i++) {
|
for (int i = 0; i < len(blocks); i++) {
|
||||||
current = blocks + i;
|
current = blocks + i;
|
||||||
if ((current->interval != 0 && time % current->interval == 0) ||
|
if (time == -1 || (current->interval != 0 && time % current->interval == 0))
|
||||||
time == -1)
|
|
||||||
getCommand(current, statusbar[i]);
|
getCommand(current, statusbar[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -177,6 +176,8 @@ void setupSignals() {
|
|||||||
|
|
||||||
void statusLoop() {
|
void statusLoop() {
|
||||||
setupSignals();
|
setupSignals();
|
||||||
|
getCommands(-1);
|
||||||
|
writeStatus();
|
||||||
|
|
||||||
unsigned int sleepInterval = -1;
|
unsigned int sleepInterval = -1;
|
||||||
for (int i = 0; i < len(blocks); i++)
|
for (int i = 0; i < len(blocks); i++)
|
||||||
@ -186,7 +187,6 @@ void statusLoop() {
|
|||||||
unsigned int i = 0;
|
unsigned int i = 0;
|
||||||
struct timespec sleepTime = {sleepInterval, 0};
|
struct timespec sleepTime = {sleepInterval, 0};
|
||||||
struct timespec toSleep = sleepTime;
|
struct timespec toSleep = sleepTime;
|
||||||
getCommands(-1);
|
|
||||||
|
|
||||||
while (statusContinue) {
|
while (statusContinue) {
|
||||||
// Sleep for `sleepTime` even on being interrupted
|
// Sleep for `sleepTime` even on being interrupted
|
||||||
|
Loading…
Reference in New Issue
Block a user