Added config & cmd arg to change wallpaper setter; don't create .fehbg

This commit is contained in:
AUTplayed 2020-04-24 13:56:13 +02:00 committed by Philipp Hemmelmayr
parent d6883077ba
commit 66411bc8da

View file

@ -12,27 +12,28 @@ default_dpms=$(xset q | awk '/^[[:blank:]]*DPMS is/ {print $(NF)}')
init_filenames() { init_filenames() {
#$1 resolution #$1 resolution
# custom i3lock colors # copy this block to ~/.config/betterlockscreenrc" to customize
insidecolor=00000000
ringcolor=ffffffff
keyhlcolor=d23c3dff
bshlcolor=d23c3dff
separatorcolor=00000000
insidevercolor=00000000
insidewrongcolor=d23c3dff
ringvercolor=ffffffff
ringwrongcolor=ffffffff
verifcolor=ffffffff
timecolor=ffffffff
datecolor=ffffffff
loginbox=00000066
font="sans-serif"
locktext='Type password to unlock...'
wallpaper_cmd='feh --bg-fill --no-fehbg'
# override defaults with config
theme_rc="$HOME/.config/betterlockscreenrc" theme_rc="$HOME/.config/betterlockscreenrc"
if [ -e "$theme_rc" ]; then if [ -e "$theme_rc" ]; then
source "$theme_rc" source "$theme_rc"
else
# copy this block to ~/.config/betterlockscreenrc" to customize
insidecolor=00000000
ringcolor=ffffffff
keyhlcolor=d23c3dff
bshlcolor=d23c3dff
separatorcolor=00000000
insidevercolor=00000000
insidewrongcolor=d23c3dff
ringvercolor=ffffffff
ringwrongcolor=ffffffff
verifcolor=ffffffff
timecolor=ffffffff
datecolor=ffffffff
loginbox=00000066
font="sans-serif"
locktext='Type password to unlock...'
fi fi
# create folder in ~/.cache/i3lock directory # create folder in ~/.cache/i3lock directory
@ -73,7 +74,7 @@ init_filenames "$res"
prelock() { prelock() {
if [ ! -z "$lock_timeout" ]; then if [ ! -z "$lock_timeout" ]; then
xset dpms "$lock_timeout" xset dpms "$lock_timeout"
fi fi
if [ ! -z "$(pidof dunst)" ]; then if [ ! -z "$(pidof dunst)" ]; then
pkill -u "$USER" -USR1 dunst pkill -u "$USER" -USR1 dunst
@ -96,17 +97,17 @@ lock() {
--radius=20 --ring-width=4 --veriftext='' --wrongtext='' \ --radius=20 --ring-width=4 --veriftext='' --wrongtext='' \
--verifcolor="$verifcolor" --timecolor="$timecolor" --datecolor="$datecolor" \ --verifcolor="$verifcolor" --timecolor="$timecolor" --datecolor="$datecolor" \
--time-font="$font" --date-font="$font" --layout-font="$font" --verif-font="$font" --wrong-font="$font" \ --time-font="$font" --date-font="$font" --layout-font="$font" --verif-font="$font" --wrong-font="$font" \
--noinputtext='' --force-clock --pass-media-keys $lockargs --noinputtext='' --force-clock --pass-media-keys $lockargs
} }
postlock() { postlock() {
if [ ! -z "$lock_timeout" ]; then if [ ! -z "$lock_timeout" ]; then
xset dpms "$default_timeout" xset dpms "$default_timeout"
if [ "$default_dpms" = "Disabled" ]; then if [ "$default_dpms" = "Disabled" ]; then
xset -dpms xset -dpms
fi fi
fi fi
if [ ! -z "$(pidof dunst)" ] ; then if [ ! -z "$(pidof dunst)" ] ; then
pkill -u "$USER" -USR2 dunst pkill -u "$USER" -USR2 dunst
@ -285,29 +286,30 @@ wallpaper() {
case "$1" in case "$1" in
'') '')
# set resized image as wallpaper if no argument is supplied by user # set resized image as wallpaper if no argument is supplied by user
feh --bg-fill "$resized" wallpaper="$resized"
;; ;;
dim) dim)
# set dimmed image as wallpaper # set dimmed image as wallpaper
feh --bg-fill "$dim" wallpaper="$dim"
;; ;;
blur) blur)
# set blurred image as wallpaper # set blurred image as wallpaper
feh --bg-fill "$blur" wallpaper="$blur"
;; ;;
dimblur) dimblur)
# set dimmed + blurred image as wallpaper # set dimmed + blurred image as wallpaper
feh --bg-fill "$dimblur" wallpaper="$dimblur"
;; ;;
pixel) pixel)
# set pixelated image as wallpaper # set pixelated image as wallpaper
feh --bg-fill "$pixel" wallpaper="$pixel"
;; ;;
esac esac
eval "$wallpaper_cmd $wallpaper"
} }
@ -368,6 +370,7 @@ usage() {
echo ' -w --wall' echo ' -w --wall'
echo ' you can also set lockscreen background as wallpaper' echo ' you can also set lockscreen background as wallpaper'
echo ' to set wallpaper (e.g. betterlockscreen -w or betterlockscreen --wall)' echo ' to set wallpaper (e.g. betterlockscreen -w or betterlockscreen --wall)'
echo ' (The default wallpaper setter is feh, to set your own use the -wc command)'
echo ' you can also use dimmed or blurred variants.' echo ' you can also use dimmed or blurred variants.'
echo ' E.g: betterlockscreen -w dim (for dimmed wallpaper)' echo ' E.g: betterlockscreen -w dim (for dimmed wallpaper)'
echo ' E.g: betterlockscreen -w blur (for blurred wallpaper)' echo ' E.g: betterlockscreen -w blur (for blurred wallpaper)'
@ -395,9 +398,15 @@ usage() {
echo echo
echo echo
echo ' --off <timeout>' echo ' --off <timeout>'
echo ' to set custom monitor turn off timeout for lockscreen' echo ' to set custom monitor turn off timeout for lockscreen'
echo ' timeout is in seconds' echo ' timeout is in seconds'
echo ' E.g: betterlockscreen -l dim --off 5' echo ' E.g: betterlockscreen -l dim --off 5'
echo
echo
echo ' -wc --wallpaper_cmd <command>'
echo ' to set your custom wallpaper setter'
echo ' the default is "feh --bg-fill --no-fehbg"'
echo ' E.g: betterlockscreen -wc "xwallpaper --zoom" -w'
} }
@ -423,7 +432,7 @@ for arg in "$@"; do
if [[ ${2:0:1} = '-' ]]; then if [[ ${2:0:1} = '-' ]]; then
shift 1 shift 1
else else
lockstyle="$2"; shift 2 lockstyle="$2"; shift 2
fi fi
;; ;;
@ -459,6 +468,11 @@ for arg in "$@"; do
shift 2 shift 2
;; ;;
-wc | --wallpaper_cmd)
wallpaper_cmd="$2"
shift 2
;;
--) --)
lockargs="$lockargs ${*:2}" lockargs="$lockargs ${*:2}"
break break