M README.md => README.md +5 -1
@@ 15,7 15,7 @@ Refer to [https://tools.suckless.org/slock/](https://tools.suckless.org/slock/)
### Changelog:
-2020-08-03 - Added keypress_feedback and blur_pixelated_screen patches
+2020-08-03 - Added alpha, keypress_feedback and blur_pixelated_screen patches
2019-11-27 - Added xresources patch
@@ 25,6 25,10 @@ Refer to [https://tools.suckless.org/slock/](https://tools.suckless.org/slock/)
### Patches included:
+ - [alpha](https://github.com/khuedoan/slock)
+ - enables transparency for slock
+ - intended to be combined with a compositor that can blur the transparent background
+
- [blur_pixelated_screen](https://tools.suckless.org/slock/patches/blur-pixelated-screen/)
- sets the lockscreen picture to a blured or pixelated screenshot
M config.def.h => config.def.h +6 -1
@@ 1,6 1,6 @@
/* user and group to drop privileges to */
static const char *user = "nobody";
-static const char *group = "nogroup";
+static const char *group = "nogroup"; // use "nobody" for arch
static const char *colorname[NUMCOLS] = {
[INIT] = "black", /* after initialization */
@@ 34,6 34,11 @@ ResourcePref resources[] = {
};
#endif // XRESOURCES_PATCH
+#if ALPHA_PATCH
+/* lock screen opacity */
+static const float alpha = 0.9;
+#endif // ALPHA_PATCH
+
/* treat a cleared input like a wrong password (color) */
static const int failonclear = 1;
M patches.def.h => patches.def.h +6 -0
@@ 9,6 9,12 @@
/* Patches */
+/* This patch enables transparency for slock. This is intended to be combined
+ * with a compositor that can blur the transparent background.
+ * Extrapolated from https://github.com/khuedoan/slock
+ */
+#define ALPHA_PATCH 0
+
/* This patch sets the lockscreen picture to a blured or pixelated screenshot.
* This patch depends on the Imlib2 library, uncomment the relevant line in
* config.mk when enabling this patch.
M slock.c => slock.c +8 -0
@@ 20,6 20,9 @@
#include <X11/Xutil.h>
#include "patches.h"
+#if ALPHA_PATCH
+#include <X11/Xatom.h>
+#endif // ALPHA_PATCH
#if KEYPRESS_FEEDBACK_PATCH
#include <time.h>
#endif // KEYPRESS_FEEDBACK_PATCH
@@ 439,6 442,11 @@ lockscreen(Display *dpy, struct xrandr *rr, int screen)
#if QUICKCANCEL_PATCH
locktime = time(NULL);
#endif // QUICKCANCEL_PATCH
+ #if ALPHA_PATCH
+ unsigned int opacity = (unsigned int)(alpha * 0xffffffff);
+ XChangeProperty(dpy, lock->win, XInternAtom(dpy, "_NET_WM_WINDOW_OPACITY", False), XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&opacity, 1L);
+ XSync(dpy, False);
+ #endif // ALPHA_PATCH
return lock;
}