diff options
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | binstatus.c | 11 |
2 files changed, 7 insertions, 6 deletions
@@ -1,4 +1,4 @@ -By default this program will set your root windows name to the time in binary, however if you set the environment variable binstatus to 'dec' (export binstatus=dec) it will display the time as hh:mm. +By default this program will set your root windows name to the time in binary, however if you set the environment variable binstatus to 'dec' (export binstatus=dec) it will display the time as hh:mm. 'bin' is also a valid value, that will be the time in binary. Any other value will not output anything, dwm or your window manager may use its own string. compile: diff --git a/binstatus.c b/binstatus.c index 046e09e..c521677 100644 --- a/binstatus.c +++ b/binstatus.c @@ -43,15 +43,16 @@ void formatstring(char *status, int *time) { char *env = getenv("binstatus"); - if (strcmp(env, "dec") == 0) - { - snprintf(status, MAXLENGTH, "%02d:%02d", time[0], time[1]); - } - else + if (!env || strcmp(env, "bin") == 0) { + snprintf(status, MAXLENGTH, "%05d %06d", dectobin(time[0]), dectobin(time[1])); } + else if (strcmp(env, "dec") == 0) + { + snprintf(status, MAXLENGTH, "%02d:%02d", time[0], time[1]); + } } int |