Coder Social home page Coder Social logo

betterlockscreen's Introduction

betterlockscreen

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

Screenshots

scrot1

scrot2

In action

Table of Contents

Requirements

Dependencies

Note: Make sure all dependencies are satisfied beforehand.

Installation

Manual/Git install

git clone https://github.com/pavanjadhaw/betterlockscreen 
cd betterlockscreen
cp betterlockscreen ~/.local/bin

# or wget the script ~12KB
wget -O betterlockscreen https://git.io/fASUJ
chmod u+x betterlockscreen
cp betterlockscreen ~/.local/bin

# Add betterlockscreen to PATH:
# (In your .bashrc, .zshrc etc)
export PATH="${PATH}:${HOME}/.local/bin/"

OS/Distro Packages

Arch Linux

Installing dependencies(not required if using betterlockscreen aur package)

pacman -S imagemagick feh xorg-xrandr xorg-xdpyinfo

  • i3lock-color
    • trizen -S i3lock-color

Aur package

betterlockscreen is available in the Arch User repos as betterlockscreen and betterlockscreen-git.

  • betterlockscreen
    • trizen -S betterlockscreen
  • betterlockscreen-git
    • trizen -S betterlockscreen-git

Debian and derivatives

UtkarshVerma was so kind to provide an installation script for debian based systems, check it out here.

Usage

Run betterlockscreen and point it to either a directory (betterlockscreen -u "path/to/dir") or an image (betterlockscreen -u "/path/to/img.jpg") and that's all. betterlockscreen will change update its cache with image you provided.

usage: betterlockscreen [-u "path/to/img.jpg"] [-l "dim, blur or dimblur"]
           [-w "dim, blur, or dimblur"] [-t "custom text"] [-s "lockscreen and suspend"]
					 [-r "resolution"] [-b "factor"]

betterlockscreen - faster and sweet looking lockscreen for linux systems.

required:
	-u, --update "path/to/img.jpg"	caches all required images

usage:
	-l, --lock effect-name
			locks with provided effect
	-w, --wall effect-name
			set desktop background with provided effect
	-s, --suspend effect-name
			lockscreen and suspend

			Available effects:
				dim, blur or dimblur

	-t, --text "custom text"
			set custom lockscreen text
	-b, blur 0.0 - 1.0
			set blur range
	-r, --resolution res
			uses a custom resolution


Usage examples:
1. Updating image cache(required)
betterlockscreen -u ~/Pictures/Forests.png # caches given image
betterlockscreen -u ~/Pictures             # caches random image from ~/Pictures directory

2. Custom resolution and blur range
betterlockscreen -u path/to/directory -r 1920x1080 -b 0.5

3. Lockscreen
betterlockscreen -l dim                    # lockscreen with dim effect

4. Lockscreen with custom text
betterlockscreen -l dim -t "custom lockscreen text"

5. Set desktop background
betterlockscreen -w blur                   # set desktop background with blur effect

Set desktop background on startup

Add this line to .xinitrc.

# set desktop background with custom effect
betterlockscreen -w dim

# Alternative (set last used background)
source ~/.fehbg

i3wm

Add this line to ~/.config/i3/config

# set desktop background with custom effect
exec --no-startup-id betterlockscreen -w dim

# Alternative (set last used background)
exec --no-startup-id source ~/.fehbg

Keybindings

i3wm

Add this line to your ~/.config/i3/config

bindsym $mod+shift+x exec betterlockscreen -l dim

bspwm

Add this line to your ~/.config/sxhkd/sxhkdrc

# lockscreen
alt + shift + x
    betterlockscreen -l dim

Lockscreen when suspended(systemd service)

# move service file to proper dir (the aur package does this for you)
cp [email protected] /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.

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
  • Inspiration - r/unixporn

betterlockscreen's People

Contributors

alexozer avatar autplayed avatar bjarkt avatar bosmak avatar deluxo avatar drewwalters96 avatar drpandemic avatar duncan-f avatar hcnelson99 avatar joncol avatar meatcar avatar monkeypac avatar pavanjadhaw avatar rememberyou avatar stevegcarpenter avatar targuinia avatar thetarkus avatar zv0n avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.