Warning: THE VOID WIKI IS DEPRECATED. It is no longer being maintained, contains outdated and incorrect information, and will eventually be shut down. Please refer to the Void Handbook, https://docs.voidlinux.org/, for the official documentation. If you can't find the information you're seeking, please raise an issue at https://github.com/void-linux/void-docs/issues

Slock -

From Void Linux Wiki
Jump to navigation Jump to search

slock is a simple and lightweight screen locker by suckless tools.


To install slock enter the following command

# xbps-install -S slock


Run slock to lock the screen. You can prepend a command with arguments to be run after the screen has been locked.

$ slock cmd [args ...]


slock reads no configuration file. Its behavior is configured at compile time, which means you have to compile it yourself to change its behaviour.

Note: It is advised to remove the xbps slock package before installing a custom build.

Self compilation

Clone the slock git repository of the suckless team to a directory of your choice. Change into the directory and run

$ make 
# make install
Note: Mind the # on the second command.

Follow the instructions on compilation errors such as missing libraries. All needed libraries are in the xbps repositories. Try searching with xbps-query -Rs <library name>.

Now running slock should again lock your screen and hereby verify the correct compilation and installation of slock.

Configure config.def.h

Apply changes to config.def.h and again run

$ make
# make install

The changes should now be present upon running slock.


The suckless team provides a handful of official patches to provide slock with additional features.

Download the patches as text files in your cloned repository. Run $ git apply patchfile.diff. The official patches shouldn't result in errors.

Now recompile slock as described in slock#Self Compilation and verify the changes.

Tips and tricks

Apply more than one patchfile

To apply more than one patchfile to slock, download the .diff files and run

$ git apply -3 <patchfileA> <patchfileB> ...

This will result in a 3 way merge which you should resolve with a merging tool of your choice.

Upon solving the merge, you must compile again as described in slock#Self Compilation.

External links