2017-12-07 18:51:34 +00:00
# better_lockscreen
A simple lock script for i3lock
2017-12-10 22:25:05 +00:00
2017-12-07 18:51:34 +00:00
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.
2017-12-10 22:25:05 +00:00
2017-12-07 18:59:37 +00:00
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,
2017-12-07 18:51:34 +00:00
without the need to apply same effect again and again
2017-12-07 20:16:52 +00:00
## Screenshots
Screenshots or it didnt happen... :P
2017-12-08 18:04:59 +00:00
![scrot1 ](https://github.com/pavanjadhaw/betterlockscreen.demo/raw/master/scrots/scrot1.png "scrot1.png" )
2017-12-07 20:16:52 +00:00
2017-12-08 18:04:59 +00:00
![scrot2 ](https://github.com/pavanjadhaw/betterlockscreen.demo/raw/master/scrots/scrot2.png "scrot2.png" )
2017-12-07 20:16:52 +00:00
2017-12-10 22:25:05 +00:00
### Demo
2017-12-07 20:16:52 +00:00
2017-12-10 22:25:05 +00:00
* [Demonstration ](https://www.youtube.com/watch?v=9Ng5FZwnn6M&feature=youtu.be ) - youtube.com
2017-12-07 20:16:52 +00:00
2017-12-07 18:51:34 +00:00
## Getting Started
Clone this repo, push this script somewhere handy or you can even copy this script to /usr/local/bin so that it can be used from your i3config without defining whole path.
### Prerequisites
Make sure you have following packages installed.
2017-12-10 12:28:20 +00:00
* [i3lock-color ](https://github.com/PandorasFox/i3lock-color ) - i3lock fork with additional features (use development branch while building from source for arch use i3lock-color-git from AUR)
2017-12-07 18:51:34 +00:00
* [imagemagick ](https://www.imagemagick.org/script/index.php ) - to apply effects to images
* [feh ](https://feh.finalrewind.org/ ) - used to set custom wallpaper
2017-12-10 04:41:23 +00:00
* [xdpyinfo ](https://www.x.org/archive/X11R7.7/doc/man/man1/xdpyinfo.1.xhtml ) - find your screen resolution (to resize images accordingly)
* [xrandr ](https://www.x.org/wiki/Projects/XRandR/ ) - depends for xdpyinfo
2017-12-07 18:51:34 +00:00
* [background.jpg ](https://unsplash.com/ ) - find your fav background image
2017-12-08 06:01:03 +00:00
### Arch users
To install required packages
Install feh and imagemagick
```
pacman -S imagemagick feh
```
2017-12-10 04:41:23 +00:00
Install xrandr and xdpyinfo (currently used to find screenresolution)
If anyone knows better way so that these dependencies could be minimized, please open issue.
```
2017-12-10 09:23:57 +00:00
pacman -S xorg-xrandr xorg-xdpyinfo
2017-12-10 04:41:23 +00:00
```
2017-12-08 06:01:03 +00:00
Install i3lock-color-git from AUR
Pacaur Users
```
pacaur -S aur/i3lock-color-git
```
Yaourt users
```
yaourt -S i3lock-color-git
```
2017-12-07 18:51:34 +00:00
### How to get started
2017-12-08 18:15:22 +00:00
#### Clone this repo
2017-12-07 18:51:34 +00:00
```
git clone https://github.com/pavanjadhaw/betterlockscreen
```
navigate to cloned repository
```
cd betterlockscreen
```
2017-12-08 18:15:22 +00:00
---
#### If you dont want to clone the repo and save some bandwidth and diskspace you can do the following
```
wget https://raw.githubusercontent.com/pavanjadhaw/betterlockscreen/master/lock.sh
chmod +x lock.sh
```
---
2017-12-10 22:25:05 +00:00
### Load/Update the image cache
Grab your favourite image for lockscreen background
2017-12-07 18:51:34 +00:00
```
./lock.sh -u path/to/image.img
2017-12-10 22:25:05 +00:00
```
2017-12-08 11:55:12 +00:00
2017-12-10 22:25:05 +00:00
Or supply a directory with images, and a random one will be used
2017-12-08 11:55:12 +00:00
2017-12-10 22:25:05 +00:00
```
./lock.sh -u path/to/imagedir
2017-12-07 18:51:34 +00:00
```
2017-12-08 06:01:03 +00:00
---
### To lockscreen
Original image as background
2017-12-07 18:51:34 +00:00
```
./lock.sh -l
```
Use dimmed image as lockscreen background
```
./lock.sh -l dim
```
Use blurred image as lockscreen background
```
./lock.sh -l blur
```
2017-12-08 06:05:11 +00:00
Use dim + blurred image as lockscreen background
```
./lock.sh -l dimblur
```
2017-12-08 06:01:03 +00:00
---
### To set wallpaper
Original Image
2017-12-07 18:51:34 +00:00
```
./lock.sh -w
```
Use dimmed image as desktop background
```
./lock.sh -w dim
```
Use blurred image as desktop background
```
./lock.sh -w blur
```
2017-12-08 06:01:03 +00:00
Use dim + blurred image as desktop background
```
./lock.sh -w dimblur
```
---
2017-12-07 18:51:34 +00:00
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
```
2017-12-08 07:44:35 +00:00
exec lock.sh -u ~/.wall.png &
2017-12-08 06:01:03 +00:00
2017-12-07 18:51:34 +00:00
exec lock.sh -w
```
If you are i3wm user, add following line to your i3config (~/.config/i3/config or ~/.i3/config)
```
2017-12-07 18:59:37 +00:00
# custom keybinding to lockscreen, use --lock dim or --lock blur below for different backgrounds
bindsym $mod+shift+x exec lock.sh --lock
# bindsym $mod+shift+x exec lock.sh --lock dim
# bindsym $mod+shift+x exec lock.sh --lock blur
# Update image cache
2017-12-09 09:43:53 +00:00
exec --no-startup-id lock.sh -u ~/.wall.png
2017-12-07 18:59:37 +00:00
# Set last used image as desktop background, comment out below line if you use different desktop background utility
2017-12-07 18:51:34 +00:00
exec --no-startup-id lock.sh -w
```
2017-12-08 06:01:03 +00:00
---
2017-12-07 18:51:34 +00:00
## 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.
* Hat tip to anyone who's code was used
2017-12-10 04:41:23 +00:00
* Thanks to those who contributed to make it better
2017-12-07 18:51:34 +00:00
* Inspiration - r/unixporn
* etc