Home

Awesome

swaylock-effects

Swaylock-effects is a fork of swaylock which adds built-in screenshots and image manipulation effects like blurring. It's inspired by i3lock-color, although the feature sets aren't perfectly overlapping.

This repository (jirutka/swaylock-effects) is a fork of mortie/swaylock-effects which is no longer maintained.

Screenshot

Example Command

swaylock \
	--screenshots \
	--clock \
	--indicator \
	--indicator-radius 100 \
	--indicator-thickness 7 \
	--effect-blur 7x5 \
	--effect-vignette 0.5:0.5 \
	--ring-color bb00cc \
	--key-hl-color 880033 \
	--line-color 00000000 \
	--inside-color 00000088 \
	--separator-color 00000000 \
	--grace 2 \
	--fade-in 0.2

New Features

The main new features compared to upstream swaylock are:

New feature ideas are welcome as issues (though I may never get around to implement them), new feature implementations are welcome as pull requests :)

Versions

swaylock-effects continuously incorporates changes from the original swaylock. The following table shows the relation between the swaylock-effect and swaylock versions.

swaylock-effectsswaylock (original)
1.6-01.5
1.6-11.5-7-ga99afe6a
1.6-21.5-9-g235b925d
1.6-31.5-9-g235b925d
1.6.101.6
1.6.111.6
1.7.0.01.7-8-gb4e3a2b

Installation

From Packages

The original mortie/swaylock-effects (now unmaintained) has been packaged for:

Compiling from Source

Install dependencies:

*Compile-time dep

**Optional: required for background images other than PNG

Run these commands:

meson build
ninja -C build
sudo ninja -C build install

On systems without PAM, you need to suid the swaylock binary:

sudo chmod a+s /usr/local/bin/swaylock

Swaylock will drop root permissions shortly after startup.

Effects

Blur

--effect-blur <radius>x<times>: Blur the image.

<radius> is a number specifying how big the blur is, <times> is a number which specifies essentially how high quality the blur is (i.e how closely the effect will resemble a true gaussian blur).

Pixelate

--effect-pixelate <factor>: Pixelate the image.

<factor> is the amount of pixelation; a value of 10 will make each 10x10 square of pixels the same color.

Scale

--effect-scale <scale>: Scale the image by a factor.

This effect scales the internal buffer. This has a few uses:

Greyscale

--effect-greyscale: Make the displayed image greyscale.

Vignette

--effect-vignette <base>:<factor>: Apply a vignette effect. Base and factor should be between 0 and 1.

Compose

--effect-compose "<position>;<size>;<gravity>;<path>": Overlay another image to your lock screen.

This command requires swaylock-effects to be compiled with gdk-pixbuf2. It supports all image formats gdk-pixbuf2 supports; on my system, that's png, jpeg, gif, svg, bmp, ico, tiff, wmf, ani, icns, pnm, qtif, tga, xbm and xpm.

Custom

--effect-custom <path>: Load a custom effect from a shared object.

The .so must export a function void swaylock_effect(uint32_t *data, int width, int height) or a function uint32_t swaylock_pixel(uint32_t pix, int x, int y, int width, int height).