diff --git a/bin/wallset b/bin/wallset new file mode 120000 index 0000000..04577c0 --- /dev/null +++ b/bin/wallset @@ -0,0 +1 @@ +../wallset/wallset.sh \ No newline at end of file diff --git a/wallset/README.md b/wallset/README.md new file mode 100644 index 0000000..6036072 --- /dev/null +++ b/wallset/README.md @@ -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) diff --git a/wallset/wallset.sh b/wallset/wallset.sh new file mode 100755 index 0000000..7417233 --- /dev/null +++ b/wallset/wallset.sh @@ -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!"