]>
Commit | Line | Data |
---|---|---|
c8a11a2d KM |
1 | #compdef feh |
2 | ## completion for feh 3.0, based on feh(1) | |
3 | ||
4 | function _feh_theme { | |
5 | [[ -r ~/.config/feh/themes ]] || return | |
6 | typeset -a themes | |
7 | typeset -i cont=0 | |
8 | typeset cur_theme cur_desc | |
9 | ||
10 | while read theme_name theme_options; do | |
11 | ||
12 | if [[ ${theme_name} == '#'* ]] { | |
13 | continue | |
14 | } | |
15 | ||
16 | if (( ! ${#theme_name} && ! ${#theme_options} )) { | |
17 | continue | |
18 | } | |
19 | ||
20 | themes+="${theme_name}:${theme_options}" | |
21 | ||
22 | done < ~/.config/feh/themes | |
23 | ||
24 | _describe 'theme' themes | |
25 | } | |
26 | ||
27 | function _feh_button { | |
28 | typeset expl | |
29 | _wanted button expl button \ | |
30 | compadd {0..5} | |
31 | } | |
32 | ||
33 | function _feh_background { | |
34 | _alternative \ | |
35 | 'file:file:_files' \ | |
36 | 'mode:mode:(trans)' | |
37 | } | |
38 | ||
39 | function _feh { | |
40 | _arguments -s -S \ | |
41 | '(--action -A)'{-A,--action}'[action to perform on images]:shell command:_cmdstring' \ | |
42 | --action{1..9}'[additional action]:shell command:_cmdstring' \ | |
43 | '--auto-rotate[automatically rotate images based on EXIF data]' \ | |
44 | '(--auto-zoom -Z)'{-Z,--auto-zoom}'[zoom pictures to screen]' \ | |
45 | '(--borderless -x)'{-x,--borderless}'[create borderless windows]' \ | |
46 | '--cache-size[Imlib2 in-memory cache size]:cache size in MiB' \ | |
47 | '(--cache-thumbnails -P)'{--cache-thumbnails,-P}'[cache thumbnails]' \ | |
48 | '(--caption-path -K)'{--caption-path,-K+}'[enable caption mode]:caption directory:_files -/' \ | |
49 | '--conversion-timeout[set ImageMagick conversion timeout for unlodable files]:timeout in seconds (-1 to disable)' \ | |
50 | '(--customlist -L)'{--customlist,-L}'[custom list mode]:feh format string' \ | |
51 | '(--draw-actions -G)'{--draw-actions,-G}'[show defined actions]' \ | |
52 | '--draw-exif[show EXIF data]' \ | |
53 | '(--draw-filename -d)'{--draw-filename,-d}'[show filename]' \ | |
54 | '--draw-tinted[show overlay texts on tinted background]' \ | |
55 | '--edit[change files in-place when using rotate and mirror keys]' \ | |
56 | '(--filelist -f)'{--filelist,-f}'[load from/save to filelist]:filelist:_files' \ | |
57 | '(--font -e)'{--font,-e+}'[set global font]:font' \ | |
58 | '(--fontpath -C)'{--fontpath,-C+}'[set font path]:font path:_files -/' \ | |
59 | '--force-aliasing[disable antialiasing]' \ | |
60 | '(--fullindex -I)'{--fullindex,-I}'[index mode with additional information]' \ | |
61 | '(--fullscreen -F)'{--fullscreen,-F}'[start in fullscreen mode]' \ | |
62 | '(--geometry -g)'{--geometry,-g+}'[set window geometry]:WxH[+X+Y]' \ | |
63 | '(--hide-pointer -Y)'{--hide-pointer,-Y}'[hide pointer]' \ | |
64 | '(--image-bg -B)'{--image-bg,-B+}'[set image background]:background style or X11 colour:(default checks)' \ | |
65 | '(--index -i)'{--index,-i}'[index mode]' \ | |
66 | '--index-info[image info for thumbnail/index mode]:format string' \ | |
67 | '--info[filo info command]:shell command:_cmdstring' \ | |
68 | '--insecure[disable HTTPS certificate checks]' \ | |
69 | '(--keep-http -k)'{--keep-http,-k}'[keep cached HTTP files]' \ | |
70 | '--keep-zoom-vp[keep zoom and viewport when switching images]' \ | |
71 | '(--list -l)'{--list,-l}'[list mode]' \ | |
72 | '(--loadable -U)'{--loadable,-U}'[list loadable images]' \ | |
73 | '--max-dimension[set maximum image dimensions]:WxH' \ | |
74 | '(--menu-font -M)'{--menu-font,-M+}'[set menu font]:menu font' \ | |
75 | '--min-dimension[set minimum image dimensions]:WxH' \ | |
76 | '(--montage -m)'{--montage,-m}'[montage mode]' \ | |
77 | '(--multiwindow -w)'{--multiwindow,-w}'[multiwindow mode]' \ | |
78 | '--no-jump-on-resort[do not jump to first image after resorting]' \ | |
79 | '(--no-menus -N)'{--no-menus,-N}'[disable menus]' \ | |
80 | '--no-screen-clip[disable window size limits]' \ | |
81 | '--no-xinerama[disable Xinerama support]' \ | |
82 | '--on-last-slide[set behaviour when advancing past the last slide]:behaviour:(hold quit resume)' \ | |
83 | '(--output-dir -j)'{--output-dir,-j+}'[set temporary file location]:directory:_files -/' \ | |
84 | '(--preload -p)'{--preload,-p}'[eliminate unloadable images before starting]' \ | |
85 | '(--quiet -q)'{--quiet,-q}'[do not report non-fatal errors]' \ | |
86 | '(--randomize -z)'{--randomize,-z}'[randomize filelist]' \ | |
87 | '(--recursive -r)'{--recursive,-r}'[recurse into subdirectories]' \ | |
88 | '--no-recursive[do not recurse into subdirectories]' \ | |
89 | '(--reload -R)'{--reload,-R+}'[regularly reload filelist and current image]:seconds' \ | |
90 | '(--reverse -n)'{--reverse,-n}'[reverse sort order]' \ | |
91 | '(--scale-down -.)'{--scale-down,-.}'[scale down too large images]' \ | |
92 | '--scroll-step[set scroll granularity]:pixels per scroll step' \ | |
93 | '(--slideshow-delay -D)'{--slideshow-delay,-D+}'[set slideshow delay]:seconds' \ | |
94 | '(--sort -S)'{--sort,-S}'[sort images]:sort key:(name filename dirname mtime width height pixels size format)' \ | |
95 | '(--start-at -|)'{--start-at,-'|'+}'[start slideshow at file]:start file:_files' \ | |
96 | '(--theme -T)'{--theme,-T+}'[set theme]: :_feh_theme' \ | |
97 | '(--thumbnails -t)'{--thumbnails,-t}'[thumbnail mode]' \ | |
98 | '(--thumb-title -~)'{--thumb-title,-'~'+}'[set thumbnail window title]:feh format string' \ | |
99 | '(--title -^)'{--title,-'^'}'[set window title]:feh format string' \ | |
100 | '(--unloadable -u)'{--unloadable,-u}'[list unloadable images]' \ | |
101 | '(--verbose -V)'{--verbose,-V}'[verbose mode]' \ | |
102 | '--version-sort[use natural sorting for --sort]' \ | |
103 | '--zoom[set default zoom level]:percent' \ | |
104 | \ | |
105 | '(--alpha -a)'{--alpha,-a}'[set thumbnail transparency]:alpha level' \ | |
106 | '(--bg -b)'{--bg,-b}'[set montage background]: :_feh_background' \ | |
107 | '(--ignore-aspect -X)'{--ignore-aspect,-X}'[ignore aspect in montage mode]' \ | |
108 | '(--limit-height -H)'{--limit-height,-H}'[limit montage height]:pixels' \ | |
109 | '(--limit-width -W)'{--limit-width,-W}'[limit montage width]:pixels' \ | |
110 | '(--output -o)'{--output,-o}'[save created montage]:output file:_files' \ | |
111 | '(--output-only -O)'{--output-only,-O}'[only save created montage]:output file:_files' \ | |
112 | '(--stretch -s)'{--stretch,-s}'[enlarge too small images in montage mode]' \ | |
113 | '(--thumb-height -E)'{--thumb-height,-E}'[set montage mode thumbnail height]:pixels' \ | |
114 | '(--thumb-width -y)'{--thumb-width,-y}'[set montage mode thumbnail width]:pixels' \ | |
115 | '(--thumb-redraw -J)'{--thumb-redraw,-J}'[set thumbnail mode redraw interval]:interval' \ | |
116 | \ | |
117 | '--bg-center[set centered background]' \ | |
118 | '--bg-fill[set filled background (zoom until filled)]' \ | |
119 | '--bg-max[set maxed background (zoom until image fits)]' \ | |
120 | '--bg-scale[set background without preserving aspect ratio]' \ | |
121 | '--bg-tile[set tiled background]' \ | |
122 | \ | |
123 | '(--title-font -@)'{--title-font,-'@'}'[set title font]:font' \ | |
124 | '*:image, directory or URL:_files' | |
125 | } | |
126 | ||
127 | _feh "$@" | |
128 |