i3lock-fancy
i3lock-fancy copied to clipboard
Use ffmpeg, add support for multiple monitors
The main motivation for this was to speed up the script (see #6). I also added support for an arbitrary number of monitors (see #10).
It now takes around 0.3 s on my desktop and 0.6 s on my laptop (0.2/0.4 if you use -pixelate
).
The method is to build up a filtergraph
for ffmpeg
. The stages of the filtergraph are as follows:
- Blur or pixelate or greyscale the input image.
- Add the lock images.
- Add text. This is achieved by creating a small (800x100) area which black text is added to and then blurred, then adding some non-blurred black text for a more solid outline, and finally adding the white text over the top. The result is a black shadow around the text so it can be read on any background. The reason for the 800x100 area is it's quicker to apply the blur.
Missing features and problems:
- No lightness/darkness detection.
- As
ffmpeg
handles capturing the desktop now, I removed the customscrot
command part, so you can no longer set custom flags e.g. imposing a delay. I don't think this is a huge problem as you can create your delay before executing the script. - Using
xrandr
to figure out the size and location of all the displays. It's probably not ideal but I couldn't find an easier way.
There's way too many unrelated changes here. Otherwise the filtergraph
functionality could likely be implemented in a seperate command.
#155
Hi @AladW, if you could give me some direction on what I could do to make this more reviewable then I can open a new one that is hopefully better.
Regarding the 'too many unrelated changes', I could remove all of the multi-monitor code and leave just the ffmpeg stuff?
I'm pressed for time now, so I'll reopen this to address it in the future. Splitting up the ffmpeg and multi-monitor (to several commits) would indeed be a good start.
While this branch is in conflict with master I want anyway to add a fix to it since the PR is still open because its not working by itself for me on archlinux...
The lock_file
path is incorrect. It should be /usr/share/i3lock-fancy/icons/lock.png
, the lock icon is in an icons
folder and not at the root of the i3lock-fancy
folder.