add wallset script

This commit is contained in:
Guilherme Rugai Freire 2021-08-28 17:02:38 -03:00
parent a41f894790
commit 9cf7146e3f
No known key found for this signature in database
GPG Key ID: 0F9FE41723A8A297
3 changed files with 41 additions and 0 deletions

1
bin/wallset Symbolic link
View File

@ -0,0 +1 @@
../wallset/wallset.sh

12
wallset/README.md Normal file
View File

@ -0,0 +1,12 @@
# wallset
## About
Set the wallpaper and generate a lockscreen image with betterlockscreen.
The new wallpaper will be copied and converted to ``~/.config/wall.png``
## Requirements
- [imagemagick](https://imagemagick.org/)
- [feh](https://feh.finalrewind.org/)
- [betterlockscreen](https://github.com/betterlockscreen/betterlockscreen)
- [notify-send](https://gitlab.gnome.org/GNOME/libnotify) (optional)

28
wallset/wallset.sh Executable file
View File

@ -0,0 +1,28 @@
#!/bin/sh
notify() {
if [ "$(command -v notify-send)" ]; then
notify-send "$@"
fi
}
IMAGE="$1"
WALLPAPER="$HOME/.config/wall.png"
echo "Converting image..."
convert "$IMAGE" "$WALLPAPER" > /dev/null
echo "Setting wallpaper..."
feh --bg-scale "$WALLPAPER" > /dev/null
generate_lockscreen() {
if betterlockscreen -u "$WALLPAPER" > /dev/null; then
notify "wallset" "Lockscreen generated!"
else
notify --urgency critical "wallset" "Error while generating lockscreen"
fi
}
echo "Generating lockscreen in the background..."
generate_lockscreen &
echo "Done!"