Re: [dwm] [slock] slock doesn't like to deactivate after password entry

From: Ali Gholami Rudi <aliqrudi_AT_gmail.com>
Date: Tue, 9 Dec 2008 16:15:02 +0330

Hi,

On Mon, Dec 08, 2008 at 04:00:48PM -0800, Thayer Williams wrote:
> I've been using slock for about two months now and, as per the
> subject, slock doesn't release my screen right away after a valid
> password entry. After inputing the password and pressing Enter, the
> screen remains blanked and no amount of input brings it up. I can
> actually see the LCD backlight flicking on and off with each
> subsequent keypress or mouse wiggle.

I don't know how to handle others, but I use this patch for handling the
flickering problem. AFAIK turning a lamp on and off excessively
decreases its lifetime; that might be true for displays, too.

Regards,
Ali

diff --git a/slock.c b/slock.c
--- a/slock.c
+++ b/slock.c
@@ -79,6 +79,7 @@
         XColor black, dummy;
         XEvent ev;
         XSetWindowAttributes wa;
+ CARD16 standby, suspend, off;
 
         if((argc == 2) && !strcmp("-v", argv[1]))
                 die("slock-"VERSION", © 2006-2008 Anselm R Garbe\n");
@@ -123,12 +124,14 @@
         len = 0;
         XSync(dpy, False);
 
+ /* save and customize DPMS settings */
+ if (DPMSCapable(dpy)) {
+ DPMSGetTimeouts(dpy, &standby, &suspend, &off);
+ DPMSSetTimeouts(dpy, 10, 30, 90);
+ }
+
         /* main event loop */
         while(running && !XNextEvent(dpy, &ev)) {
- if(len == 0 && DPMSCapable(dpy)) {
- DPMSEnable(dpy);
- DPMSForceLevel(dpy, DPMSModeOff);
- }
                 if(ev.type == KeyPress) {
                         buf[0] = 0;
                         num = XLookupString(&ev.xkey, buf, sizeof buf, &ksym, 0);
@@ -170,6 +173,10 @@
                         }
                 }
         }
+ /* restore DPMS settings */
+ if (DPMSCapable(dpy)) {
+ DPMSSetTimeouts(dpy, standby, suspend, off);
+ }
         XUngrabPointer(dpy, CurrentTime);
         XFreePixmap(dpy, pmap);
         XDestroyWindow(dpy, w);
Received on Tue Dec 09 2008 - 12:45:02 UTC

This archive was generated by hypermail 2.2.0 : Tue Dec 09 2008 - 12:48:04 UTC