diff options
-rw-r--r-- | config.mk | 2 | ||||
-rw-r--r-- | slock.c | 13 |
2 files changed, 10 insertions, 5 deletions
@@ -1,5 +1,5 @@ | |||
1 | # slock version | 1 | # slock version |
2 | VERSION = 0.9 | 2 | VERSION = 1.0 |
3 | 3 | ||
4 | # Customize below to fit your system | 4 | # Customize below to fit your system |
5 | 5 | ||
@@ -79,6 +79,7 @@ main(int argc, char **argv) { | |||
79 | XColor black, dummy; | 79 | XColor black, dummy; |
80 | XEvent ev; | 80 | XEvent ev; |
81 | XSetWindowAttributes wa; | 81 | XSetWindowAttributes wa; |
82 | CARD16 standby, suspend, off; | ||
82 | 83 | ||
83 | if((argc == 2) && !strcmp("-v", argv[1])) | 84 | if((argc == 2) && !strcmp("-v", argv[1])) |
84 | die("slock-"VERSION", © 2006-2008 Anselm R Garbe\n"); | 85 | die("slock-"VERSION", © 2006-2008 Anselm R Garbe\n"); |
@@ -123,12 +124,13 @@ main(int argc, char **argv) { | |||
123 | len = 0; | 124 | len = 0; |
124 | XSync(dpy, False); | 125 | XSync(dpy, False); |
125 | 126 | ||
127 | if(DPMSCapable(dpy)) { /* save and customize DPMS settings */ | ||
128 | DPMSGetTimeouts(dpy, &standby, &suspend, &off); | ||
129 | DPMSSetTimeouts(dpy, 10, 30, 90); | ||
130 | } | ||
131 | |||
126 | /* main event loop */ | 132 | /* main event loop */ |
127 | while(running && !XNextEvent(dpy, &ev)) { | 133 | while(running && !XNextEvent(dpy, &ev)) { |
128 | if(len == 0 && DPMSCapable(dpy)) { | ||
129 | DPMSEnable(dpy); | ||
130 | DPMSForceLevel(dpy, DPMSModeOff); | ||
131 | } | ||
132 | if(ev.type == KeyPress) { | 134 | if(ev.type == KeyPress) { |
133 | buf[0] = 0; | 135 | buf[0] = 0; |
134 | num = XLookupString(&ev.xkey, buf, sizeof buf, &ksym, 0); | 136 | num = XLookupString(&ev.xkey, buf, sizeof buf, &ksym, 0); |
@@ -170,6 +172,9 @@ main(int argc, char **argv) { | |||
170 | } | 172 | } |
171 | } | 173 | } |
172 | } | 174 | } |
175 | if(DPMSCapable(dpy)) { /* restore DPMS settings */ | ||
176 | DPMSSetTimeouts(dpy, standby, suspend, off); | ||
177 | } | ||
173 | XUngrabPointer(dpy, CurrentTime); | 178 | XUngrabPointer(dpy, CurrentTime); |
174 | XFreePixmap(dpy, pmap); | 179 | XFreePixmap(dpy, pmap); |
175 | XDestroyWindow(dpy, w); | 180 | XDestroyWindow(dpy, w); |