mirror of
https://github.com/mintycube/slock.git
synced 2024-10-22 14:05:51 +02:00
applied Ali Gholami Rudi's patch regarding DPMS timeout customization and persistence
This commit is contained in:
parent
cadc8a7472
commit
0cb05bdb75
@ -1,5 +1,5 @@
|
|||||||
# slock version
|
# slock version
|
||||||
VERSION = 0.9
|
VERSION = 1.0
|
||||||
|
|
||||||
# Customize below to fit your system
|
# Customize below to fit your system
|
||||||
|
|
||||||
|
13
slock.c
13
slock.c
@ -79,6 +79,7 @@ main(int argc, char **argv) {
|
|||||||
XColor black, dummy;
|
XColor black, dummy;
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
XSetWindowAttributes wa;
|
XSetWindowAttributes wa;
|
||||||
|
CARD16 standby, suspend, off;
|
||||||
|
|
||||||
if((argc == 2) && !strcmp("-v", argv[1]))
|
if((argc == 2) && !strcmp("-v", argv[1]))
|
||||||
die("slock-"VERSION", © 2006-2008 Anselm R Garbe\n");
|
die("slock-"VERSION", © 2006-2008 Anselm R Garbe\n");
|
||||||
@ -123,12 +124,13 @@ main(int argc, char **argv) {
|
|||||||
len = 0;
|
len = 0;
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
|
|
||||||
|
if(DPMSCapable(dpy)) { /* save and customize DPMS settings */
|
||||||
|
DPMSGetTimeouts(dpy, &standby, &suspend, &off);
|
||||||
|
DPMSSetTimeouts(dpy, 10, 30, 90);
|
||||||
|
}
|
||||||
|
|
||||||
/* main event loop */
|
/* main event loop */
|
||||||
while(running && !XNextEvent(dpy, &ev)) {
|
while(running && !XNextEvent(dpy, &ev)) {
|
||||||
if(len == 0 && DPMSCapable(dpy)) {
|
|
||||||
DPMSEnable(dpy);
|
|
||||||
DPMSForceLevel(dpy, DPMSModeOff);
|
|
||||||
}
|
|
||||||
if(ev.type == KeyPress) {
|
if(ev.type == KeyPress) {
|
||||||
buf[0] = 0;
|
buf[0] = 0;
|
||||||
num = XLookupString(&ev.xkey, buf, sizeof buf, &ksym, 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);
|
XUngrabPointer(dpy, CurrentTime);
|
||||||
XFreePixmap(dpy, pmap);
|
XFreePixmap(dpy, pmap);
|
||||||
XDestroyWindow(dpy, w);
|
XDestroyWindow(dpy, w);
|
||||||
|
Loading…
Reference in New Issue
Block a user