mabox-tools/bin/mbscreenlocker

66 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
CONFIG_DIR="$HOME/.config/mbscreenlocker"
CONFIG_FILE="$CONFIG_DIR/mbscreenlocker.conf"
# Make config directory if not exist
mkdir -p $CONFIG_DIR
# If config file not exist create one with defaults
if [ ! -f $CONFIG_FILE ]; then
cat <<EOF > ${CONFIG_FILE}
# Effect to use: dim, blur, dimblur or pixel
effect=dim
# ScreenLocker program: betterlockscreen or i3lock
screenlocker=i3lock
EOF
fi
# read config variables from file
source <(grep = $CONFIG_FILE)
lock() {
if [[ $screenlocker == "betterlockscreen" ]]; then
betterlockscreen -l $effect
else
i3lock -B 2 -k --time-color="337d00ff" --date-color="337d00ff"
fi
}
cache() {
case $LANG in
pl*)
TITLE="Tworzenie obrazków dla blokady ekranu"
TEXT="\nCierpliwości...\nto może chwilkę potrwać.."
TITLE2="Gotowe"
TEXT2="\n<b>W-l</b> aby zablokować ekran\n<b>W-A-s</b>aby konfigurować Tapety/Blokadę ekranu."
;;
*)
TITLE="Caching images for faster screen locking"
TEXT="\nPlease wait...\nthis might take few seconds..."
TITLE2="Done"
TEXT2="All required changes have been applied."
;;
esac
source <(grep file ~/.config/nitrogen/bg-saved.cfg)
notify-send.sh -u critical -i emblem-photos -R /tmp/mbscreencache "$TITLE" "$TEXT"
betterlockscreen -u "$file"
notify-send.sh -u normal -i emblem-photos -R /tmp/mbscreencache "$TITLE2" "$TEXT2"
}
usage() {
grep "^#:" $0 | while read DOC; do printf '%s\n' "${DOC###:}"; done
exit
}
case "$1" in
-c|cache) cache;;
-h|--help) usage;;
*) lock;;
esac
exit 0