On Sat, 13 Dec 2008 13:20:33, Thayer Williams <thayerw_AT_gmail.com> wrote: > On Sat, Dec 13, 2008 at 9:57 AM, Neale Pickett <neale_AT_woozle.org> wrote: > > Since the list is talking about slock, now might be an appropriate time > > for me to mention again my xss project: > > > > http://woozle.org/~neale/src/xss/ > > > > When I mailed the list about this in April someone responded with a neat > > thing called "sinac", which is a little smaller than xss, but polls, and > > only replaces one of the 6 programs in my package. Some folks may > > prefer it, combined with slock or xlock: > > > > http://lists.suckless.org/dwm/0804/5534.html > > Thanks for the info! I have been using xautolock until now. I'll > give xss a try soon. > > FWIW, I tried sinac before xautolock and I found that it consumed an > unusual amount of CPU resources in the range of 30-50%. Perhaps there > was an incompatibility with the latest Xorg server, I'm not sure. I > didn't stay with it long enough to find out.
That's cause sinac.c as posted used usleep while working with seconds. I fixed the usleep, switched to ulongs, and removed the argv code because processing arguments is retarded. Patrick /***************************************************************************** * * xidletime * * derived from xautolock supplied by * Authors: Michel Eyckmans (MCE) & Stefan De Troch (SDT) * * -------------------------------------------------------------------------- * * Copyright 1990,1992-1999,2001-2002 by Stefan De Troch and Michel Eyckmans. * Copyright 2005 by Stefan Siegl <[EMAIL PROTECTED]> * Copyright 2007 by Christian Dietrich <[EMAIL PROTECTED]> * * Versions 2.0 and above of xautolock are available under version 2 of the * GNU GPL. * * xidletime.c -Wall -L/usr/X11R6/lib -lX11 -lXss -lXext -o xidletime * *****************************************************************************/ #include <X11/Xos.h> #include <X11/Xlib.h> #include <X11/Xutil.h> #include <X11/Xatom.h> #include <X11/Xresource.h> #include <X11/extensions/scrnsaver.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #define VERSION "0.1.3" static XScreenSaverInfo* xss_info = 0; unsigned long msecs_idle(Display *d) { if (! xss_info ) xss_info = XScreenSaverAllocInfo(); XScreenSaverQueryInfo(d, DefaultRootWindow(d), xss_info); return xss_info->idle; } int main (int argc, char* argv[]) { Display* d; unsigned long wait = 0, idle; if (getenv("X_IDLE_SECONDS") != NULL) wait = atol(getenv("X_IDLE_SECONDS")) * 1000; if (!(d = XOpenDisplay (0))) { fprintf (stderr, "Couldn't connect to %s\n", XDisplayName (0)); return 1; } (void) XSync (d, 0); if (wait) while ((idle = msecs_idle(d)) < wait) usleep( (wait - idle) * 1000 ); else fprintf(stdout, "%ld\n", msecs_idle(d)); return 0; }