2019-11-22 06:58:55 +00:00
|
|
|
#!/usr/bin/env sh
|
|
|
|
|
|
|
|
# Description: Set the selected image as wallpaper using nitrogen or pywal.
|
2021-05-15 17:32:01 +00:00
|
|
|
#
|
2019-11-22 06:58:55 +00:00
|
|
|
# Usage: Hover on an image and run the script to set it as wallpaper.
|
|
|
|
#
|
2021-05-15 17:32:01 +00:00
|
|
|
# Shell: POSIX compliant
|
2019-11-22 06:58:55 +00:00
|
|
|
# Author: juacq97
|
|
|
|
|
2020-11-22 14:39:14 +00:00
|
|
|
if [ -n "$1" ]; then
|
2021-01-18 13:29:59 +00:00
|
|
|
if [ "$(file --mime-type "$1" | awk '{print $NF}' | awk -F '/' '{print $1}')" = "image" ]; then
|
2021-05-14 12:03:28 +00:00
|
|
|
if type nitrogen >/dev/null 2>&1; then
|
2019-11-22 06:58:55 +00:00
|
|
|
nitrogen --set-zoom-fill --save "$1"
|
2021-05-14 12:03:28 +00:00
|
|
|
elif type wal >/dev/null 2>&1; then
|
2019-11-22 06:58:55 +00:00
|
|
|
wal -i "$1"
|
|
|
|
else
|
|
|
|
printf "nitrogen ir pywal missing"
|
|
|
|
read -r _
|
|
|
|
fi
|
|
|
|
|
|
|
|
# If you want a system notification, uncomment the next 3 lines.
|
|
|
|
# notify-send -a "nnn" "Wallpaper changed!"
|
|
|
|
# else
|
|
|
|
# notify-send -a "nnn" "No image selected"
|
|
|
|
fi
|
|
|
|
fi
|