Re: [dwm] Status text clock patch

From: Donald Chai <donald.chai_AT_gmail.com>
Date: Fri, 11 Jul 2008 00:58:59 -0700

> Any help would be appreciated, and also how could i do the same
> without using threads?

This seems to work fine for me...

--- a/dwm.c Thu Jul 03 17:05:56 2008 +0100
+++ b/dwm.c Fri Jul 11 00:26:08 2008 -0700
@@ -1313,11 +1313,28 @@ setmfact(const Arg *arg) {
         arrange();
  }

+#include <time.h>
+
+void
+updatestatus(int signum) {
+ time_t t = time(0);
+ struct tm *ctm = localtime(&t);
+
+ strftime(stext, sizeof(stext), "%T", ctm);
+ drawbar();
+
+ signal(SIGALRM, updatestatus);
+ alarm(1);
+}
+
  void
  setup(void) {
         uint i;
         int w;
         XSetWindowAttributes wa;
+
+ signal(SIGALRM, updatestatus);
+ alarm(1);

         /* init screen */
         screen = DefaultScreen(dpy);
Received on Fri Jul 11 2008 - 09:57:59 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:54:02 UTC