aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorInigoGutierrez <inigogf.95@gmail.com>2022-08-25 17:17:56 +0200
committerInigoGutierrez <inigogf.95@gmail.com>2022-08-25 17:17:56 +0200
commit09e7d7b76ab90a3d14901fbe889a593df83f5465 (patch)
treeb008ee6e25f00ba234b8b15b3ed4479b167fc736
parentccbd2fd21eaac1a53dc3a5de5d794634c00cfdb9 (diff)
downloadconfigs-09e7d7b76ab90a3d14901fbe889a593df83f5465.tar.gz
configs-09e7d7b76ab90a3d14901fbe889a593df83f5465.zip
Fixed some stuff on sxiv script.
-rwxr-xr-xstow/sxiv/.config/sxiv/exec/key-handler91
1 files changed, 58 insertions, 33 deletions
diff --git a/stow/sxiv/.config/sxiv/exec/key-handler b/stow/sxiv/.config/sxiv/exec/key-handler
index 27e9872..e341f8a 100755
--- a/stow/sxiv/.config/sxiv/exec/key-handler
+++ b/stow/sxiv/.config/sxiv/exec/key-handler
@@ -1,17 +1,20 @@
#!/bin/bash
case "$1" in
+
"s")
width=$(echo "" | dmenu -p "Width of new files?")
[ "$width" ] || exit 0
height=$(echo "" | dmenu -p "Height of new files?")
[ "$height" ] || exit 0
modifier=""
- [ "$(printf "Yes\nNo" | dmenu -i -p "Maintain aspect ratio?")" = "No" ] && modifier="!"
+ [ "$(printf "Yes\nNo" | dmenu -l 2 -i -p "Maintain aspect ratio?")" = "No" ] && modifier="!"
while read -r file
do
convert "$file" -resize "$width"x"$height""$modifier" "$width"x"$height""$modifier"_"$file"
- done ;;
+ done
+ ;;
+
"y")
text=""
while read -r file
@@ -19,7 +22,9 @@ case "$1" in
text="$text""$file""\n"
done
echo -en "$text" | xsel -ib &&
- dunstify "$(xsel -ob) copied to clipboard" ;;
+ dunstify "$(xsel -ob) copied to clipboard"
+ ;;
+
"Y")
text=""
while read -r file
@@ -27,7 +32,9 @@ case "$1" in
text="$text""$(readlink -f "$file")""\n"
done
echo -en "$text" | xsel -ib &&
- dunstify "$(xsel -ob) copied to clipboard" ;;
+ dunstify "$(xsel -ob) copied to clipboard"
+ ;;
+
"G")
images=""
tmpFolder="/tmp/sxiv/gifs/"
@@ -47,52 +54,70 @@ case "$1" in
name=$(echo "" | dmenu -p "Name of GIF?")
[ -n "$name" ] || exit 0
convert -delay "$delay" -loop 10 $images "$name.gif"
- dunstify "Created $name.gif" ;;
+ dunstify "Created $name.gif"
+ ;;
"h")
- dunstify "\
-w: Set as wallpaper. .
-r: Rotate clockwise. .
-R: Rotate counter-clockwise. .
-f: Flop (horizontally). .
-F: Flip (vertically). .
-y: Yank filename to clipboard. .
-Y: Yank file path to clipboard. .
-i: Yank image to clipboard. .
-d: Move file to litter. .
-n: Rename file. .
-N: Open in a new instance of sxiv. .
-g: Open in gimp. .
-G: Make a gif out of selected images. .
-s: Create new image with different size. .
-S: Search image online. .
-c: Copy images to a chosen folder. .
-m: Move images to a chosen folder. .
-h: Show help. ." ;;
+ dunstify "sxiv key-handler" "\
+w: Set as wallpaper. .
+r: Rotate clockwise. .
+R: Rotate counter-clockwise. .
+f: Flop (horizontally). .
+F: Flip (vertically). .
+y: Yank filename to clipboard. .
+Y: Yank file path to clipboard. .
+i: Yank image to clipboard. .
+d: Move file to litter. .
+n: Rename file. .
+N: Open in a new instance of sxiv. .
+g: Open in gimp. .
+G: Make a gif out of selected images. .
+s: Create new image with different size..
+S: Search image online. .
+c: Copy images to a chosen folder. .
+m: Move images to a chosen folder. .
+h: Show help. ."
+ ;;
+
esac
while read -r file
do
case "$1" in
+
"w") setBG.sh "$file" ;;
+
"W") wal.sh "$file" ;;
+
"r")
convert -rotate 90 "$file" "$file" &&
- dunstify "$file rotated clockwise" ;;
+ dunstify "$file rotated clockwise"
+ ;;
+
"R")
convert -rotate -90 "$file" "$file" &&
- dunstify "$file rotated counter-clockwise" ;;
+ dunstify "$file rotated counter-clockwise"
+ ;;
+
"f")
convert -flop "$file" "$file" &&
- dunstify "$file flopped" ;;
+ dunstify "$file flopped"
+ ;;
+
"F")
convert -flip "$file" "$file" &&
- dunstify "$file flipped" ;;
- "d")
- rm.sh "$file" && dunstify -i "$file" "$file moved to litter." ;;
+ dunstify "$file flipped"
+ ;;
+
+ "d") rm.sh "$file" && dunstify -i "$file" "$file moved to litter." ;;
+
"n")
- newname="$(dmenu -p "New name of $file?")"
- [ "$newname" ] && newname="$newname"'.'"${file##*.}" && [ "$(printf "No\nYes" | dmenu -i -p "Rename $file to $newname?")" = "Yes" ] && mv "$file" "$newname" && dunstify "$file renamed to $newname." ;;
+ newname="$(dmenu -p "New name of ${file}?")"
+ [ -n "$newname" ] &&
+ newname="${newname}.${file##*.}" &&
+ prompt.sh "Rename $file to ${newname}?" "mv $file $newname" &&
+ dunstify "$file renamed to ${newname}."
+ ;;
"N")
sxiv -b "$file" & ;;
"g")
@@ -118,7 +143,7 @@ do
[ -z "$destdir" ] && exit
replace="Yes"
if [ -e "${destdir}${file}" ]; then
- replace="$(echo -e "No\nYes" | dmenu -i -p "Replace $file in $destdir?")"
+ replace="$(echo -e "No\nYes" | dmenu -l 2 -i -p "Replace $file in $destdir?")"
fi
[ "$replace" = "Yes" ] && mv "$file" "$destdir" && dunstify -t 2000 -i "$destdir$file" "$file moved to $destdir" & ;;
esac