Update readme for arch users

This commit is contained in:
Pavan Jadhaw 2017-12-08 11:31:03 +05:30
parent 9031955b7c
commit ed474928cb
2 changed files with 124 additions and 14 deletions

View file

@ -32,6 +32,28 @@ Make sure you have following packages installed.
* [feh](https://feh.finalrewind.org/) - used to set custom wallpaper * [feh](https://feh.finalrewind.org/) - used to set custom wallpaper
* [background.jpg](https://unsplash.com/) - find your fav background image * [background.jpg](https://unsplash.com/) - find your fav background image
### Arch users
To install required packages
Install feh and imagemagick
```
pacman -S imagemagick feh
```
Install i3lock-color-git from AUR
Pacaur Users
```
pacaur -S aur/i3lock-color-git
```
Yaourt users
```
yaourt -S i3lock-color-git
```
### How to get started ### How to get started
Clone this repo Clone this repo
@ -52,7 +74,11 @@ grab your fav image for lockscreen background
./lock.sh -u path/to/image.img ./lock.sh -u path/to/image.img
``` ```
well, now lockscreen (original image) ---
### To lockscreen
Original image as background
``` ```
./lock.sh -l ./lock.sh -l
@ -70,7 +96,11 @@ Use blurred image as lockscreen background
./lock.sh -l blur ./lock.sh -l blur
``` ```
well, now set wallpaper (original image) ---
### To set wallpaper
Original Image
``` ```
./lock.sh -w ./lock.sh -w
@ -88,10 +118,19 @@ Use blurred image as desktop background
./lock.sh -w blur ./lock.sh -w blur
``` ```
Use dim + blurred image as desktop background
```
./lock.sh -w dimblur
```
---
To set desktop background on startup, add following lines to your .xintrc after pushing script to your path or you can use absolute path to script too To set desktop background on startup, add following lines to your .xintrc after pushing script to your path or you can use absolute path to script too
``` ```
exec lock -u ~/.wall.png &
exec lock.sh -w exec lock.sh -w
``` ```
@ -110,6 +149,8 @@ exec --no-startup-id lock.sh -U ~/.wall.png
exec --no-startup-id lock.sh -w exec --no-startup-id lock.sh -w
``` ```
---
## Feel free to use and distribute ## Feel free to use and distribute
This is my first bash script so if you think this could be improved or if you have any suggestion. Feel free. This is my first bash script so if you think this could be improved or if you have any suggestion. Feel free.

93
lock.sh
View file

@ -1,5 +1,9 @@
#!/usr/bin/bash #!/usr/bin/bash
# Author : Pavan Jadhaw
# Github Profile : https://github.com/pavanjadhaw
# Project Repository : https://github.com/pavanjadhaw/betterlockscreen
# ratio for rectangle to be drawn for time background on lockscreen # ratio for rectangle to be drawn for time background on lockscreen
rectangles=" " rectangles=" "
SR=$(xrandr --query | grep ' connected' | grep -o '[0-9][0-9]*x[0-9][0-9]*[^ ]*') SR=$(xrandr --query | grep ' connected' | grep -o '[0-9][0-9]*x[0-9][0-9]*[^ ]*')
@ -36,11 +40,13 @@ resized="$folder/resized.png" # resized image for your resolution
# images to be used as wallpaper # images to be used as wallpaper
dim="$folder/dim.png" # image with subtle overlay of black dim="$folder/dim.png" # image with subtle overlay of black
blur="$folder/blur.png" # blurred version blur="$folder/blur.png" # blurred version
dimblur="$folder/dimblur.png"
# lockscreen images (images to be used as lockscreen background) # lockscreen images (images to be used as lockscreen background)
l_resized="$folder/l_resized.png" l_resized="$folder/l_resized.png"
l_dim="$folder/l_dim.png" l_dim="$folder/l_dim.png"
l_blur="$folder/l_blur.png" l_blur="$folder/l_blur.png"
l_dimblur="$folder/l_dimblur.png"
# Options # Options
@ -54,7 +60,17 @@ case "$1" in
echo "See also : For other set of options and help use help command." echo "See also : For other set of options and help use help command."
echo "Ex. ./lock.sh -h or ./lock.sh --help" echo "Ex. ./lock.sh -h or ./lock.sh --help"
echo echo
echo "See : github.com/pavanjadhaw/better_lock for addition info..." echo "See : https://github.com/pavanjadhaw/betterlockscreen for addition info..."
exit 1
else
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. ./lock.sh -h or ./lock.sh --help"
echo
echo "See : https://github.com/pavanjadhaw/betterlockscreen for addition info..."
echo
exit 1 exit 1
fi fi
@ -64,10 +80,8 @@ case "$1" in
echo "Important : Update the image cache, Ex: ./lock.sh -g path/to/image.jpg" echo "Important : Update the image cache, Ex: ./lock.sh -g path/to/image.jpg"
echo echo
echo "See also : For other set of options and help use help command."
echo "Ex. ./lock.sh -h or ./lock.sh --help"
echo echo
echo "See : github.com/pavanjadhaw/better_lock for additional info..." echo "See : https://github.com/pavanjadhaw/betterlockscreen for additional info..."
echo echo
echo echo
echo "Options:" echo "Options:"
@ -86,6 +100,7 @@ case "$1" in
echo " you can also use dimmed or blurred background for lockscreen" echo " you can also use dimmed or blurred background for lockscreen"
echo " Ex: ./lock.sh -l dim (for dimmed background)" echo " Ex: ./lock.sh -l dim (for dimmed background)"
echo " Ex: ./lock.sh -l blur (for blurred background)" echo " Ex: ./lock.sh -l blur (for blurred background)"
echo " Ex: ./lock.sh -l dimblur (for dimmed + blurred background)"
echo echo
echo echo
echo " -w --wall" echo " -w --wall"
@ -94,6 +109,7 @@ case "$1" in
echo " you can also use dimmed or blurred variants" echo " you can also use dimmed or blurred variants"
echo " Ex: ./lock.sh -w dim (for dimmed wallpaper)" echo " Ex: ./lock.sh -w dim (for dimmed wallpaper)"
echo " Ex: ./lock.sh -w blur (for blurred wallpaper)" echo " Ex: ./lock.sh -w blur (for blurred wallpaper)"
echo " Ex: ./lock.sh -w dimblur (for dimmed + blurred wallpaper)"
echo echo
;; ;;
@ -104,11 +120,10 @@ case "$1" in
"") "")
# just lockscreen with dimmed wallpaper if no argument is provided by user. # default lockscreen
# stop dunst from showing notifications on lockscreen # stop dunst from showing notifications on lockscreen
pkill -u "$USER" -USR1 dunst pkill -u "$USER" -USR1 dunst
# you will need to have i3lock-color package availble on aur(arch user repository)
i3lock \ i3lock \
-n -i "$l_resized" \ -n -i "$l_resized" \
--timepos="x-90:h-ch+30" \ --timepos="x-90:h-ch+30" \
@ -129,11 +144,10 @@ case "$1" in
dim) dim)
# Just lockscreen with dimmed wallpaper if no argument is provided by user. # lockscreen with dimmed background
# stop dunst from showing notifications on lockscreen # stop dunst from showing notifications on lockscreen
pkill -u "$USER" -USR1 dunst pkill -u "$USER" -USR1 dunst
# you will need to have i3lock-color package availble on AUR(arch user repository)
i3lock \ i3lock \
-n -i "$l_dim" \ -n -i "$l_dim" \
--timepos="x-90:h-ch+30" \ --timepos="x-90:h-ch+30" \
@ -153,11 +167,10 @@ case "$1" in
blur) blur)
# Just lockscreen with dimmed wallpaper if no argument is provided by user. # set lockscreen with blurred background
# stop dunst from showing notifications on lockscreen # stop dunst from showing notifications on lockscreen
pkill -u "$USER" -USR1 dunst pkill -u "$USER" -USR1 dunst
# you will need to have i3lock-color package availble on AUR(arch user repository)
i3lock \ i3lock \
-n -i "$l_blur" \ -n -i "$l_blur" \
--timepos="x-90:h-ch+30" \ --timepos="x-90:h-ch+30" \
@ -175,27 +188,68 @@ case "$1" in
;; ;;
dimblur)
# set lockscreen with dimmed + blurred background
# stop dunst from showing notifications on lockscreen
pkill -u "$USER" -USR1 dunst
i3lock \
-n -i "$l_dimblur" \
--timepos="x-90:h-ch+30" \
--datepos="tx+24:ty+25" \
--clock --datestr "Type password to unlock..." \
--insidecolor=00000000 --ringcolor=ffffffff --line-uses-inside \
--keyhlcolor=d23c3dff --bshlcolor=d23c3dff --separatorcolor=00000000 \
--insidevercolor=fecf4dff --insidewrongcolor=d23c3dff \
--ringvercolor=ffffffff --ringwrongcolor=ffffffff --indpos="x+280:h-70" \
--radius=20 --ring-width=3 --veriftext="" --wrongtext="" \
--textcolor="ffffffff" --timecolor="ffffffff" --datecolor="ffffffff"
# enable notifications once unlocked
pkill -u "$USER" -USR2 dunst
;;
esac esac
;; ;;
-w | --wall) -w | --wall)
# w = set wallpaper # w = set wallpaper
case "$2" in case "$2" 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 feh --bg-fill $resized
;; ;;
dim) dim)
# set dimmed image as wallpaper # set dimmed image as wallpaper
feh --bg-fill $dim feh --bg-fill $dim
;; ;;
blur) blur)
# set blurred image as wallpaper # set blurred image as wallpaper
feh --bg-fill $blur feh --bg-fill $blur
;; ;;
dimblur)
# set dimmed + blurred image as wallpaper
feh --bg-fill $dimblur
;;
esac esac
;; ;;
@ -226,15 +280,22 @@ case "$1" in
# wallpapers {{{ # wallpapers {{{
echo
echo "Converting provided image to match your resolution..."
# resize image # resize image
convert "$orig_wall" -resize "$y_res""^" -gravity center -extent "$y_res" "$resized" convert "$orig_wall" -resize "$y_res""^" -gravity center -extent "$y_res" "$resized"
echo
echo "Applying dim and blur effect to resized image"
# dim # dim
convert "$resized" -fill black -colorize 40% "$dim" convert "$resized" -fill black -colorize 40% "$dim"
# blur # blur
convert "$resized" -blur 0x5 "$blur" convert "$resized" -blur 0x5 "$blur"
# dimblur
convert "$dim" -blur 0x5 "$dimblur"
# }}} # }}}
@ -242,6 +303,8 @@ case "$1" in
# lockscreen backgrounds {{{ # lockscreen backgrounds {{{
echo
echo "caching images for faster screen locking"
# resized # resized
convert "$resized" -draw "fill black fill-opacity 0.4 $rectangles" "$l_resized" convert "$resized" -draw "fill black fill-opacity 0.4 $rectangles" "$l_resized"
@ -251,12 +314,18 @@ case "$1" in
# blur # blur
convert "$blur" -draw "fill black fill-opacity 0.4 $rectangles" "$l_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 "All required images have been generated"
echo
echo "All required changes have been applied"
;; ;;
esac esac