unified indentation, removed duplicate code (#50)

This commit is contained in:
Philipp Hemmelmayr 2018-04-27 19:18:51 +02:00 committed by Pavan Jadhaw
parent 368b30495d
commit 3217a0b564

View file

@ -70,6 +70,38 @@ rec_get_random() {
rec_get_random "$dir" rec_get_random "$dir"
} }
lockselect() {
case "$1" in
"")
# default lockscreen
prelock
lock "$l_resized" && $2
postlock
;;
dim)
# lockscreen with dimmed background
prelock
lock "$l_dim" && $2
postlock
;;
blur)
# set lockscreen with blurred background
prelock
lock "$l_blur" && $2
postlock
;;
dimblur)
# set lockscreen with dimmed + blurred background
prelock
lock "$l_dimblur" && $2
postlock
;;
esac
}
usage() { usage() {
echo "Important : Update the image cache, Ex: betterlockscreen -u path/to/image.jpg" echo "Important : Update the image cache, Ex: betterlockscreen -u path/to/image.jpg"
@ -88,7 +120,6 @@ usage() {
echo echo
echo " -u --update" echo " -u --update"
echo " to update image cache, you should do this before using any other options" echo " to update image cache, you should do this before using any other options"
echo " Ex: betterlockscreen -u path/to/image.png when image.png is custom background" echo " Ex: betterlockscreen -u path/to/image.png when image.png is custom background"
echo " Or you can use betterlockscreen -u path/to/imagedir and a random file will be selected" echo " Or you can use betterlockscreen -u path/to/imagedir and a random file will be selected"
echo echo
@ -124,20 +155,18 @@ usage() {
echo " Ex: betterlockscreen -u path/to/image.png -r 1920x1080" echo " Ex: betterlockscreen -u path/to/image.png -r 1920x1080"
echo " Ex: betterlockscreen -u path/to/image.png --resolution 3840x1080" echo " Ex: betterlockscreen -u path/to/image.png --resolution 3840x1080"
echo echo
echo
echo " -b --blur" echo " -b --blur"
echo " to be used after -u" echo " to be used after -u"
echo " used to set blur intensity. Default to 1." echo " used to set blur intensity. Default to 1."
echo " Ex: betterlockscreen -u path/to/image.png -b 3" echo " Ex: betterlockscreen -u path/to/image.png -b 3"
echo " Ex: betterlockscreen -u path/to/image.png --blur 0.5" echo " Ex: betterlockscreen -u path/to/image.png --blur 0.5"
echo
} }
# Options # Options
case "$1" in case "$1" in
"") "")
if [ ! -f $l_dim ]; then if [ ! -f $l_dim ]; then
echo "Important : Update the image cache, Ex. betterlockscreen -u path/to/image.jpg" echo "Important : Update the image cache, Ex. betterlockscreen -u path/to/image.jpg"
echo echo
echo " Image cache must be updated to initially configure or update wallpaper used" echo " Image cache must be updated to initially configure or update wallpaper used"
@ -166,75 +195,17 @@ case "$1" in
-h | --help) -h | --help)
usage usage
;; ;;
-l | --lock) -l | --lock)
lockargs="-n" lockargs="-n"
case "$2" in lockselect "$2"
"")
# default lockscreen
prelock
lock "$l_resized"
postlock
;;
dim)
# lockscreen with dimmed background
prelock
lock "$l_dim"
postlock
;;
blur)
# set lockscreen with blurred background
prelock
lock "$l_blur"
postlock
;;
dimblur)
# set lockscreen with dimmed + blurred background
prelock
lock "$l_dimblur"
postlock
;;
esac
;; ;;
-s | --suspend) -s | --suspend)
case "$2" in lockselect "$2" "systemctl suspend"
"")
# default lockscreen
prelock
lock "$l_resized" && systemctl suspend
postlock
;; ;;
dim)
# lockscreen with dimmed background
prelock
lock "$l_dim" && systemctl suspend
postlock
;;
blur)
# set lockscreen with blurred background
prelock
lock "$l_blur" && systemctl suspend
postlock
;;
dimblur)
# set lockscreen with dimmed + blurred background
prelock
lock "$l_dimblur" && systemctl suspend
postlock
;;
esac
;;
-w | --wall) -w | --wall)
case "$2" in case "$2" in
"") "")
@ -367,5 +338,9 @@ case "$1" in
echo echo
echo "All required changes have been applied" echo "All required changes have been applied"
;; ;;
*)
echo "invalid argument"
;;
esac esac