Ceylan Bozoğullarından 7b8cfad22b
Changed again.
2019-02-15 16:44:46 +03:00

18 lines
650 B
Bash
Executable File

#!/bin/sh
# Sets the background.
# If given an argument with -u flag, will check the file from given url whether it is an image or not. If the file is an image then it sets the file as background.
# Without -u flag, will set local file as backgound.
if [ "$1" == "-u" ]; then
type="$(curl -sI $2 | sed -En 's/^Content-Type: (.*)\/(.*)/\1/p')"
if [ "$type" == "image" ]; then
curl -o ~/.config/wall.png "$2"
xwallpaper --maximize ~/.config/wall.png
else
echo "Not an image!"
fi
else
[ ! -z "$1" ] && cp "$1" ~/.config/wall.png && notify-send -i "$HOME/.config/wall.png" "Wallpaper changed."
xwallpaper --maximize ~/.config/wall.png
fi