i3lock-custom: Start Conky and slap my face on it

This commit is contained in:
Salt 2018-11-04 03:36:55 -06:00
parent 9b4c60069e
commit d973044ee8

View File

@ -11,6 +11,7 @@ tmpdir="$(mktemp -d "/tmp/i3lock-custom-$(whoami)-XXXXXXXX")"
cleanup() { cleanup() {
rm -rf "$tmpdir" rm -rf "$tmpdir"
[ -z "$i3lockpid" ] || kill "$i3lockpid" [ -z "$i3lockpid" ] || kill "$i3lockpid"
[ -z "$conkypid" ] || kill "$conkypid"
} }
trap "cleanup" EXIT trap "cleanup" EXIT
# Papirus Dark's object-locked.svg, rendererd, gzipped and base64'd # Papirus Dark's object-locked.svg, rendererd, gzipped and base64'd
@ -68,7 +69,8 @@ step_produce_image() {
-blur 10x5 \ -blur 10x5 \
-fill \#282828 \ -fill \#282828 \
-draw "$rectangle" \ -draw "$rectangle" \
lock.png -gravity center -compose Exclusion -composite \ lock.png -gravity center -compose src-over -composite \
"$HOME/.face" -gravity center -geometry 128x128+200+0 -compose src-over -composite \
end.png end.png
) )
return $? return $?
@ -77,6 +79,20 @@ step_start_i3lock() {
i3lock -i "$tmpdir/end.png" & i3lock -i "$tmpdir/end.png" &
i3lockpid="$!" i3lockpid="$!"
} }
step_start_conky() {
i=0
while ! xprop -name "i3lock" > /dev/null 2>&1; do
i=$(( $i + 1 ))
if [ "$i" -eq "100" ]; then
return 1
fi
sleep 0.01
done
conkyconfig="$HOME/.config/conky/i3lock.conf"
[ -r "$conkyconfig" ] || return 2
conky -c "$conkyconfig" &
conkypid="$!"
}
step_wait() { step_wait() {
wait wait
exit 0 exit 0
@ -85,6 +101,7 @@ step_wait() {
main() { main() {
step_produce_image || exit 1 step_produce_image || exit 1
step_start_i3lock step_start_i3lock
step_start_conky
step_wait step_wait
} }