Last active
January 8, 2020 02:56
-
-
Save etandel/fc784d844a9a6822a747 to your computer and use it in GitHub Desktop.
Random background for i3lock
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
newname=$(echo $1 | awk -F'.' '{print $1}').png # i3lock only accepts pngs | |
resolution=$(xrandr | fgrep '*' | awk '{print $1}') | |
# if the image is too large, run the folloowing line first and then run the script again on temp.jpg: | |
# convert $1 -gravity Center -adaptive-resize $resolution -background black temp.jpg | |
convert $1 -background black -gravity center -extent $resolution -background black $newname | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
# map this script on your i3 config. | |
# change as needed | |
DEFAULT_IMGS="/home/etandel/Documents/images/pngs" | |
if [[ -z $1 ]] ; then | |
img_dir=$DEFAULT_IMGS | |
else | |
img_dir=$1 | |
fi; | |
randfile=$(ls $img_dir | sort -R | head -n1) | |
i3lock --color=000000 -i $img_dir/$randfile |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment