summaryrefslogtreecommitdiff
path: root/.config/sxiv/exec/key-handler
blob: 0dd23e85a9e2afa956dae7b82b9a0b4771c979b4 (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
#!/bin/sh
while read file
do
    fullpath="$(pwd)/$file"
    case "$1" in
    "w")
	   mv ~/.config/wall.png{,.orig} &&
           cp "$file" ~/.config/wall.png &&
	   wal -c; wal -s -i ~/.config/wall.png -o ~/.config/wal/postrun; xsetroot -name "fsignal:xrd";
	   #feh --bg-scale "$HOME/.config/wall.png" &&
	   xwallpaper --zoom "$HOME/.config/wall.png" &&
	   notify-send -i "$HOME/.config/wall.png" "Wallpaper changed." ;;
    "c")
	[ -z "$destdir" ] && destdir="$(sed "s/\s.*#.*$//;/^\s*$/d" ~/.bmdirs | 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 "$fullpath" "$file copied to $destdir." & ;;
    "m")
	[ -z "$destdir" ] && destdir="$(sed "s/\s.*#.*$//;/^\s*$/d" ~/.bmdirs | 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 "$fullpath" "$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")
           echo -n "$fullpath" | xclip -selection clipboard
	   notify-send  "$fullpath copied to clipboard" & ;;
    "d")
	[ "$(printf "No\\nYes" | dmenu -i -p "Really delete $file?")" = "Yes" ] && rm -f "$file" &&
	   notify-send  "$file deleted " & ;;

    esac
done