mirror of
https://git.adityakumar.xyz/betterlockscreen-openrc.git
synced 2024-11-09 10:39:45 +00:00
unified indentation, removed duplicate code (#50)
This commit is contained in:
parent
368b30495d
commit
3217a0b564
1 changed files with 100 additions and 125 deletions
103
betterlockscreen
103
betterlockscreen
|
@ -70,6 +70,38 @@ rec_get_random() {
|
|||
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() {
|
||||
|
||||
echo "Important : Update the image cache, Ex: betterlockscreen -u path/to/image.jpg"
|
||||
|
@ -88,7 +120,6 @@ usage() {
|
|||
echo
|
||||
echo " -u --update"
|
||||
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 " Or you can use betterlockscreen -u path/to/imagedir and a random file will be selected"
|
||||
echo
|
||||
|
@ -124,20 +155,18 @@ usage() {
|
|||
echo " Ex: betterlockscreen -u path/to/image.png -r 1920x1080"
|
||||
echo " Ex: betterlockscreen -u path/to/image.png --resolution 3840x1080"
|
||||
echo
|
||||
echo
|
||||
echo " -b --blur"
|
||||
echo " to be used after -u"
|
||||
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 --blur 0.5"
|
||||
echo
|
||||
|
||||
}
|
||||
|
||||
# Options
|
||||
case "$1" in
|
||||
"")
|
||||
if [ ! -f $l_dim ]; then
|
||||
|
||||
echo "Important : Update the image cache, Ex. betterlockscreen -u path/to/image.jpg"
|
||||
echo
|
||||
echo " Image cache must be updated to initially configure or update wallpaper used"
|
||||
|
@ -166,75 +195,17 @@ case "$1" in
|
|||
-h | --help)
|
||||
|
||||
usage
|
||||
|
||||
;;
|
||||
|
||||
-l | --lock)
|
||||
lockargs="-n"
|
||||
case "$2" in
|
||||
"")
|
||||
# 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
|
||||
lockselect "$2"
|
||||
;;
|
||||
|
||||
-s | --suspend)
|
||||
case "$2" in
|
||||
"")
|
||||
# default lockscreen
|
||||
prelock
|
||||
lock "$l_resized" && systemctl suspend
|
||||
postlock
|
||||
lockselect "$2" "systemctl suspend"
|
||||
;;
|
||||
|
||||
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)
|
||||
case "$2" in
|
||||
"")
|
||||
|
@ -367,5 +338,9 @@ case "$1" in
|
|||
echo
|
||||
echo "All required changes have been applied"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "invalid argument"
|
||||
;;
|
||||
esac
|
||||
|
||||
|
|
Loading…
Reference in a new issue