fixing XF86-buttons
This commit is contained in:
parent
eff8e0955b
commit
de7896fd8c
|
|
@ -4,35 +4,54 @@
|
||||||
# Github Profile : https://github.com/pavanjadhaw
|
# Github Profile : https://github.com/pavanjadhaw
|
||||||
# Project Repository : https://github.com/pavanjadhaw/betterlockscreen
|
# Project Repository : https://github.com/pavanjadhaw/betterlockscreen
|
||||||
|
|
||||||
|
# find your resolution so images can be resized to match your screen resolution
|
||||||
|
res=$(xdpyinfo | grep dimensions | sed -r 's/^[^0-9]*([0-9]+x[0-9]+).*$/\1/')
|
||||||
|
locktext='Type password to unlock...'
|
||||||
|
|
||||||
# create folder in ~/.cache/i3lock directory
|
|
||||||
folder="$HOME/.cache/i3lock"
|
|
||||||
|
|
||||||
# ratio for rectangle to be drawn for time background on lockscreen
|
init_filenames() {
|
||||||
# Original Image
|
#$1 resolution
|
||||||
orig_wall="$folder/wall.png"
|
|
||||||
|
|
||||||
# Versions (from here)
|
# create folder in ~/.cache/i3lock directory
|
||||||
# You can use these images to set different versions as wallpaper
|
res_folder="$HOME/.cache/i3lock/$1"
|
||||||
# lockscreen background.
|
folder="$HOME/.cache/i3lock/current"
|
||||||
resized="$folder/resized.png" # resized image for your resolution
|
echo "Got" $@ $res_folder
|
||||||
|
if [ ! -d $folder -o -n "$2" ]; then
|
||||||
|
rm -f $folder
|
||||||
|
ln -s $res_folder $folder
|
||||||
|
fi
|
||||||
|
|
||||||
# images to be used as wallpaper
|
# ratio for rectangle to be drawn for time background on lockscreen
|
||||||
dim="$folder/dim.png" # image with subtle overlay of black
|
# Original Image
|
||||||
blur="$folder/blur.png" # blurred version
|
orig_wall="$folder/wall.png"
|
||||||
dimblur="$folder/dimblur.png"
|
|
||||||
|
|
||||||
# lockscreen images (images to be used as lockscreen background)
|
# Versions (from here)
|
||||||
l_resized="$folder/l_resized.png"
|
# You can use these images to set different versions as wallpaper
|
||||||
l_dim="$folder/l_dim.png"
|
# lockscreen background.
|
||||||
l_blur="$folder/l_blur.png"
|
resized="$folder/resized.png" # resized image for your resolution
|
||||||
l_dimblur="$folder/l_dimblur.png"
|
|
||||||
|
# images to be used as wallpaper
|
||||||
|
dim="$folder/dim.png" # image with subtle overlay of black
|
||||||
|
blur="$folder/blur.png" # blurred version
|
||||||
|
dimblur="$folder/dimblur.png"
|
||||||
|
|
||||||
|
# lockscreen images (images to be used as lockscreen background)
|
||||||
|
l_resized="$folder/l_resized.png"
|
||||||
|
l_dim="$folder/l_dim.png"
|
||||||
|
l_blur="$folder/l_blur.png"
|
||||||
|
l_dimblur="$folder/l_dimblur.png"
|
||||||
|
}
|
||||||
|
|
||||||
|
init_filenames $res
|
||||||
|
|
||||||
|
|
||||||
prelock() {
|
prelock() {
|
||||||
pkill -u "$USER" -USR1 dunst
|
if [ ! -z "$(pidof dunst)" ]; then
|
||||||
|
pkill -u "$USER" -USR1 dunst
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
lock() {
|
lock() {
|
||||||
#$1 image path
|
#$1 image path
|
||||||
letterEnteredColor=d23c3dff
|
letterEnteredColor=d23c3dff
|
||||||
|
|
@ -42,23 +61,27 @@ lock() {
|
||||||
background=00000000
|
background=00000000
|
||||||
foreground=ffffffff
|
foreground=ffffffff
|
||||||
i3lock \
|
i3lock \
|
||||||
-t -n -i "$1" \
|
-t -i "$1" \
|
||||||
--timepos="x-90:h-ch+30" \
|
--timepos='x+110:h-70' \
|
||||||
--datepos="tx+24:ty+25" \
|
--datepos='x+43:h-45' \
|
||||||
--clock --datestr "Type password to unlock..." \
|
--clock --date-align 1 --datestr "$locktext" \
|
||||||
--insidecolor=$background --ringcolor=$foreground --line-uses-inside \
|
--insidecolor=$background --ringcolor=$foreground --line-uses-inside \
|
||||||
--keyhlcolor=$letterEnteredColor --bshlcolor=$letterRemovedColor --separatorcolor=$background \
|
--keyhlcolor=$letterEnteredColor --bshlcolor=$letterRemovedColor --separatorcolor=$background \
|
||||||
--insidevercolor=$passwordCorrect --insidewrongcolor=$passwordIncorrect \
|
--insidevercolor=$passwordCorrect --insidewrongcolor=$passwordIncorrect \
|
||||||
--ringvercolor=$foreground --ringwrongcolor=$foreground --indpos="x+280:h-70" \
|
--ringvercolor=$foreground --ringwrongcolor=$foreground --indpos='x+280:h-70' \
|
||||||
--radius=20 --ring-width=4 --veriftext="" --wrongtext="" \
|
--radius=20 --ring-width=4 --veriftext='' --wrongtext='' \
|
||||||
--textcolor="$foreground" --timecolor="$foreground" --datecolor="$foreground" \
|
--verifcolor="$foreground" --timecolor="$foreground" --datecolor="$foreground" \
|
||||||
--force-clock
|
--noinputtext='' --force-clock $lockargs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
postlock() {
|
postlock() {
|
||||||
pkill -u "$USER" -USR2 dunst
|
if [ ! -z "$(pidof dunst)" ] ; then
|
||||||
|
pkill -u "$USER" -USR2 dunst
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
rec_get_random() {
|
rec_get_random() {
|
||||||
dir="$1"
|
dir="$1"
|
||||||
if [ ! -d "$dir" ]; then
|
if [ ! -d "$dir" ]; then
|
||||||
|
|
@ -70,301 +93,301 @@ rec_get_random() {
|
||||||
rec_get_random "$dir"
|
rec_get_random "$dir"
|
||||||
}
|
}
|
||||||
|
|
||||||
usage() {
|
|
||||||
|
|
||||||
echo "Important : Update the image cache, Ex: betterlockscreen -u path/to/image.jpg"
|
lockselect() {
|
||||||
echo " Image cache must be updated to initially configure or update wallpaper used"
|
prelock
|
||||||
echo
|
case "$1" in
|
||||||
echo
|
dim)
|
||||||
echo "See : https://github.com/pavanjadhaw/betterlockscreen for additional info..."
|
# lockscreen with dimmed background
|
||||||
echo
|
lock "$l_dim"
|
||||||
echo
|
;;
|
||||||
echo "Options:"
|
|
||||||
echo
|
|
||||||
echo " -h --help"
|
|
||||||
|
|
||||||
echo " For help. Ex: betterlockscreen -h or betterlockscreen --help"
|
blur)
|
||||||
echo
|
# set lockscreen with blurred background
|
||||||
echo
|
lock "$l_blur"
|
||||||
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"
|
dimblur)
|
||||||
echo " Or you can use betterlockscreen -u path/to/imagedir and a random file will be selected"
|
# set lockscreen with dimmed + blurred background
|
||||||
echo
|
lock "$l_dimblur"
|
||||||
echo
|
;;
|
||||||
echo " -l --lock"
|
|
||||||
echo " to lock screen, Ex. betterlockscreen -l"
|
|
||||||
echo " you can also use dimmed or blurred background for lockscreen"
|
|
||||||
echo " Ex: betterlockscreen -l dim (for dimmed background)"
|
|
||||||
echo " Ex: betterlockscreen -l blur (for blurred background)"
|
|
||||||
echo " Ex: betterlockscreen -l dimblur (for dimmed + blurred background)"
|
|
||||||
echo
|
|
||||||
echo
|
|
||||||
echo " -s --suspend"
|
|
||||||
echo " to suspend system and lock screen, Ex. betterlockscreen -s"
|
|
||||||
echo " you can also use dimmed or blurred background for lockscreen"
|
|
||||||
echo " Ex: betterlockscreen -s dim (for dimmed background)"
|
|
||||||
echo " Ex: betterlockscreen -s blur (for blurred background)"
|
|
||||||
echo " Ex: betterlockscreen -s dimblur (for dimmed + blurred background)"
|
|
||||||
echo
|
|
||||||
echo
|
|
||||||
echo " -w --wall"
|
|
||||||
echo " you can also set lockscreen background as wallpaper"
|
|
||||||
echo " to set wallpaper. Ex betterlockscreen -w or betterlockscreen --wall"
|
|
||||||
echo " you can also use dimmed or blurred variants"
|
|
||||||
echo " Ex: betterlockscreen -w dim (for dimmed wallpaper)"
|
|
||||||
echo " Ex: betterlockscreen -w blur (for blurred wallpaper)"
|
|
||||||
echo " Ex: betterlockscreen -w dimblur (for dimmed + blurred wallpaper)"
|
|
||||||
echo
|
|
||||||
echo
|
|
||||||
echo " -r --resolution"
|
|
||||||
echo " to be used after -u"
|
|
||||||
echo " used to set a custom resolution for the image cache."
|
|
||||||
echo " Ex: betterlockscreen -u path/to/image.png -r 1920x1080"
|
|
||||||
echo " Ex: betterlockscreen -u path/to/image.png --resolution 3840x1080"
|
|
||||||
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
|
|
||||||
|
|
||||||
|
*)
|
||||||
|
# default lockscreen
|
||||||
|
lock "$l_resized"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
postlock
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
update() {
|
||||||
|
# use
|
||||||
|
background="$1"
|
||||||
|
|
||||||
|
# default blur level; fallback to 1
|
||||||
|
[[ $blur_level ]] || blur_level=1
|
||||||
|
|
||||||
|
rectangles=" "
|
||||||
|
SR=$(xrandr --query | grep ' connected' | grep -o '[0-9][0-9]*x[0-9][0-9]*[^ ]*')
|
||||||
|
for RES in $SR; do
|
||||||
|
SRA=(${RES//[x+]/ })
|
||||||
|
CX=$((${SRA[2]} + 25))
|
||||||
|
CY=$((${SRA[1]} - 30))
|
||||||
|
rectangles+="rectangle $CX,$CY $((CX+300)),$((CY-80)) "
|
||||||
|
done
|
||||||
|
|
||||||
|
# User supplied Image
|
||||||
|
user_image="$folder/user_image.png"
|
||||||
|
|
||||||
|
# create folder
|
||||||
|
if [ ! -d $folder ]; then
|
||||||
|
echo "Creating '$folder' directory to cache processed images."
|
||||||
|
mkdir -p "$folder"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# get random file in dir if passed argument is a dir
|
||||||
|
rec_get_random "$background"
|
||||||
|
|
||||||
|
# get user image
|
||||||
|
cp "$user_input" "$user_image"
|
||||||
|
if [ ! -f $user_image ]; then
|
||||||
|
echo 'Please specify the path to the image you would like to use'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# replace orignal with user image
|
||||||
|
cp "$user_image" "$orig_wall"
|
||||||
|
rm "$user_image"
|
||||||
|
|
||||||
|
echo 'Generating alternate images based on the image you specified,'
|
||||||
|
echo 'please wait this might take few seconds...'
|
||||||
|
|
||||||
|
# wallpapers
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo 'Converting provided image to match your resolution...'
|
||||||
|
# resize image
|
||||||
|
convert "$orig_wall" -resize "$res""^" -gravity center -extent "$res" "$resized"
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo 'Applying dim and blur effect to resized image'
|
||||||
|
# dim
|
||||||
|
convert "$resized" -fill black -colorize 40% "$dim"
|
||||||
|
|
||||||
|
# blur
|
||||||
|
blur_shrink=$(echo "scale=2; 20 / $blur_level" | bc)
|
||||||
|
blur_sigma=$(echo "scale=2; 0.6 * $blur_level" | bc)
|
||||||
|
convert "$resized" \
|
||||||
|
-filter Gaussian \
|
||||||
|
-resize "$blur_shrink%" \
|
||||||
|
-define "filter:sigma=$blur_sigma" \
|
||||||
|
-resize "$res^" -gravity center -extent "$res" \
|
||||||
|
"$blur"
|
||||||
|
|
||||||
|
# dimblur
|
||||||
|
convert "$dim" \
|
||||||
|
-filter Gaussian \
|
||||||
|
-resize "$blur_shrink%" \
|
||||||
|
-define "filter:sigma=$blur_sigma" \
|
||||||
|
-resize "$res^" -gravity center -extent "$res" \
|
||||||
|
"$dimblur"
|
||||||
|
|
||||||
|
# lockscreen backgrounds
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo 'Caching images for faster screen locking'
|
||||||
|
# resized
|
||||||
|
convert "$resized" -draw "fill rgba(0, 0, 0, 0.4) $rectangles" "$l_resized"
|
||||||
|
|
||||||
|
# dim
|
||||||
|
convert "$dim" -draw "fill rgba(0, 0, 0, 0.4) $rectangles" "$l_dim"
|
||||||
|
|
||||||
|
# blur
|
||||||
|
convert "$blur" -draw "fill rgba(0, 0, 0, 0.4) $rectangles" "$l_blur"
|
||||||
|
|
||||||
|
# blur
|
||||||
|
convert "$dimblur" -draw "fill rgba(0, 0, 0, 0.4) $rectangles" "$l_dimblur"
|
||||||
|
echo
|
||||||
|
echo 'All required changes have been applied'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
wallpaper() {
|
||||||
|
case "$1" in
|
||||||
|
'')
|
||||||
|
# set resized image as wallpaper if no argument is supplied by user
|
||||||
|
feh --bg-fill $resized
|
||||||
|
;;
|
||||||
|
|
||||||
|
dim)
|
||||||
|
# set dimmed image as wallpaper
|
||||||
|
feh --bg-fill $dim
|
||||||
|
;;
|
||||||
|
|
||||||
|
blur)
|
||||||
|
# set blurred image as wallpaper
|
||||||
|
feh --bg-fill $blur
|
||||||
|
;;
|
||||||
|
|
||||||
|
dimblur)
|
||||||
|
# set dimmed + blurred image as wallpaper
|
||||||
|
feh --bg-fill $dimblur
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
empty() {
|
||||||
|
if [ -f $l_dim ]; then
|
||||||
|
echo -e "\nSeems you haven't provided any arguments. See below for usage details."
|
||||||
|
else
|
||||||
|
echo 'Important: Update the image cache (e.g. betterlockscreen -u path/to/image.jpg).'
|
||||||
|
echo
|
||||||
|
echo ' Image cache must be updated to initially configure or update the wallpaper used.'
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo 'For other sets of options and help, use the help command.'
|
||||||
|
echo 'e.g. betterlockscreen -h or betterlockscreen --help'
|
||||||
|
echo
|
||||||
|
echo 'See: https://github.com/pavanjadhaw/betterlockscreen for additional info...'
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
echo 'Important: Update the image cache (e.g. betterlockscreen -u path/to/image.jpg).'
|
||||||
|
echo ' Image cache must be updated to initially configure or update wallpaper used'
|
||||||
|
echo
|
||||||
|
echo
|
||||||
|
echo 'See: https://github.com/pavanjadhaw/betterlockscreen for additional info...'
|
||||||
|
echo
|
||||||
|
echo
|
||||||
|
echo 'Options:'
|
||||||
|
echo
|
||||||
|
echo ' -h --help'
|
||||||
|
echo ' For help (e.g. betterlockscreen -h or betterlockscreen --help).'
|
||||||
|
echo
|
||||||
|
echo
|
||||||
|
echo ' -u --update'
|
||||||
|
echo ' to update image cache, you should do this before using any other options'
|
||||||
|
echo ' E.g: 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
|
||||||
|
echo
|
||||||
|
echo ' -l --lock'
|
||||||
|
echo ' to lock screen (e.g. betterlockscreen -l)'
|
||||||
|
echo ' you can also use dimmed or blurred background for lockscreen.'
|
||||||
|
echo ' E.g: betterlockscreen -l dim (for dimmed background)'
|
||||||
|
echo ' E.g: betterlockscreen -l blur (for blurred background)'
|
||||||
|
echo ' E.g: betterlockscreen -l dimblur (for dimmed + blurred background)'
|
||||||
|
echo
|
||||||
|
echo
|
||||||
|
echo ' -s --suspend'
|
||||||
|
echo ' to suspend system and lock screen (e.g. betterlockscreen -s)'
|
||||||
|
echo ' you can also use dimmed or blurred background for lockscreen.'
|
||||||
|
echo ' E.g: betterlockscreen -s dim (for dimmed background)'
|
||||||
|
echo ' E.g: betterlockscreen -s blur (for blurred background)'
|
||||||
|
echo ' E.g: betterlockscreen -s dimblur (for dimmed + blurred background)'
|
||||||
|
echo
|
||||||
|
echo
|
||||||
|
echo ' -w --wall'
|
||||||
|
echo ' you can also set lockscreen background as wallpaper'
|
||||||
|
echo ' to set wallpaper (e.g. betterlockscreen -w or betterlockscreen --wall)'
|
||||||
|
echo ' you can also use dimmed or blurred variants.'
|
||||||
|
echo ' E.g: betterlockscreen -w dim (for dimmed wallpaper)'
|
||||||
|
echo ' E.g: betterlockscreen -w blur (for blurred wallpaper)'
|
||||||
|
echo ' E.g: betterlockscreen -w dimblur (for dimmed + blurred wallpaper)'
|
||||||
|
echo
|
||||||
|
echo
|
||||||
|
echo ' -r --resolution'
|
||||||
|
echo ' to be used after -u'
|
||||||
|
echo ' used to set a custom resolution for the image cache.'
|
||||||
|
echo ' E.g: betterlockscreen -u path/to/image.png -r 1920x1080'
|
||||||
|
echo ' E.g: 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 ' E.g: betterlockscreen -u path/to/image.png -b 3'
|
||||||
|
echo ' E.g: betterlockscreen -u path/to/image.png --blur 0.5'
|
||||||
|
echo
|
||||||
|
echo
|
||||||
|
echo ' -t --text'
|
||||||
|
echo ' to set custom lockscreen text (max 31 chars)'
|
||||||
|
echo " E.g: betterlockscreen -l dim -t \"Don't touch my machine!\""
|
||||||
|
echo ' E.g: betterlockscreen --text "Hi, user!" -s blur'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# Options
|
# Options
|
||||||
case "$1" in
|
[[ "$1" = '' ]] && empty
|
||||||
"")
|
|
||||||
if [ ! -f $l_dim ]; then
|
|
||||||
|
|
||||||
echo "Important : Update the image cache, Ex. betterlockscreen -u path/to/image.jpg"
|
for arg in "$@"; do
|
||||||
echo
|
[[ "${arg:0:1}" = '-' ]] || continue
|
||||||
echo " Image cache must be updated to initially configure or update wallpaper used"
|
|
||||||
echo
|
|
||||||
echo "See also : For other set of options and help use help command."
|
|
||||||
echo "Ex. betterlockscreen -h or betterlockscreen --help"
|
|
||||||
|
|
||||||
echo
|
case "$1" in
|
||||||
echo "See : https://github.com/pavanjadhaw/betterlockscreen for addition info..."
|
-h | --help)
|
||||||
exit 1
|
usage
|
||||||
else
|
break
|
||||||
echo
|
;;
|
||||||
echo "Seems you havent provided any argument, see below for usage info"
|
|
||||||
echo
|
|
||||||
echo "See also : For other set of options and help use help command."
|
|
||||||
|
|
||||||
echo "Ex. betterlockscreen -h or betterlockscreen --help"
|
-s | --suspend)
|
||||||
|
runsuspend=true
|
||||||
|
;&
|
||||||
|
|
||||||
echo
|
-l | --lock)
|
||||||
echo "See : https://github.com/pavanjadhaw/betterlockscreen for addition info..."
|
runlock=true
|
||||||
echo
|
[[ $runsuspend ]] || lockargs="$lockargs -n"
|
||||||
exit 1
|
[[ ${2:0:1} = '-' ]] && shift 1 || { lockstyle="$2"; shift 2; }
|
||||||
fi
|
;;
|
||||||
;;
|
|
||||||
|
|
||||||
-h | --help)
|
-w | --wall | --wallpaper)
|
||||||
|
wallpaper "$2"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
|
|
||||||
usage
|
-u | --update)
|
||||||
|
runupdate=true
|
||||||
|
imagepath="$2"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
|
|
||||||
;;
|
-t | --text)
|
||||||
|
locktext="$2"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
|
|
||||||
-l | --lock)
|
-r | --resolution)
|
||||||
case "$2" in
|
res="$2"
|
||||||
"")
|
init_filenames $res force
|
||||||
# default lockscreen
|
shift 2
|
||||||
prelock
|
;;
|
||||||
lock "$l_resized"
|
|
||||||
postlock
|
|
||||||
;;
|
|
||||||
|
|
||||||
dim)
|
-b | --blur)
|
||||||
# lockscreen with dimmed background
|
blur_level="$2"
|
||||||
prelock
|
shift 2
|
||||||
lock "$l_dim"
|
;;
|
||||||
postlock
|
|
||||||
;;
|
|
||||||
|
|
||||||
blur)
|
--)
|
||||||
# set lockscreen with blurred background
|
lockargs="$lockargs ${@:2}"
|
||||||
prelock
|
break
|
||||||
lock "$l_blur"
|
;;
|
||||||
postlock
|
|
||||||
;;
|
|
||||||
|
|
||||||
dimblur)
|
*)
|
||||||
# set lockscreen with dimmed + blurred background
|
echo "invalid argument: $1"
|
||||||
prelock
|
break
|
||||||
lock "$l_dimblur"
|
;;
|
||||||
postlock
|
esac
|
||||||
;;
|
done
|
||||||
esac
|
|
||||||
;;
|
|
||||||
|
|
||||||
-s | --suspend)
|
# Run image generation
|
||||||
case "$2" in
|
[[ $runupdate ]] && update "$imagepath"
|
||||||
"")
|
|
||||||
# default lockscreen
|
|
||||||
prelock
|
|
||||||
systemctl suspend && lock "$l_resized"
|
|
||||||
postlock
|
|
||||||
;;
|
|
||||||
|
|
||||||
dim)
|
# Activate lockscreen
|
||||||
# lockscreen with dimmed background
|
[[ $runlock ]] && lockselect "$lockstyle" && \
|
||||||
prelock
|
{ [[ $runsuspend ]] && systemctl suspend; }
|
||||||
systemctl suspend && lock "$l_dim"
|
|
||||||
postlock
|
|
||||||
;;
|
|
||||||
|
|
||||||
blur)
|
exit 0
|
||||||
# set lockscreen with blurred background
|
|
||||||
prelock
|
|
||||||
systemctl suspend && lock "$l_blur"
|
|
||||||
postlock
|
|
||||||
;;
|
|
||||||
|
|
||||||
dimblur)
|
|
||||||
# set lockscreen with dimmed + blurred background
|
|
||||||
prelock
|
|
||||||
systemctl suspend && lock "$l_dimblur"
|
|
||||||
postlock
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
;;
|
|
||||||
|
|
||||||
|
|
||||||
-w | --wall)
|
|
||||||
case "$2" in
|
|
||||||
"")
|
|
||||||
# set resized image as wallpaper if no argument is supplied by user
|
|
||||||
feh --bg-fill $resized
|
|
||||||
;;
|
|
||||||
|
|
||||||
dim)
|
|
||||||
# set dimmed image as wallpaper
|
|
||||||
feh --bg-fill $dim
|
|
||||||
;;
|
|
||||||
|
|
||||||
blur)
|
|
||||||
# set blurred image as wallpaper
|
|
||||||
feh --bg-fill $blur
|
|
||||||
;;
|
|
||||||
|
|
||||||
dimblur)
|
|
||||||
# set dimmed + blurred image as wallpaper
|
|
||||||
feh --bg-fill $dimblur
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
;;
|
|
||||||
|
|
||||||
-u | --update)
|
|
||||||
background="$2"
|
|
||||||
shift 2
|
|
||||||
|
|
||||||
# find your resolution so images can be resized to match your screen resolution
|
|
||||||
y_res=$(xdpyinfo | grep dimensions | sed -r 's/^[^0-9]*([0-9]+x[0-9]+).*$/\1/')
|
|
||||||
# default blur level
|
|
||||||
blur_level=1
|
|
||||||
|
|
||||||
# parse update arguments
|
|
||||||
while [ $# -gt 0 ]; do
|
|
||||||
case "$1" in
|
|
||||||
-r | --resolution )
|
|
||||||
y_res="$2"
|
|
||||||
shift 2
|
|
||||||
;;
|
|
||||||
-b | --blur )
|
|
||||||
blur_level="$2"
|
|
||||||
shift 2
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
shift ;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
rectangles=" "
|
|
||||||
SR=$(xrandr --query | grep ' connected' | grep -o '[0-9][0-9]*x[0-9][0-9]*[^ ]*')
|
|
||||||
for RES in $SR; do
|
|
||||||
SRA=(${RES//[x+]/ })
|
|
||||||
CX=$((${SRA[2]} + 25))
|
|
||||||
CY=$((${SRA[1]} - 30))
|
|
||||||
rectangles+="rectangle $CX,$CY $((CX+300)),$((CY-80)) "
|
|
||||||
done
|
|
||||||
|
|
||||||
# User supplied Image
|
|
||||||
user_image="$folder/user_image.png"
|
|
||||||
|
|
||||||
# create folder
|
|
||||||
if [ ! -d $folder ]; then
|
|
||||||
echo "Creating '$folder' directory to cache processed images."
|
|
||||||
mkdir -p "$folder"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# get random file in dir if passed argument is a dir
|
|
||||||
rec_get_random "$background"
|
|
||||||
|
|
||||||
# get user image
|
|
||||||
cp "$user_input" "$user_image"
|
|
||||||
if [ ! -f $user_image ]; then
|
|
||||||
echo "Please specify the path to the image you would like to use"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# replace orignal with user image
|
|
||||||
cp "$user_image" "$orig_wall"
|
|
||||||
rm "$user_image"
|
|
||||||
|
|
||||||
echo "Generating alternate images based on the image you specified,"
|
|
||||||
echo "please wait this might take few seconds..."
|
|
||||||
|
|
||||||
# wallpapers
|
|
||||||
|
|
||||||
echo
|
|
||||||
echo "Converting provided image to match your resolution..."
|
|
||||||
# resize image
|
|
||||||
convert "$orig_wall" -resize "$y_res""^" -gravity center -extent "$y_res" "$resized"
|
|
||||||
|
|
||||||
echo
|
|
||||||
echo "Applying dim and blur effect to resized image"
|
|
||||||
# dim
|
|
||||||
convert "$resized" -fill black -colorize 40% "$dim"
|
|
||||||
|
|
||||||
# blur
|
|
||||||
blur_shrink=$(echo "scale=2; 20 / $blur_level" | bc)
|
|
||||||
blur_sigma=$(echo "scale=2; 0.6 * $blur_level" | bc)
|
|
||||||
convert "$resized" \
|
|
||||||
-filter Gaussian \
|
|
||||||
-resize "$blur_shrink%" \
|
|
||||||
-define "filter:sigma=$blur_sigma" \
|
|
||||||
-resize "$y_res^" -gravity center -extent "$y_res" \
|
|
||||||
"$blur"
|
|
||||||
|
|
||||||
# dimblur
|
|
||||||
convert "$dim" \
|
|
||||||
-filter Gaussian \
|
|
||||||
-resize "$blur_shrink%" \
|
|
||||||
-define "filter:sigma=$blur_sigma" \
|
|
||||||
-resize "$y_res^" -gravity center -extent "$y_res" \
|
|
||||||
"$dimblur"
|
|
||||||
|
|
||||||
# lockscreen backgrounds
|
|
||||||
|
|
||||||
echo
|
|
||||||
echo "Caching images for faster screen locking"
|
|
||||||
# resized
|
|
||||||
convert "$resized" -draw "fill black fill-opacity 0.4 $rectangles" "$l_resized"
|
|
||||||
|
|
||||||
# dim
|
|
||||||
convert "$dim" -draw "fill black fill-opacity 0.4 $rectangles" "$l_dim"
|
|
||||||
|
|
||||||
# blur
|
|
||||||
convert "$blur" -draw "fill black fill-opacity 0.4 $rectangles" "$l_blur"
|
|
||||||
|
|
||||||
# blur
|
|
||||||
convert "$dimblur" -draw "fill black fill-opacity 0.4 $rectangles" "$l_dimblur"
|
|
||||||
|
|
||||||
echo
|
|
||||||
echo "All required changes have been applied"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
|
||||||
|
|
@ -88,9 +88,9 @@ exec --no-startup-id systemctl --user start wallpaper.service
|
||||||
#Unclutter makes the mouse invisible after a brief period
|
#Unclutter makes the mouse invisible after a brief period
|
||||||
exec --no-startup-id unclutter
|
exec --no-startup-id unclutter
|
||||||
# custom keybinding to lockscreen, use --lock dim or --lock blur below for different backgrounds
|
# custom keybinding to lockscreen, use --lock dim or --lock blur below for different backgrounds
|
||||||
bindsym $mod+shift+x exec betterlockscreen --lock dim
|
bindsym $mod+shift+x exec betterlockscreen -l dim
|
||||||
# Set last used image as lockscreen background
|
# Set last used image as lockscreen background
|
||||||
exec --no-startup-id betterlockscreen -u ~/.config/wall.png
|
exec --no-startup-id betterlockscreen -w dim
|
||||||
#Twmn Gmail notifier
|
#Twmn Gmail notifier
|
||||||
exec --no-startup-id python ~/.config/Scripts/gmail_notifier.py
|
exec --no-startup-id python ~/.config/Scripts/gmail_notifier.py
|
||||||
|
|
||||||
|
|
@ -114,12 +114,13 @@ set $dec --no-startup-id amixer sset Master 2%-
|
||||||
set $bigdec --no-startup-id amixer sset Master 5%-
|
set $bigdec --no-startup-id amixer sset Master 5%-
|
||||||
set $mute --no-startup-id pactl set-sink-mute 0 toggle
|
set $mute --no-startup-id pactl set-sink-mute 0 toggle
|
||||||
set $truemute --no-startup-id amixer sset Master mute
|
set $truemute --no-startup-id amixer sset Master mute
|
||||||
#set $audio --no-startup-id bash ~/.config/Scripts/audio_alsa.sh
|
|
||||||
|
|
||||||
###---Dropdown/Scratchpad Windows---###
|
###---Dropdown/Scratchpad Windows---###
|
||||||
exec --no-startup-id $term --title scratchterm
|
# Make the currently focused window a scratchpad
|
||||||
for_window [title="scratchterm"] move scratchpad
|
#bindsym $mod+Shift+m move scratchpad
|
||||||
bindsym $mod+n [title="scratchterm"] scratchpad show, resize set 940 600, move position center
|
# Show the first scratchpad window
|
||||||
|
#bindsym $mod+Shift+s scratchpad show
|
||||||
|
|
||||||
|
|
||||||
###---Basic Bindings---###
|
###---Basic Bindings---###
|
||||||
bindsym $mod+Return exec $term
|
bindsym $mod+Return exec $term
|
||||||
|
|
@ -313,22 +314,15 @@ bindsym $mod+Shift+Up move up
|
||||||
bindsym $mod+Shift+Right move right
|
bindsym $mod+Shift+Right move right
|
||||||
|
|
||||||
###---Media Keys---###
|
###---Media Keys---###
|
||||||
|
|
||||||
#Volume keys
|
#Volume keys
|
||||||
bindsym $mod+plus exec $inc
|
bindsym $mod+plus exec $inc
|
||||||
bindsym $mod+Shift+plus exec $biginc
|
bindsym $mod+Shift+plus exec $biginc
|
||||||
bindsym $mod+minus exec $dec
|
bindsym $mod+minus exec $dec
|
||||||
bindsym $mod+Shift+minus exec $bigdec
|
bindsym $mod+Shift+minus exec $bigdec
|
||||||
bindsym $mod+less exec $prev
|
bindsym $mod+less exec $prev
|
||||||
bindsym $mod+Shift+less exec $beg
|
bindsym $mod+Shift+less exec $beg
|
||||||
bindsym $mod+greater exec $next
|
bindsym $mod+greater exec $next
|
||||||
bindsym $mod+Shift+greater exec $next
|
bindsym $mod+Shift+greater exec $next
|
||||||
|
|
||||||
#For advancing forward/backward in an mpd song
|
|
||||||
bindsym $mod+bracketleft exec $lilbak
|
|
||||||
bindsym $mod+Shift+bracketleft exec $bigbak
|
|
||||||
bindsym $mod+bracketright exec $lilfor
|
|
||||||
bindsym $mod+Shift+bracketright exec $bigfor
|
|
||||||
|
|
||||||
#Print screen takes a screenshot.
|
#Print screen takes a screenshot.
|
||||||
#With shift, it takes one only of the given window.
|
#With shift, it takes one only of the given window.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue