OpenGL extension to the simple screen locker slock
Inspired by this reddit post this lock screen was implemented using the simplest lock program I could find. gllock will obscure the screen using an opengl texture shader.
In order to build gllock you need the following packages:
- x11proto-core-dev for
#include <X11/keysym.h>
- libx11-dev for
#include <X11/Xlib.h>
- libglew-dev for
#include <GL/glew.h>
The other requirement will be fulfilled automatically when installing the above.
Edit config.mk
to match your local setup (gllock is installed into the /usr/local
namespace by default).
SHADER_LOCATION
- location of the shader files (default~/.gllock/
which is a symlink to the shader folder of the repository)FRGMNT_SHADER
- the shader file to use (default circle.fragment.glsl)
The following command builds and installs gllock:
> sudo make clean install
Simply invoke the 'gllock' command. To get out of it, enter your password. However the typical setup involves using gllock with xautolock. For example in order to run gllock after N minutes of inactivity the following command may be used.
> sudo xautolock -time N -locker "gllock" &
when using a particular fragment shader you may want to figure out the supported glsl version for your system using
> glxinfo | grep 'version'
as explained here and then make the necessary modifications to the shader files.
Most opengl texture shaders from Shadertoy may be adapted to gllock with minimal modifications. You may use the following substitutions as a starting point.
-
use
uniform vec2 screenSize
foruniform vec3 iResolution
: viewport resolution pixels. (i.e.iResolution.xy
->screenSize
). -
use
uniform float time
foruniform float iTime
: shader playback time seconds. (i.e.iTime
->time
); -
use
uniform sampler2D imageData
foruniform samplerXX iChannel0..3
: input texture channel. (i.e.iChannel0
->imageData
); -
use
void main(void)
forvoid mainImage( out vec4 fragColor, in vec2 fragCoord )
for the main function (i.e.void mainImage(out vec4 fragColor, in vec2 fragCoord)
->void main(void)
);fragCoord
->gl_FragCoord
implicit inputfragColor
->gl_FragColor
implicit output