i3lock-custom: Add i3lock wrapper script

This commit is contained in:
Salt 2018-10-04 18:26:37 -05:00
parent 1fc909dda0
commit b56604af3f

73
i3lock-custom Executable file
View File

@ -0,0 +1,73 @@
#! /usr/bin/env bash
#
# i3lock-custom.bash
# Copyright (C) 2018 salt <salt@lap-th-e560-0>
#
# Distributed under terms of the MIT license.
#
tmpdir="$(mktemp -d /tmp/i3lock-custom-XXXXXXXX)"
[ -z ${tmpdir+x} ] && exit 2
cleanup() {
rm -rf "$tmpdir"
}
trap "cleanup" EXIT
# Papirus Dark's object-locked.svg, rendererd, gzipped and base64'd
# Also recolored to Gruvbox colors
# Licensed under the terms of the GPLv3.0 License
# https://github.com/PapirusDevelopmentTeam/papirus-icon-theme
lockimg_gz() {
cat << EOF
H4sICEChtlsAA2xvY2sucG5nAK1VazjTexz/bWtsf6TLFmrFStG2sCJdlsty25Al5LIVc6vndMdJ
kvNvLg2pSCEtyhTKdYdMLus4pUSiyJBthQgR5pKc5+h5zqvznJfnxefyfJ7n+30+r77feNY+ew1o
NQQA0GA42LguKvwTGJVFrrfwe7UoKlxHexswDLpBGXLKVrKYYE85eIUsTrz/CQTdMDN8MVQNZTjb
qn6Elmhpm4wReTIA0EqGjbVbeNeogHMM564dJzsZ1J3bX9xmZEnG5XL496z4HdrRdJx+efcKBiZO
baUa325lcl4y2TQ5j0rC0HP6/8DEJ2FvbjRDlvo6VFvzHeZ8oCUx3t6jmhW/PBZNnkNQI6xdM6QC
6eg8+3Fwy+2ZnbKdwcEGqGV0DDHmJwVU6omjLh7/dp91Z+nrA76b1MWqCTogAfQgfPuaLYdRb9DZ
ajxRiTIVbGGYRWFa+L+6wpScBadjFX5d5OwyjISi+v4oKoLAHRFpnP8cc9SsYTPsIo4w80iXnbR8
kOBtNSAc8r+CFVpQ15f6N6YGYiE5qqjc9HJKNU9Lr2qpJMYJr4OxcFCiHzvfXgjQRY/zr4RToMFV
IPcQft3ycyIh7Tsa/SJg/MGaepO+bRjShbbcdJWm9k9jUV/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kMmz5Z7nMfFkx27ShD5w3Hijljd
nEoDK1ovjsJTroUb0vfb7ehMknDN9U8F3l8VXx6vCE6d8/e7MJgIvfm5PznFnzKvYxCYQA1mn2vH
upDhoy+ZcWPYIOaod0sawNNeU2j+d3WnQW7T023MBT2J4YBcJ2dBD7zkGoL/Lv8/GylFkkWwaxlU
RoO09GjzPDX/MU+wXNpiWG2dPU/TkqS47QGZpwNupyKkCjEw7w0khzVteNt/uAJvX+ATeRoajBOv
klg/Tyn9KCMwN3XMDWhrx7stDd1Q4nnRBSHUZn1vrKVXpOqvTAwcKBPunsekzX3q6Z0/Udt6hnii
2uJO8Y2Q8CYP+T0wr5Hdm1Tm8s/BjbmmeCkz9apwtGwb4i7+BMCw3WdTRPfl/Q0o9nFBaAYAAA==
EOF
}
(
cd "$tmpdir"
# Take a screenshot
import -window root stage1.bmp
# Blur out the important bits
convert stage1.bmp -blur 10x5 stage2.bmp
# Put a grey bar over it
rectangle="rectangle $(convert stage2.bmp -print "0,%[fx:h/2+128] %w,%[fx:h/2-128]" /dev/null)"
convert stage2.bmp -fill \#282828 -draw "$rectangle" stage3.bmp
# Stick a lock icon on there
lockimg_gz | base64 -d | gunzip > lock.png
convert -compose Exclusion -composite -gravity center stage3.bmp lock.png stage4.bmp
# Convert the output to PNG so i3lock doesn't OOM
convert stage4.bmp end.png
)
i3lock -i "$tmpdir/end.png"