2019-03-22 15:51:30 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
clear
|
|
|
|
|
2019-03-24 16:18:39 +00:00
|
|
|
if [ "${2}" = "2" ]
|
|
|
|
then
|
|
|
|
OUTPUT_IMAGE="$HOME/.cache/wall2.png"
|
|
|
|
WIDTH=$(xrandr | grep '\*' | sed -n '1p' | awk -F 'x' '{print $2}' | awk -F '_' '{print $1}' | sed 's/ //g')
|
|
|
|
HEIGHT=$(xrandr | grep '\*' | sed -n '1p' | awk -F 'x' '{print $1}' | sed 's/ //g')
|
|
|
|
else
|
|
|
|
OUTPUT_IMAGE="$HOME/.cache/wall1.png"
|
|
|
|
# Use tail -n 1 to get last monitor so this works with laptop as well
|
|
|
|
WIDTH=$(xrandr | grep '\*' | tail -n 1 | awk -F 'x' '{print $1}' | sed 's/ //g')
|
|
|
|
HEIGHT=$(xrandr | grep '\*' | tail -n 1 | awk -F 'x' '{print $2}' | awk '{print $1}' | sed 's/ //g')
|
|
|
|
fi
|
2019-03-22 15:51:30 +00:00
|
|
|
|
2019-03-24 16:18:39 +00:00
|
|
|
echo "Converting ${1} to ${OUTPUT_IMAGE}"
|
2019-03-22 15:51:30 +00:00
|
|
|
convert "${1}" "${OUTPUT_IMAGE}"
|
|
|
|
|
2019-03-24 16:18:39 +00:00
|
|
|
echo "Resizing ${OUTPUT_IMAGE} to ${WIDTH}x${HEIGHT}"
|
|
|
|
convert "${OUTPUT_IMAGE}" -resize "${WIDTH}x${HEIGHT}^" -gravity center -extent "${WIDTH}"x"${HEIGHT}" "${OUTPUT_IMAGE}"
|
|
|
|
|
|
|
|
echo "Setting background images...."
|
2019-05-31 14:06:39 +00:00
|
|
|
if [ -e ~/.cache/wall1.png ] && [ -e ~/.cache/wall2.png ]
|
|
|
|
then
|
|
|
|
xwallpaper --output HDMI-2 --zoom ~/.cache/wall2.png --output DP-1 --zoom ~/.cache/wall1.png &
|
|
|
|
elif [ -e ~/.cache/wall1.png ]
|
|
|
|
then
|
|
|
|
xwallpaper --output eDP1 --zoom ~/.cache/wall1.png &
|
|
|
|
fi
|
2019-03-22 15:51:30 +00:00
|
|
|
|
|
|
|
echo "done!"
|