2019-11-22 06:58:55 +00:00
|
|
|
#!/usr/bin/env sh
|
|
|
|
|
2022-11-01 23:27:57 +00:00
|
|
|
# Description: Set the selected image as wallpaper.
|
|
|
|
# Uses nitrogen or pywal on X11, swww on wayland.
|
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
|
|
|
|
|
2023-09-13 00:58:37 +00:00
|
|
|
resp=
|
|
|
|
|
2020-11-22 14:39:14 +00:00
|
|
|
if [ -n "$1" ]; then
|
2022-11-01 17:03:14 +00:00
|
|
|
if [ "$(file --mime-type "$1" | awk '{print $NF}' | awk -F '/' '{print $1}')" = "image" ]; then
|
|
|
|
if [ "$XDG_SESSION_TYPE" = "x11" ]; then
|
|
|
|
if type nitrogen >/dev/null 2>&1; then
|
2023-09-13 00:58:37 +00:00
|
|
|
printf "Set to full desktop or a specific monitors? [0, 1, etc. Defaults to full.]"
|
|
|
|
read -r resp
|
|
|
|
if [ "$resp" != "" ]; then
|
|
|
|
nitrogen --set-zoom-fill --save "$1" --head="$resp"
|
|
|
|
else
|
|
|
|
nitrogen --set-zoom-fill --save "$1"
|
|
|
|
fi
|
2022-11-01 17:03:14 +00:00
|
|
|
elif type wal >/dev/null 2>&1; then
|
|
|
|
wal -i "$1"
|
|
|
|
else
|
|
|
|
printf "nitrogen or pywal missing"
|
|
|
|
read -r _
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
if type swww >/dev/null 2>&1; then
|
|
|
|
swww img "$1"
|
|
|
|
else
|
|
|
|
printf "swww missing"
|
|
|
|
read -r _
|
|
|
|
fi
|
|
|
|
fi
|
2019-11-22 06:58:55 +00:00
|
|
|
|
|
|
|
# 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"
|
2022-11-01 17:03:14 +00:00
|
|
|
|
2019-11-22 06:58:55 +00:00
|
|
|
fi
|
|
|
|
fi
|