i3lock-delta/install

55 lines
1.5 KiB
Bash
Executable File

#!/usr/bin/env bash
red="\033[38;5;1m"
blue="\033[38;5;6m"
reset="\033[0;5;0m"
function check_exec() {
if hash $1 2> /dev/null ; then
echo $2 is installed
else
echo -en "$red"
echo $2 is not installed or not in PATH
echo Exiting ...
echo -en "$reset"
exit
fi
}
echo -e "${blue}Checking Dependencies $reset"
check_exec jq jq
check_exec curl curl
check_exec i3lock i3lock-color
check_exec convert Imagemagick
echo -e "${blue}Dependencies Satisfied $reset \n"
echo -e "${blue}Checking repository location $reset"
cd $HOME/i3lock-delta
if [[ $? -ne 0 ]]; then
echo -e "$red Please clone the repo in your home folder $reset"
exit
else
echo "OK"
fi
echo -e "${blue}Checked repository location $reset \n"
echo -e "${blue}Creating Required Files$reset"
mkdir -p $HOME/.config
echo 1 > $HOME/.config/lock_screen.sta
> $HOME/.config/lock_preferences
read x y <<<$(xdpyinfo | awk -F'[ x]+' '/dimensions:/{print $3, $4}')
> box_config
echo "BOX_TOP_LEFT_X=10" >> box_config
echo "BOX_TOP_LEFT_Y=$(($y-160))" >> box_config
echo "BOX_BOTTOM_RIGHT_X=410" >> box_config
echo "BOX_BOTTOM_RIGHT_Y=$(($y-50))" >> box_config
echo "ROUNDENESS=50" >> box_config
echo "NAME_X=$(( $x / 3 ))" >> box_config
echo "NAME_Y=17" >> box_config
echo -e "${blue}Finished Creating Required Files $reset \n"
echo -e "${blue}Installation Successful $reset"
echo -e "${blue}To set your random lock image themes, edit ~/.config/lock_preferences and enter your themes one per line."