1
0
mirror of https://github.com/alrayyes/dotfiles/ synced 2023-11-14 15:56:30 +00:00

fix(sxiv): wallaper setting works again

This commit is contained in:
Ryan Kes 2020-12-06 10:33:05 +01:00
parent 6f1ad766cc
commit 5034caf4a6

View File

@ -1,50 +1,43 @@
#!/usr/bin/env bash #!/usr/bin/env bash
function generateWallpaper() { function generateWallpaper() {
notify-send.py --hint string:image-path:"$2" --replaces-process setwallpaper -a sxiv "Setting wallpaper" & notify-send.py --hint string:image-path:"$2" --replaces-process setwallpaper -a sxiv "Setting wallpaper" &
# Only generate wal color schemes for main monitor # Only generate wal color schemes for main monitor
if [ "$1" == 0 ]; then if [ "$1" == 0 ]; then
OUTPUT_IMAGE="$HOME/.cache/wall1.png" OUTPUT_IMAGE="$HOME/.cache/wall1.png"
# Use tail -n 1 to get last monitor so this works with laptop as well # 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') 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') HEIGHT=$(xrandr | grep '\*' | tail -n 1 | awk -F 'x' '{print $2}' | awk '{print $1}' | sed 's/ //g')
elif [ "$1" == 1 ]; then elif [ "$1" == 1 ]; then
OUTPUT_IMAGE="$HOME/.cache/wall2.png" OUTPUT_IMAGE="$HOME/.cache/wall2.png"
WIDTH=$(xrandr | grep '\*' | sed -n '1p' | awk -F 'x' '{print $2}' | awk -F '_' '{print $1}' | sed 's/ //g') 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') HEIGHT=$(xrandr | grep '\*' | sed -n '1p' | awk -F 'x' '{print $1}' | sed 's/ //g')
fi fi
notify-send.py --hint string:image-path:"$2" --replaces-process setwallpaper -a sxiv "Converting wallpaper" & notify-send.py --hint string:image-path:"$2" --replaces-process setwallpaper -a sxiv "Converting wallpaper" &
convert "${2}" "${OUTPUT_IMAGE}" convert "${2}" "${OUTPUT_IMAGE}"
notify-send.py --hint string:image-path:"$2" --replaces-process setwallpaper -a sxiv "Generating wal color scheme" & notify-send.py --hint string:image-path:"$2" --replaces-process setwallpaper -a sxiv "Generating wal color scheme" &
~/.local/bin/generatewal ~/.local/bin/generatewal
notify-send.py --hint string:image-path:"$2" --replaces-process setwallpaper -a sxiv "Generating LightDM wallpaper" & notify-send.py --hint string:image-path:"$2" --replaces-process setwallpaper -a sxiv "Setting wallpaper" &
doas convert "$2" /usr/share/pixmaps/wallpaper.png ~/.local/bin/wallpaper
notify-send.py --hint string:image-path:"$2" --replaces-process setwallpaper -a sxiv "Setting wallpaper" & notify-send.py --hint string:image-path:"$1" --replaces-process setwallpaper -a sxiv "Wallpaper set" &
~/.local/bin/wallpaper
notify-send.py --hint string:image-path:"$2" --replaces-process setwallpaper -a sxiv "Wallpaper set" &
} }
while read -r file; do while read -r file; do
case "$1" in case "$1" in
"C-c") "C-c")
echo -n "$file" | xclip -selection clipboard echo -n "$file" | xclip -selection clipboard
notify-send.py --hint string:image-path:"$file" -a sxiv "Added to clipboard" & notify-send.py --hint string:image-path:"$file" -a sxiv "Added to clipboard" &
;; ;;
"C-l") "C-w")
notify-send.py --hint string:image-path:"$file" -a sxiv "Generating lock image" & generateWallpaper 0 "$file"
generate-lock-image "$file" ;;
notify-send.py --hint string:image-path:"$file" -a sxiv "Lock image generated" & "C-1")
;; generateWallpaper 0 "$file"
"C-w") ;;
generateWallpaper 0 "$file" "C-2")
;; generateWallpaper 1 "$file"
"C-1") ;;
generateWallpaper 0 "$file" esac
;;
"C-2")
generateWallpaper 1 "$file"
;;
esac
done done