Update to slock so that it uses systemctl suspend

This commit is contained in:
Adam Fordsmand 2021-02-12 16:29:18 +01:00
parent e4864c25c0
commit 515521eb0d
6 changed files with 46 additions and 2 deletions

View File

@ -27,6 +27,7 @@ static const char * font_name = "-b&h-lucidabright-medium-r-normal--20-200-75-75
//-bitstream-charter-medium-i-normal--0-0-75-75-p-0-iso8859-1
#define SCREENSLEEP
//#define SCREENSLEEPBACKLIGHT
/*Enable blur*/
#define BLUR

39
config.h Normal file
View File

@ -0,0 +1,39 @@
/* user and group to drop privileges to */
static const char *user = "adam";
static const char *group = "adam";
static const char *colorname[NUMCOLS] = {
[INIT] = "black", /* after initialization */
[INPUT] = "#005577", /* during input */
[FAILED] = "#CC3333", /* wrong password */
};
/* treat a cleared input like a wrong password (color) */
static const int failonclear = 1;
/* time in seconds to cancel lock with mouse movement */
static const int timetocancel = 4;
/* default message */
static const char * message = "Input Password:";
/* text color */
static const char * text_color = "#ffffff";
/* text size (must be a valid size) */
static const char * font_name = "-b&h-lucidabright-medium-r-normal--20-200-75-75-p-200-iso8859-1" ;
//-Misc-Fixed-Medium-R-Normal--20-200-75-75-C-100-ISO10646-1
//-misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso8859-1
//-bitstream-charter-medium-i-normal--0-0-75-75-p-0-iso8859-1
#define SCREENSLEEP
//#define SCREENSLEEPBACKLIGHT
/*Enable blur*/
#define BLUR
/*Set blur radius*/
static const int blurRadius=10;
/*Enable Pixelation*/
#define PIXELATION
/*Set pixelation radius*/
static const int pixelSize=30;

Binary file not shown.

BIN
slock Executable file

Binary file not shown.

View File

@ -262,7 +262,7 @@ readpw(Display *dpy, struct xrandr *rr, struct lock **locks, int nscreens,
while (running && !XNextEvent(dpy, &ev)) {
if (ev.type == KeyPress) {
#ifdef SCREENSLEEP
#ifdef SCREENSLEEPBACKLIGHT
char* tmpSTR;
if(0 > asprintf(&tmpSTR, "xbacklight -set %f", priorBackLight)) tmpSTR = "xbacklight -set 100";
system(tmpSTR);
@ -564,11 +564,15 @@ main(int argc, char **argv) {
#endif
#ifdef SCREENSLEEP
#ifdef SCREENSLEEPBACKLIGHT
priorBackLight = getPriorBackLight();
system("xbacklight -set 0");
#endif
#ifdef SCREENSLEEP
system("systemctl suspend");
#endif
/* check for Xrandr support */
rr.active = XRRQueryExtension(dpy, &rr.evbase, &rr.errbase);

BIN
slock.o

Binary file not shown.