blob: 531b60514a22e4ebcd120013e0826c93acab1882 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
#!/bin/sh
# For theme to be applied ~/.Xresource file must be present
picdir="${HOME}/pics"
while read -r file; do
case "$1" in
"m")
if [ -z "${destdir}" ]; then
destdir="$(echo "${picdir}" \
| dmenu -p "Move directory: " \
| sed "s|~|${HOME}|g")"
fi
if [ ! -d "${destdir}" ]; then
nsend "Not a directory"
exit 1
fi
if mv "${file}" "${destdir}"; then
nsend "${file} moved to ${destdir}" &
else
nsend "Failed to move ${file} to ${destdir}"
fi
;;
"c")
if [ -z "${destdir}" ];then
destdir="$(echo "${picdir}" \
| dmenu -p "Copy directory: " \
| sed "s|~|${HOME}|g")"
fi
if [ ! -d "${destdir}" ]; then
nsend "Not a directory" &
exit 1
fi
if cp "${file}" "${destdir}"; then
nsend "${file} copied to ${destdir}" &
else
nsend "Failed to copy ${file} to ${destdir}" &
fi
;;
"w") swall -d "$file" ;;
"d")
mkdir -p ~/.trash
if mv "$file" ~/.trash; then
nsend "$file is moved to ~/.trash" &
else
nsend "Failed to move ${file} to ~/.trash" &
fi
;;
"r") convert -rotate 90 "$file" "$file" ;;
"R") convert -rotate -90 "$file" "$file" ;;
"f") convert -flop "$file" "$file" ;;
"y")
if printf "%s" "${file}" | xclip -selection clipboard; then
nsend "Copied to clipboard" &
else
nsend "Failed to copy to clipboard" &
fi
;;
"Y")
if readlink -f "$file" | tr -d '\n' | xclip -selection clipboard; then
nsend "Copied to clipboard" &
else
nsend "Failed to copy to clipboard" &
fi
;;
esac
done
|