Added quiet-mode (#288)

This commit is contained in:
atagen 2021-08-26 11:05:51 +10:00 committed by Sebastian Sellmeier
parent 5d8b8aa72a
commit de7bcdc2b5
No known key found for this signature in database
GPG key ID: 51E2BE0CCC826F98
2 changed files with 14 additions and 3 deletions

View file

@ -20,6 +20,7 @@ init_config () {
pixel_scale=10,1000 pixel_scale=10,1000
solid_color=333333 solid_color=333333
description="" description=""
quiet=false
i3lockcolor_bin="i3lock-color" i3lockcolor_bin="i3lock-color"
if ! cmd_exists "$i3lockcolor_bin" && cmd_exists "i3lock"; then if ! cmd_exists "$i3lockcolor_bin" && cmd_exists "i3lock"; then
@ -764,7 +765,7 @@ echof() {
error) msgpfx="[\e[1;91m!\e[m]";; error) msgpfx="[\e[1;91m!\e[m]";;
*) msgpfx="";; *) msgpfx="";;
esac esac
echo -e "$msgpfx $message" [ "$quiet" != true ] && echo -e "$msgpfx $message"
} }
# help message # help message
@ -772,6 +773,9 @@ usage() {
echo echo
echo "Usage: betterlockscreen [-u <PATH>] [-l <EFFECT>] [-w <EFFECT>]" echo "Usage: betterlockscreen [-u <PATH>] [-l <EFFECT>] [-w <EFFECT>]"
echo echo
echo " -q --quiet"
echo " Do not produce any text output on locking"
echo
echo " -u --update <PATH>" echo " -u --update <PATH>"
echo " Update lock screen image" echo " Update lock screen image"
echo echo
@ -828,8 +832,6 @@ usage() {
exit 1 exit 1
} }
echof header "Betterlockscreen"
init_config init_config
# show usage when no arguments passed # show usage when no arguments passed
@ -841,6 +843,12 @@ for arg in "$@"; do
[[ "${arg:0:1}" = '-' ]] || continue [[ "${arg:0:1}" = '-' ]] || continue
case "$1" in case "$1" in
-q | --quiet)
quiet=true
shift
;;
-u | --update) -u | --update)
runupdate=true runupdate=true
imagepaths+=("$2") imagepaths+=("$2")
@ -959,6 +967,8 @@ for arg in "$@"; do
esac esac
done done
echof header "Betterlockscreen"
# Run image generation # Run image generation
[[ $runupdate ]] && update "${imagepaths[@]}" [[ $runupdate ]] && update "${imagepaths[@]}"

View file

@ -10,6 +10,7 @@ blur_level=1
pixel_scale=10,1000 pixel_scale=10,1000
solid_color=333333 solid_color=333333
wallpaper_cmd="feh --bg-fill" wallpaper_cmd="feh --bg-fill"
quiet=false
# i3lockcolor_bin="i3lock-color" # Manually set command for i3lock-color # i3lockcolor_bin="i3lock-color" # Manually set command for i3lock-color
# default theme # default theme