Determinate i3lock-color binary automatically with i3lock-color/i3lock or quit with error (#252)

This commit is contained in:
Basti 2021-06-30 16:35:12 +02:00 committed by Sebastian Sellmeier
parent 709933350c
commit 8ab40b5af2
No known key found for this signature in database
GPG key ID: 51E2BE0CCC826F98

View file

@ -6,6 +6,16 @@
init_config () { init_config () {
# resolve i3lock-color binary
i3lockcolor_bin="$(command -v i3lock-color)"
if [[ (! -e "$i3lockcolor_bin") && (-e "$(command -v i3lock)") ]]; then
i3lockcolor_bin="$(command -v i3lock)"
else
echo "Can not find locker-binary as 'i3lock' or 'i3lock-color', please make sure it is in your \$PATH!"
exit 1
fi
# default options # default options
display_on=0 display_on=0
span_image=false span_image=false
@ -107,7 +117,7 @@ lock() {
local image="$1" local image="$1"
i3lock \ $i3lockcolor_bin \
-i "$image" \ -i "$image" \
-c "$bgcolor" \ -c "$bgcolor" \
--screen "$display_on" \ --screen "$display_on" \
@ -135,7 +145,7 @@ failsafe() {
local text="ffffffff" local text="ffffffff"
local error="ff0000" local error="ff0000"
i3lock \ $i3lockcolor_bin \
-c "$bgcolor" \ -c "$bgcolor" \
--screen "$display_on" \ --screen "$display_on" \
--time-pos="ix-170:iy-0" \ --time-pos="ix-170:iy-0" \
@ -824,7 +834,7 @@ for arg in "$@"; do
-v | --version) -v | --version)
echo echo
echo "Version: $VERSION" echo "Version: $VERSION"
i3lock-color --version $i3lockcolor_bin --version
convert --version convert --version
if [[ -x "$(command -v dunstctl)" ]]; then if [[ -x "$(command -v dunstctl)" ]]; then