betterlockscreen-openrc/README.md

189 lines
5.9 KiB
Markdown
Raw Normal View History

2017-12-14 03:24:03 +00:00
# betterlockscreen
2017-12-12 02:35:30 +00:00
*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
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
## Features
```
# Lock screen
betterlockscreen -l | --lock [modifier]
# Lock screen with custom text
betterlockscreen -l | --lock [modifier] -t | --text "custom lockscreen text"
E.g: $ betterlockscreen -l dim -t \"Don't touch my machine!\""
# Set wallpaper
betterlockscreen -w | --wall [modifier]
# Suspend system
betterlockscreen -s | --suspend [modifier]
# Update image cache
betterlockscreen -u | --update (path/to/image.png | path/to/directory)
\ [-r | --resolution <resolution>] [-b | --blur <factor>]
Modifiers:
dim
blur
dimblur
Example update image cache:
betterlockscreen -u path/to/directory -r 1920x1080 -b 0.5
2018-09-17 13:41:40 +00:00
In this case a random image from the directory is chosen
and converted to a 1920x1080 resolution with the blur factor set to 0.5
```
## Lockscreen when suspended
```
# move service file to proper dir (the aur package does this for you)
cp betterlockscreen@.service /etc/systemd/system/
# enable systemd service
systemctl enable betterlockscreen@$USER
# disable systemd service
systemctl disable betterlockscreen@$USER
Note: Now you can call systemctl suspend to suspend your system and betterlockscreen service will be activated
so when your system wakes your screen will be locked.
```
## Installation via AUR package
2017-12-15 02:22:48 +00:00
2018-01-04 13:04:16 +00:00
### [release](https://aur.archlinux.org/packages/betterlockscreen/)
recommended if you want to spend less on bandwidth(less than 10kb)
2017-12-15 02:22:48 +00:00
```
pacaur -S aur/betterlockscreen
```
```
yaourt -S betterlockscreen
2017-12-15 02:22:48 +00:00
```
2018-01-04 13:04:16 +00:00
### [dev](https://aur.archlinux.org/packages/betterlockscreen-git/)
latest features but includes git history so 8mb+ of downloading.
```
pacaur -S aur/betterlockscreen-git
```
2017-12-15 02:22:48 +00:00
```
yaourt -S betterlockscreen-git
```
## Manual Installation
2017-12-07 18:51:34 +00:00
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.
```
git clone https://github.com/pavanjadhaw/betterlockscreen
# optionally copy the script to /usr/local/bin so you can execute it everywhere
cp betterlockscreen/betterlockscreen /usr/local/bin/betterlockscreen
```
OR
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/betterlockscreen
chmod u+x betterlockscreen
```
2017-12-07 18:51:34 +00:00
### Prerequisites
Make sure you have following packages installed.
2018-04-11 17:01:02 +00:00
* [i3lock-color](https://github.com/PandorasFox/i3lock-color) - i3lock fork with additional features (currently supported versions are 2.11-c and newer)
2017-12-07 18:51:34 +00:00
* [imagemagick](https://www.imagemagick.org/script/index.php) - to apply effects to images
* [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
* [bc](https://www.gnu.org/software/bc/) - used for setting the blur level
* [feh](https://feh.finalrewind.org/) - used to set custom wallpaper
2017-12-07 18:51:34 +00:00
2017-12-24 04:33:52 +00:00
*Note: systemd is required for the suspend feature.*
2017-12-08 06:01:03 +00:00
### Arch users
To install required packages
Install feh, imagemagick, xrandr and xdpyinfo (currently used to find screenresolution)
If anyone knows better way so that these dependencies could be minimized, please open issue.
```
pacman -S imagemagick feh xorg-xrandr xorg-xdpyinfo
```
Install i3lock-color from AUR
2017-12-08 06:01:03 +00:00
Pacaur Users
```
pacaur -S aur/i3lock-color
2017-12-08 06:01:03 +00:00
```
Yaourt users
```
yaourt -S i3lock-color
2017-12-08 06:01:03 +00:00
```
---
2017-12-07 18:51:34 +00:00
### Debian based users
UtkarshVerma was so kind to provide an installation script for debian based systems, [check it out here.](https://github.com/UtkarshVerma/installer-scripts/blob/master/betterlockscreen.sh)
---
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-14 03:16:51 +00:00
exec betterlockscreen -w
2017-12-07 18:51:34 +00:00
```
If you are i3wm user, add following line to your i3config (~/.config/i3/config or ~/.i3/config)
*custom shortcut to lockscreen*
2017-12-07 18:51:34 +00:00
```
2017-12-07 18:59:37 +00:00
# custom keybinding to lockscreen, use --lock dim or --lock blur below for different backgrounds
2017-12-14 03:16:51 +00:00
bindsym $mod+shift+x exec betterlockscreen --lock
```
2017-12-07 18:59:37 +00:00
*set last cached image as desktop background*
```
2017-12-11 01:24:23 +00:00
# Set last used image as desktop background
2017-12-14 03:16:51 +00:00
exec --no-startup-id betterlockscreen -w
2017-12-07 18:51:34 +00:00
```
*set the image cache to a random image from a directory of your choice on each startup*
```
# where Pictures/Wallpapers is the directory you would want to get random wallpapers from
2017-12-14 03:16:51 +00:00
exec --no-startup-id betterlockscreen -u ~/Pictures/Wallpapers
# add this only if you want to use same random image as desktop background too
2017-12-11 01:31:37 +00:00
# it might not work as it takes few seconds for images to be cached,
# try adding delay of 5 seconds if thats the case
2017-12-14 03:16:51 +00:00
exec --no-startup-id betterlockscreen -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
* Thanks to those who contributed to make it better
2017-12-07 18:51:34 +00:00
* Inspiration - r/unixporn