Very nice idea. But there are some things I want to note:
... && argv[i+1])
very bad idea to test for argv[i+1]. Use "i+1 < argc" instead
--- while (seconds_idle(d) < wait) usleep(500000); Polling is unneeded here. What do you think about this: while (seconds_idle(d) < wait) sleep(wait - seconds_idle(d)); (maybe you can store seconds_idle(d) in a var to avoid unneeded Xserver polling) --- else if (strcmp(argv[i], "-s") == 0 && argv[i+1]) usleep(1000000 * atoi(argv[++i])); What's that? - I think this is only a builtin sleep replacement. Am I right? - Is it really needed? --- Hmm... I dislike this for-loop. It's unneeded, isn't it :) Nevertheless a very good idea, I like it. regards Gottox 2007/12/28, Christian Dietrich <stettberger_AT_dokucode.de>: > Hi, > i searched for a replacement for the autolock feature of xscreensaver with > slock. So i worked on an older piece of code, written by a friend of me. > The result is sinac (simple inactive). Which can print out the inactive > time of the X session or wait until the inactive timer has reached an > specific value. > > Sinac uses the xscreensaver x extention, so you have to install > libxss-dev. You can compile the attached sinac.c file with: > > gcc sinac.c -L/usr/X11R6/lib -lX11 -lXss -lXext -o sinac > > And now lets build an autolocker with sinac & slock: > > while true; do ./sinac -w 300 && slock; done > > greetz > didi > > -- > No documentation is better than bad documentation > > -- http://www.gnuffy.org - Real Community Distro http://www.gnuffy.org/index.php/GnuEm - Gnuffy on Ipaq (Codename Peggy)Received on Fri Dec 28 2007 - 21:22:32 UTC
This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:14:23 UTC