summaryrefslogtreecommitdiff
path: root/.config/sxiv/exec
diff options
context:
space:
mode:
Diffstat (limited to '.config/sxiv/exec')
-rwxr-xr-x.config/sxiv/exec/key-handler24
1 files changed, 19 insertions, 5 deletions
diff --git a/.config/sxiv/exec/key-handler b/.config/sxiv/exec/key-handler
index e9b43afd..00f6fa23 100755
--- a/.config/sxiv/exec/key-handler
+++ b/.config/sxiv/exec/key-handler
@@ -19,7 +19,7 @@
# rawtherapee is owned by rawtherapee
rotate() {
- tr '\n' '\0' | xargs -0 realpath | sort | uniq | while read file; do
+ tr '\n' '\0' | xargs -0 realpath | sort | uniq | while read -r file; do
case "$(file -b -i "$file")" in
image/jpeg*) jpegtran -rotate 90 -copy all -outfile "$file" "$file" ;;
*) mogrify -rotate 90 "$file" ;;
@@ -28,7 +28,7 @@ rotate() {
}
flip() {
- tr '\n' '\0' | xargs -0 realpath | sort | uniq | while read file; do
+ tr '\n' '\0' | xargs -0 realpath | sort | uniq | while read -r file; do
case "$(file -b -i "$file")" in
image/jpeg*) jpegtran -flip vertical -copy all -outfile "$file" "$file" ;;
*) mogrify -flip "$file" ;;
@@ -36,14 +36,28 @@ flip() {
done
}
+linkwall() {
+ tr '\n' '\0' | xargs -0 realpath | sort | uniq | while read -r file; do
+ walldir="${HOME}/pictures/wallpapers/"
+ name=$(basename "$file")
+ if [ ! -e "${walldir}${name}" ]; then
+ convwall "$file" "${walldir}${name}" || ln -s "$file" "${walldir}"
+ else
+ notify-send 'error' "${name} exist"
+ fi
+ done
+}
+
+# I choose not to put case nested in while read file loop
+# because it can pipe multiple files to one command?
case "$1" in
"d") [ "$(promptd "delete?")" = "Yes" ] && tr '\n' '\0' | xargs -0 rm ;;
- "e") while read file; do alacritty -e sh -c "exiv2 pr -q -pa '$file' | less" & done ;;
+ "e") while read -r file; do alacritty -e sh -c "exiv2 pr -q -pa '$file' | less" & done ;;
"f") flip ;;
"g") tr '\n' '\0' | xargs -0 setsid -f gimp ;;
- "l") tr '\n' '\0' | xargs -0 realpath -z | xargs -0 ln -s -t "$HOME/pictures/wallpapers" ;;
+ "l") linkwall ;;
"r") rotate ;;
- "w") tr '\n' '\0' | xargs -0 xwallpaper --maximize ;;
+ "w") tr '\n' '\0' | xargs -0 shufwall ;;
"y") tr '\n' '\0' | xargs -0 realpath | xsel -b ;;
esac