2020-03-14 00:59:34 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2020-03-14 11:24:18 +00:00
|
|
|
function generateWallpaper() {
|
2020-12-06 09:33:05 +00:00
|
|
|
notify-send.py --hint string:image-path:"$2" --replaces-process setwallpaper -a sxiv "Setting wallpaper" &
|
2020-03-14 11:24:18 +00:00
|
|
|
|
2020-12-06 09:33:05 +00:00
|
|
|
# Only generate wal color schemes for main monitor
|
|
|
|
if [ "$1" == 0 ]; then
|
|
|
|
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')
|
|
|
|
elif [ "$1" == 1 ]; 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')
|
|
|
|
fi
|
2020-03-14 11:24:18 +00:00
|
|
|
|
2020-12-06 09:33:05 +00:00
|
|
|
notify-send.py --hint string:image-path:"$2" --replaces-process setwallpaper -a sxiv "Converting wallpaper" &
|
|
|
|
convert "${2}" "${OUTPUT_IMAGE}"
|
|
|
|
notify-send.py --hint string:image-path:"$2" --replaces-process setwallpaper -a sxiv "Generating wal color scheme" &
|
|
|
|
~/.local/bin/generatewal
|
|
|
|
notify-send.py --hint string:image-path:"$2" --replaces-process setwallpaper -a sxiv "Setting wallpaper" &
|
|
|
|
~/.local/bin/wallpaper
|
|
|
|
notify-send.py --hint string:image-path:"$1" --replaces-process setwallpaper -a sxiv "Wallpaper set" &
|
2020-03-14 11:24:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
while read -r file; do
|
2020-12-06 09:33:05 +00:00
|
|
|
case "$1" in
|
|
|
|
"C-c")
|
|
|
|
echo -n "$file" | xclip -selection clipboard
|
|
|
|
notify-send.py --hint string:image-path:"$file" -a sxiv "Added to clipboard" &
|
|
|
|
;;
|
|
|
|
"C-w")
|
|
|
|
generateWallpaper 0 "$file"
|
|
|
|
;;
|
|
|
|
"C-1")
|
|
|
|
generateWallpaper 0 "$file"
|
|
|
|
;;
|
|
|
|
"C-2")
|
|
|
|
generateWallpaper 1 "$file"
|
|
|
|
;;
|
|
|
|
esac
|
2020-03-14 00:59:34 +00:00
|
|
|
done
|