summaryrefslogtreecommitdiff
path: root/.config
diff options
context:
space:
mode:
authorxyz <gky44px1999@gmail.com>2021-08-11 03:17:57 -0700
committerxyz <gky44px1999@gmail.com>2021-08-11 03:17:57 -0700
commit468442fc7bad4d94650ee806a8faf9039e8b081c (patch)
tree9f353f531238054d7e14a7151f4d61316f63f6f6 /.config
parent69eacd70499b97bd0c6699f2839ea9d418ee0d87 (diff)
better wallpaper set
Diffstat (limited to '.config')
-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