aboutsummaryrefslogtreecommitdiff
path: root/sxiv
diff options
context:
space:
mode:
authorkd <kdam0@localhost.localdomain>2020-03-27 18:09:32 +0000
committerkd <kdam0@localhost.localdomain>2020-03-27 18:09:32 +0000
commit00997d20e5bf2a7f58775f1f3ab419bb6345f7cf (patch)
tree1cbf0530e84ff6638118b7aa7acfa0f5a9d37993 /sxiv
parent7a73d436072a322498f3b668a29e8731b0255f35 (diff)
added a couple new scrpit for wallpapers
Diffstat (limited to 'sxiv')
-rwxr-xr-xsxiv/.config/sxiv/exec/image-info20
-rwxr-xr-xsxiv/.config/sxiv/exec/key-handler38
2 files changed, 46 insertions, 12 deletions
diff --git a/sxiv/.config/sxiv/exec/image-info b/sxiv/.config/sxiv/exec/image-info
new file mode 100755
index 0000000..20c10c1
--- /dev/null
+++ b/sxiv/.config/sxiv/exec/image-info
@@ -0,0 +1,20 @@
+#!/usr/bin/sh
+
+# Example for $XDG_CONFIG_HOME/sxiv/exec/image-info
+# Called by sxiv(1) whenever an image gets loaded.
+# The output is displayed in sxiv's status bar.
+# Arguments:
+# $1: path to image file
+# $2: image width
+# $3: image height
+
+s=" " # field separator
+
+exec 2>/dev/null
+
+filename=$(basename -- "$1")
+filesize=$(du -Hh -- "$1" | cut -f 1)
+geometry="${2}x${3}"
+
+echo "${filesize}${s}${geometry}${s}${filename}"
+
diff --git a/sxiv/.config/sxiv/exec/key-handler b/sxiv/.config/sxiv/exec/key-handler
index ea57b25..d9f1825 100755
--- a/sxiv/.config/sxiv/exec/key-handler
+++ b/sxiv/.config/sxiv/exec/key-handler
@@ -1,18 +1,32 @@
-#!/bin/bash
-
+#!/usr/bin/env sh
while read file
do
case "$1" in
- "r")
- convert -rotate 90 "$file" "$file" ;;
+ "w") setbg "$file" & ;;
"c")
- echo -n "$file" | xclip -selection clipboard ;;
- "C")
- echo -n "${file##*/}" | xclip -selection clipboard ;;
- "w")
- cp "$file" ~/.config/wall1.jpg && wal -c -i "$file" && sudo make -C ~/st/ clean install & ;;
- "b")
- st -e cp "$file" ~/.config/wall1.jpg && wal -c -i "$file" && sudo make -C ~/st/ clean install & ;;
+ [ -z "$destdir" ] && destdir="$(sed "s/\s.*#.*$//;/^\s*$/d" ~/.config/directories | 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" ~/.config/directories | 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." &
+ ;;
+ "r")
+ convert -rotate 90 "$file" "$file" ;;
+ "R")
+ convert -rotate -90 "$file" "$file" ;;
+ "f")
+ convert -flop "$file" "$file" ;;
+ "y")
+ echo -n "$file" | xclip -selection clipboard &&
+ notify-send "$file copied to clipboard" & ;;
+ "Y")
+ readlink -f "$file" | xclip -selection clipboard &&
+ notify-send "$(readlink -f "$file") copied to clipboard" & ;;
+ "d")
+ [ "$(printf "No\\nYes" | dmenu -i -p "Really delete $file?")" = "Yes" ] && rm "$file" && notify-send "$file deleted." ;;
+ "g") ifinstalled gimp && gimp "$file" & ;;
esac
done
-