[download]
local/bin/recent-menu
1
2
3 print(){ # {{{
4 i=$(icon recent-$1)
5 uniq | while read f; do
6 f="${f/\~/~}"
7 f="${f/\$HOME/~}"
8
9 [[ -f $f ]] &&
10 printf '%s %s\t%s\n' "$i" "$1" "$f"
11 done | sed 5q
12 } # }}}
13
14 while IFS=\| read exec file; do
15 file=${file#file://}
16 file=$(echo -e "${file//%/\\x}")
17
18 [[ $exec == *godot* ]] && godot+=("$file")
19 [[ $exec == *inkscape* ]] && inkscape+=("$file")
20 [[ $exec == *gimp* ]] && gimp+=("$file")
21 [[ $exec == *audacity* ]] && audacity+=("$file")
22 done < <( # {{{
23 cat ~/.local/share/recently-used.xbel |
24 awk -F \" '
25 /href="/ { file = $2 }
26 /exec="/ { exec = $4 }
27 /modified="/ { time = $6 }
28
29 /<bookmark:application / {
30 printf "%s\t%s|%s\n", time, exec, file
31 }
32 ' | sort -r | cut -f 2-
33 ) # }}}
34
35 {
36
37 test -f ~/.vim/viminfo || : ~/.viminfo
38 grep '^>' $_ | cut -b 3- | print gvim
39
40 printf '%s\n' "${godot[@]}" | print godot
41 printf '%s\n' "${inkscape[@]}" | print inkscape
42
43 cat ~/.config/blender/*/config/recent-files.txt | print blender
44 sort -Vr ~/.config/kritarc | grep ^File | cut -d = -f 2 | print krita
45
46 printf '%s\n' "${gimp[@]}" | print gimp
47 printf '%s\n' "${audacity[@]}" | print audacity
48
49 } | sed "s:$HOME:~:" | column -ts $'\t' |
50 awk '!a[$0]++' | menu -i recent -l 20 |
51 while read _ a b; do $a "${b/\~/~}" & done
|