Make i3lock fork(), use white color and disable DPMS

The idea of fork()ing is to allow for aliases which first lock the screen,
then suspend.

White color and no DPMS is better than black color because you can tell the
difference between your notebook failed to suspend and it being locked.
This commit is contained in:
Michael Stapelberg 2009-03-09 18:20:15 +01:00
parent 2a1e9a6ea4
commit 3f482bd3b3
1 changed files with 4 additions and 6 deletions

View File

@ -15,7 +15,6 @@
#include <X11/keysym.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/extensions/dpms.h>
#if HAVE_BSD_AUTH
#include <login_cap.h>
@ -94,9 +93,12 @@ main(int argc, char **argv) {
screen = DefaultScreen(dpy);
root = RootWindow(dpy, screen);
if (fork() != 0)
return 0;
/* init */
wa.override_redirect = 1;
wa.background_pixel = BlackPixel(dpy, screen);
wa.background_pixel = WhitePixel(dpy, screen);
w = XCreateWindow(dpy, root, 0, 0, DisplayWidth(dpy, screen), DisplayHeight(dpy, screen),
0, DefaultDepth(dpy, screen), CopyFromParent,
DefaultVisual(dpy, screen), CWOverrideRedirect | CWBackPixel, &wa);
@ -125,10 +127,6 @@ main(int argc, char **argv) {
/* 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);