diff options
author | a@null <unknown> | 2008-12-12 19:34:43 +0000 |
---|---|---|
committer | a@null <unknown> | 2008-12-12 19:34:43 +0000 |
commit | 0cb05bdb75ac13f010d51e267007ca1c869763ec (patch) | |
tree | 6abddf90ff15c5eff7361b589c596efad83409d1 /slock.c | |
parent | cadc8a7472f4a77b26a89e27bce4479dc12afdbe (diff) | |
download | slock-0cb05bdb75ac13f010d51e267007ca1c869763ec.tar.gz slock-0cb05bdb75ac13f010d51e267007ca1c869763ec.tar.xz |
applied Ali Gholami Rudi's patch regarding DPMS timeout customization and persistence
Diffstat (limited to 'slock.c')
-rw-r--r-- | slock.c | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -79,6 +79,7 @@ main(int argc, char **argv) { 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,13 @@ main(int argc, char **argv) { len = 0; XSync(dpy, False); + if(DPMSCapable(dpy)) { /* save and customize DPMS settings */ + 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 +172,9 @@ main(int argc, char **argv) { } } } + if(DPMSCapable(dpy)) { /* restore DPMS settings */ + DPMSSetTimeouts(dpy, standby, suspend, off); + } XUngrabPointer(dpy, CurrentTime); XFreePixmap(dpy, pmap); XDestroyWindow(dpy, w); |