#!/bin/sh

mkdir -p ~/.local/
mkdir -p ~/.local/share/
mkdir -p ~/.local/share/backgrounds/

convert $1 ~/.local/share/backgrounds/full.png
magick ~/.local/share/backgrounds/full.png -resize $(xrandr | grep '*' | cut -f 1 -d x)x$(xrandr | grep '*' | cut -f 2 -d x | cut -f 1 -d ' ')^ ~/.local/share/backgrounds/wallpaper.png
xwallpaper --zoom ~/.local/share/backgrounds/wallpaper.png

sudo mkdir -p /usr/share/backgrounds/
sudo cp ~/.local/share/backgrounds/wallpaper.png /usr/share/backgrounds/wallpaper.png
