Re: [dwm] Status text clock patch

From: John Mpanos <maihem666_AT_gmail.com>
Date: Fri, 11 Jul 2008 16:26:54 +0300

2008/7/11 Donald Chai <donald.chai_AT_gmail.com>:
>> 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);
>
>
>
Much thanks for the code, my mind was stuck on threads, but that is
much simpler.
I am on an 8 yeard old T-23, and dwm really makes it rock. Its as if
it was designed for the Thinkpad considering that the trackpoint keeps
your hands right on the right keys. Using dwm i feel liberated from
the "pointer device" :P

-- 
Dum inter homines sumus, colamus humanitatem.
Received on Fri Jul 11 2008 - 15:26:56 UTC

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