aboutsummaryrefslogtreecommitdiff
path: root/files/sxiv
diff options
context:
space:
mode:
authorInigoGutierrez <inigogf.95@gmail.com>2019-03-25 19:48:20 +0100
committerInigoGutierrez <inigogf.95@gmail.com>2019-03-25 19:48:20 +0100
commitb4d7e8a60b293cd41d1b4c45ce79c62d70c1d197 (patch)
treec5a145e2448ce7620acd2bf387d55b45d07f2029 /files/sxiv
parent9c14511de13b5e38fe019473e766cff103b0b545 (diff)
downloadconfigs-b4d7e8a60b293cd41d1b4c45ce79c62d70c1d197.tar.gz
configs-b4d7e8a60b293cd41d1b4c45ce79c62d70c1d197.zip
First commit after migrating to Arch.
Diffstat (limited to 'files/sxiv')
-rw-r--r--files/sxiv/config.def.h (renamed from files/sxiv/config.h)0
-rwxr-xr-xfiles/sxiv/key-handler81
2 files changed, 53 insertions, 28 deletions
diff --git a/files/sxiv/config.h b/files/sxiv/config.def.h
index 35b2bb0..35b2bb0 100644
--- a/files/sxiv/config.h
+++ b/files/sxiv/config.def.h
diff --git a/files/sxiv/key-handler b/files/sxiv/key-handler
index bc1cf92..f7e44f5 100755
--- a/files/sxiv/key-handler
+++ b/files/sxiv/key-handler
@@ -12,20 +12,39 @@ case "$1" in
do
convert "$file" -resize "$width"x"$height""$modifier" "$width"x"$height""$modifier"_"$file"
done ;;
+ "y")
+ text=""
+ while read file
+ do
+ text="$text""$file""\n"
+ done
+ echo -en "$text" | xsel -ib &&
+ dunstify "$(xsel -ob) copied to clipboard" ;;
+ "Y")
+ text=""
+ while read file
+ do
+ text="$text""$(readlink -f "$file")""\n"
+ done
+ echo -en "$text" | xsel -ib &&
+ dunstify "$(xsel -ob) copied to clipboard" ;;
"h")
- notify-send "\
+ dunstify "\
w: Set as wallpaper. .
r: Rotate clockwise. .
R: Rotate counter-clockwise. .
f: Flop (horizontally). .
-f: Flop (vertically). .
+f: Flip (vertically). .
y: Yank filename to clipboard. .
Y: Yank file path to clipboard. .
d: Delete file (with confirmation prompt). .
-c: Rename file. .
+n: Rename file. .
+N: Open in a new instance of sxiv. .
g: Open in gimp. .
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
@@ -35,41 +54,47 @@ do
"w") setBG.sh "$file" ;;
"r")
convert -rotate 90 "$file" "$file" &&
- notify-send "$file rotated clockwise" ;;
+ dunstify "$file rotated clockwise" ;;
"R")
convert -rotate -90 "$file" "$file" &&
- notify-send "$file rotated counter-clockwise" ;;
+ dunstify "$file rotated counter-clockwise" ;;
"f")
convert -flop "$file" "$file" &&
- notify-send "$file flopped" ;;
+ dunstify "$file flopped" ;;
"F")
convert -flip "$file" "$file" &&
- notify-send "$file flipped" ;;
- "y")
- echo -n "$file" | xclip -selection clipboard &&
- notify-send "$file copied to clipboard" & ;;
- "Y")
- echo -n "$(readlink -f "$file")" | xclip -selection clipboard &&
- notify-send "$(readlink -f "$file") copied to clipboard" & ;;
+ dunstify "$file flipped" ;;
"d")
- [ "$(printf "No\nYes" | dmenu -i -p "Really delete $file?")" = "Yes" ] && rm "$file" && notify-send "$file deleted." ;;
- "c")
+ [ "$(printf "No\nYes" | dmenu -i -p "Really delete $file?")" = "Yes" ] && rm "$file" && dunstify "$file deleted." ;;
+ "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" && notify-send "$file renamed to $newname." ;;
+ [ "$newname" ] && newname="$newname"'.'"${file##*.}" && [ "$(printf "No\nYes" | dmenu -i -p "Rename $file to $newname?")" = "Yes" ] && mv "$file" "$newname" && dunstify "$file renamed to $newname." ;;
+ "N")
+ sxiv -b "$file" & ;;
"g")
gimp "$file" & ;;
"S")
- echo -n "$(readlink -f "$file")" | xclip -selection clipboard && notify-send "$(readlink -f "$file") copied to clipboard"
- $BROWSER https://tineye.com/ ;;
- # "c")
- # [ -z "$destdir" ] && destdir="$(sed "s/\s.*#.*$//;/^\s*$/d" ~/.bmdirs | awk '{print $2}' | dmenu -l 20 -i -p "Copy file(s) to where?" | sed "s|~|$HOME|g")"
- # [ -z "$destdir" ] && exit
- # cp "$file" "$destdir" && notify-send -i "$(readlink -f "$file")" "$file copied to $destdir." &
- # ;;
- # "m")
- # [ -z "$destdir" ] && destdir="$(sed "s/\s.*#.*$//;/^\s*$/d" ~/.bmdirs | awk '{print $2}' | dmenu -l 20 -i -p "Move file(s) to where?" | sed "s|~|$HOME|g")"
- # [ -z "$destdir" ] && exit
- # mv "$file" "$destdir" && notify-send -i "$(readlink -f "$file")" "$file moved to $destdir." &
- # ;;
+ echo -n "$(readlink -f "$file")" | xsel -ib && dunstify "$(xsel -ob) copied to clipboard"
+ $BROWSER "https://tineye.com/" ;;
+ "c")
+ [ -z "$destdir" ] && destdir="$(selectPath.sh "Copy image(s) to:")"
+ [ -z "$destdir" ] && exit
+ replace="Yes"
+ if [ -e "$destdir""$file" ]; then
+ dunstify -i "$destdir""$file" "Old:"
+ dunstify -i "$(readlink -f "$file")" "New:"
+ replace="$(echo -e "No\nYes" | dmenu -i -p "Replace $file in $destdir?")"
+ fi
+ [ "$replace" = "Yes" ] && cp "$file" "$destdir" && dunstify -t 2000 -i "$(readlink -f "$file")" "$file copied to $destdir" & ;;
+ "m")
+ [ -z "$destdir" ] && destdir="$(selectPath.sh "Move image(s) to:")"
+ [ -z "$destdir" ] && exit
+ replace="Yes"
+ if [ -e "$destdir""$file" ]; then
+ dunstify -i "$destdir""$file" "Old:"
+ dunstify -i "$(readlink -f "$file")" "New:"
+ replace="$(echo -e "No\nYes" | dmenu -i -p "Replace $file in $destdir?")"
+ fi
+ [ "$replace" = "Yes" ] && mv "$file" "$destdir" && dunstify -t 2000 -i "$destdir$file" "$file moved to $destdir" & ;;
esac
done