UtkarshVerma / dwmblocks-async

An efficient, lean, and asynchronous status feed generator for dwm.
GNU General Public License v2.0
224 stars 87 forks source link

Inconsistent logic on time intervals #55

Closed Xenorf closed 8 months ago

Xenorf commented 8 months ago

Hi there, first of all thank you for this incredible tool I really like it.

I use scripts that trigger on events with the kill command and everything updates smoothly. The problem I have is with time intervals. I will take the date as an example, if the time interval is 1 then the date updates every second as it should but when I put 5 in the config.h the time updates every 25 seconds and when I go to 30 or 60 seconds then it never updates.

config.h

#ifndef CONFIG_H
#define CONFIG_H

// String used to delimit block outputs in the status.
#define DELIMITER "  "

// Maximum number of Unicode characters that a block can output.
#define MAX_BLOCK_OUTPUT_LENGTH 45

// Control whether blocks are clickable.
#define CLICKABLE_BLOCKS 1

// Control whether a leading delimiter should be prepended to the status.
#define LEADING_DELIMITER 0

// Control whether a trailing delimiter should be appended to the status.
#define TRAILING_DELIMITER 1

// Define blocks for the status feed as X(cmd, interval, signal).
#define BLOCKS(X)         \
    X("sb-connection", 0, 14)   \
    X("sb-volume", 0, 13)   \
    X("sb-battery", 0, 12) \
    X("sb-date", 5, 11)   \

#endif  // CONFIG_H

sb-date

#!/bin/sh
echo " $(date '+%I:%M:%S %p')"

Thanks for the help!

UtkarshVerma commented 8 months ago

Thanks for the issue. It was a bug indeed and I pushed changes to address it. Please feel free to close the issue if it works for you.

Xenorf commented 8 months ago

Your fix works like a charm. Thank you for your quick response!