mirror of
https://git.adityakumar.xyz/betterlockscreen-openrc.git
synced 2024-11-08 18:29:45 +00:00
Merge pull request #7 from AUTplayed/master
Now recursively select random file, and adjusted README
This commit is contained in:
commit
03af700789
2 changed files with 25 additions and 11 deletions
16
README.md
16
README.md
|
@ -1,9 +1,11 @@
|
|||
# better_lockscreen
|
||||
|
||||
A simple lock script for i3lock
|
||||
|
||||
Most of i3lock script out there converts your defined image to add blur, glitch or dim effect to image and it feels so slow and btw who needs dynamic lock background,
|
||||
its not like I change lockscreen background every 5 minutes.
|
||||
I wanted something that was fast and still should have all the effects I want for lockscreen background.
|
||||
|
||||
This script generates or already caches the variant for your custom images before hand so they can be later used any number of time as lockscreen background,
|
||||
without the need to apply same effect again and again
|
||||
|
||||
|
@ -15,9 +17,9 @@ Screenshots or it didnt happen... :P
|
|||
|
||||
![scrot2](https://github.com/pavanjadhaw/betterlockscreen.demo/raw/master/scrots/scrot2.png "scrot2.png")
|
||||
|
||||
### demo.mp4
|
||||
### Demo
|
||||
|
||||
* [demo.mp4](https://www.youtube.com/watch?v=9Ng5FZwnn6M&feature=youtu.be) - youtube.com
|
||||
* [Demonstration](https://www.youtube.com/watch?v=9Ng5FZwnn6M&feature=youtu.be) - youtube.com
|
||||
|
||||
## Getting Started
|
||||
|
||||
|
@ -89,14 +91,18 @@ chmod +x lock.sh
|
|||
|
||||
---
|
||||
|
||||
grab your fav image for lockscreen background
|
||||
### Load/Update the image cache
|
||||
|
||||
Grab your favourite image for lockscreen background
|
||||
|
||||
```
|
||||
./lock.sh -u path/to/image.img
|
||||
```
|
||||
|
||||
# OR use wallaper.jpg supplied from this repo
|
||||
Or supply a directory with images, and a random one will be used
|
||||
|
||||
./lock.sh -u wallaper.jpg
|
||||
```
|
||||
./lock.sh -u path/to/imagedir
|
||||
```
|
||||
|
||||
---
|
||||
|
|
20
lock.sh
20
lock.sh
|
@ -57,6 +57,17 @@ postlock() {
|
|||
pkill -u "$USER" -USR2 dunst
|
||||
}
|
||||
|
||||
rec_get_random() {
|
||||
dir="$1"
|
||||
if [ ! -d "$dir" ]; then
|
||||
user_input="$dir"
|
||||
return
|
||||
fi
|
||||
dir=($dir/*)
|
||||
dir=${dir[RANDOM % ${#dir[@]}]}
|
||||
rec_get_random "$dir"
|
||||
}
|
||||
|
||||
|
||||
# Options
|
||||
case "$1" in
|
||||
|
@ -98,6 +109,7 @@ case "$1" in
|
|||
echo " -u --update"
|
||||
echo " to update image cache, you should do this before using any other options"
|
||||
echo " Ex: ./lock.sh -u path/to/image.png when image.png is custom background"
|
||||
echo " Or you can use ./lock.sh -u path/to/imagedir and a random file will be selected"
|
||||
echo
|
||||
echo
|
||||
echo " -l --lock"
|
||||
|
@ -198,12 +210,8 @@ case "$1" in
|
|||
fi
|
||||
|
||||
# get random file in dir if passed argument is a dir
|
||||
user_input=$2
|
||||
if [ -d $user_input ]; then
|
||||
user_input=($user_input/*)
|
||||
user_input=${user_input[RANDOM % ${#user_input[@]}]}
|
||||
fi
|
||||
|
||||
rec_get_random "$2"
|
||||
|
||||
# get user image
|
||||
cp "$user_input" "$user_image"
|
||||
if [ ! -f $user_image ]; then
|
||||
|
|
Loading…
Reference in a new issue