blob: 50202fc2adcbd2d9a2515dee00572e0cb175af33 (
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
75
76
|
#!/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 -s "Not a directory"
exit 1
fi
if mv "${file}" "${destdir}"; then
nsend -s "${file} moved to ${destdir}" &
else
nsend -s "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 -s "Not a directory" &
exit 1
fi
if cp "${file}" "${destdir}"; then
nsend -s "${file} copied to ${destdir}" &
else
nsend -s "Failed to copy ${file} to ${destdir}" &
fi
;;
"w")
swall -d "$file" && nsend -s "Wallpaper ${file}" \
|| nsend -s "Couldn't set wallpaper"
;;
"d")
mkdir -p ~/.trash
if mv "$file" ~/.trash; then
nsend -s "$file is moved to ~/.trash" &
else
nsend -s "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 -s "Copied to clipboard" &
else
nsend -s "Failed to copy to clipboard" &
fi
;;
"Y")
if readlink -f "$file" | tr -d '\n' | xclip -selection clipboard; then
nsend -s "Copied to clipboard" &
else
nsend -s "Failed to copy to clipboard" &
fi
;;
esac
done
|