Retain brightness when entering screenlock
This commit is contained in:
parent
7b3be0453a
commit
cf4cd1b8df
1 changed files with 4 additions and 4 deletions
|
@ -25,7 +25,7 @@ static Display *dpy;
|
||||||
static enum State state = StateNoInput;
|
static enum State state = StateNoInput;
|
||||||
static int lastkeysym = NULL;
|
static int lastkeysym = NULL;
|
||||||
static int lastkeyn = 0;
|
static int lastkeyn = 0;
|
||||||
static char * oldbrightness = "200";
|
static char oldbrightness[10] = "200";
|
||||||
static char * brightnessfile = "/sys/devices/platform/backlight/backlight/backlight/brightness";
|
static char * brightnessfile = "/sys/devices/platform/backlight/backlight/backlight/brightness";
|
||||||
static char * powerstatefile = "/sys/power/state";
|
static char * powerstatefile = "/sys/power/state";
|
||||||
|
|
||||||
|
@ -71,12 +71,12 @@ syncstate()
|
||||||
syncstate();
|
syncstate();
|
||||||
} else if (state == StateNoInput) {
|
} else if (state == StateNoInput) {
|
||||||
setpineled(Blue);
|
setpineled(Blue);
|
||||||
writefile(brightnessfile, "200");
|
writefile(brightnessfile, oldbrightness);
|
||||||
} else if (state == StateNoInputNoScreen) {
|
} else if (state == StateNoInputNoScreen) {
|
||||||
setpineled(Purple);
|
setpineled(Purple);
|
||||||
writefile(brightnessfile, "0");
|
writefile(brightnessfile, "0");
|
||||||
} else if (state == StateDead) {
|
} else if (state == StateDead) {
|
||||||
writefile(brightnessfile, "200");
|
writefile(brightnessfile, oldbrightness);
|
||||||
setpineled(Off);
|
setpineled(Off);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -171,7 +171,7 @@ getoldbrightness() {
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
if (buffer) {
|
if (buffer) {
|
||||||
oldbrightness = buffer;
|
sprintf(oldbrightness, "%d", atoi(buffer));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue