summaryrefslogtreecommitdiff
path: root/etc/completions/_feh
blob: ab3cdab415407d322cc2a989ebf30998820d472a (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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
#compdef feh
## completion for feh 1.7, based on feh(1)
## Copyright (C) 2008, 2009 by Daniel Friesel <derf@derf.homelinux.org>
## License: WTFPL <http://sam.zoy.org/wtfpl>

typeset -a arguments
typeset -A argument_pairs argument_postfix
typeset arg

argument_pairs=(
	'help'        'h'
	'version'     'v'
	'verbose'     'V'
	'quiet'       'q'
	'theme'       'T+'
	'recursive'   'r'
	'randomize'   'z'
	'filelist'    'f+'
	'preload'     'p'
	'full-screen' 'F'
	'geometry'    'g+'
	'auto-zoom'   'Z'
	'multiwindow' 'w'
	'borderless'  'x'
	'draw-filename' 'd'
	'slideshow-delay' 'D+'
	'reload'      'R+'
	'keep-http'   'k'
	'builtin'     'Q'
	'list'        'l'
	'customlist'  'L+'
	'loadable'    'U'
	'unloadable'  'u'
	'sort'        'S+'
	'reverse'     'n'
	'action'      'A+'
	'montage'     'm'
	'collage'     'c'
	'index'       'i'
	'fullindex'   'I'
	'thumbnails'  't'
	'menu-font'   'M+'
	'no-menus'    'N'
	'reload-button' '0'
	'pan-button'  '1+'
	'zoom-button' '2+'
	'menu-button' '3+'
	'prev-button' '4+'
	'next-button' '5+'
	'rotate-button' '8+'
	'blur-button' '9+'
	'ignore-aspect' 'X'
	'stretch'     's'
	'thumb-width' 'y+'
	'thumb-height' 'E+'
	'limit-width' 'W+'
	'limit-height' 'H+'
	'bg'          'b+'
	'alpha'       'a+'
	'font'        'e+'
	'scale-down'  '.'
	'output-dir'  'j+'
	'wget-timestamp' 'G'
	'fontpath'    'C+'
	'image-bg'    'B+'
	'output'      'o'
	'output-only' 'O'
	'rcfile'      '_'
	'thumb-title' '~'
	'title'       '^'
	'start-at'    '|'
	'title-font'  '@'
)

argument_postfix=(
	'help'        '[Show help]'
	'version'     '[Show version information]'
	'verbose'     '[Be verbose]'
	'quiet'       '[Suppress non-fatal errors]'
	'theme'       '[Load named options from config]:theme:_feh_theme'
	'recursive'   '[Recurse into subdirectories]'
	'randomize'   '[Randomize file list before displaying]'
	'filelist'    '[Read file list from this file]:file:_files'
	'preload'     '[Eliminate unlaodable images before displaying]'
	'full-screen' '[Make the window fullscreen]'
	'geometry'    '[Limit window size]:geometry: '
	'auto-zoom'   '[Zoom picture to screen size]'
	'multiwindow' '[Multiple windows, one image per window]'
	'borderless'  '[Borderless windows]'
	'draw-filename' '[Show filename in images]'
	'reload'      '[Time delay for reloading]:time: '
	'keep-http'   "[Don't delete cached files]"
	'builtin'     '[Use builtin http client]'
	'list'        '[List images, their size, etc.]'
	'customlist'  '[Format list output]:format: '
	'loadable'    '[Print loadable images]'
	'unloadable'  '[Print unloadable images]'
	'sort'        '[Sort images]:sort type:(name filename width height pixels size format)'
	'reverse'     '[Reverse sort order]'
	'action'      '[Action to perform on each image]:shell: '
	'montage'     '[Enable montage mode]'
	'collage'     '[Enable collage mode]'
	'index'       '[Enable index mode]'
	'fullindex'   '[Enable verbose index mode]'
	'thumbnails'  '[Enable interactive index mode]'
	'menu-font'   '[Set font in menus]:font: '
	'no-menus'    "[Don't load or show any menus]"
	'reload-button' '[Button to reload image]:button:_feh_button'
	'pan-button'  '[Button to pan image]:button:_feh_button'
	'zoom-button' '[Button to zoom image]:button:_feh_button'
	'menu-button' '[Button to activate menu]:button:_feh_button'
	'prev-button' '[Button to go to previous image]:button:_feh_button'
	'next-button' '[Button to go to next image]:button:_feh_button'
	'rotate-button' '[Ctrl+Button to rotate image]:button:_feh_button'
	'blur-button' '[Ctrl+Button tu blur image]:button:_feh_button'
	'ignore-aspect' "[montage mode: Don't preserve aspect ratio]"
	'stretch'     '[montage mode: Enlarge images to fit thumbnail size]'
	'thumb-width' '[montage mode: Thumbnail width]:pixels: '
	'thumb-height' '[montage mode: Thumbnail height]:pixels: '
	'limit-width' '[montage mode: Limit montage width]:pixels: '
	'limit-height' '[montage mode: Limit montage heihgt]:pixels: '
	'bg'          '[montage mode: Background image]:file:_files'
	'alpha'       '[montage mode: Thumbnail transparency level]:integer: '
	'font'        '[index mode: Thumbnail info font]:font: '
	'slideshow-delay' '[slide change delay]:seconds'
	'scale-down'  '[Scale down images which are too big]'
	'output-dir'  '[Save files to DIR (with -k)]:directory:_files -/'
	'wget-timestamp' '[Add no timestamp ("?123") to URLs]'
	'fontpath'    '[Add paths to font path]:font path:_files -/'
	'image-bg'    '[Set transparent image background]:background:(white black default)'
	'output'      '[montage mode: Output file]:file:_files'
	'output-only' "[montage mode: Output file, don't display montage]:file:_files"
	'rcfile'      '[Specify config file]:file:_files'
	'thumb-title' '[Window title in thumbnail mode]:format string'
	'title'       '[Window title in slideshow mode]:format string'
	'start-at'    '[Start slideshow at]:file:_files'
	'title-font'  '[Title font for index mode]:font'
)

arguments=(
	'--zoom[Zoom images]:percent: '
	'--caption-path[Where to look for image captions]:relative directory: '
	--action{1..9}':shell: '
	'--bg-tile[Set tiled desktop background]:file:_files'
	'--bg-center[Set centered desktop background]:file:_files'
	'--bg-scale[Set scaled desktop background]:file:_files'
	'--bg-seamless[Set desktop background with seamless borders]:file:_files'
	'--bg-fill[Set scaled desktop background, preserving aspect ratio]:file:_files'
	'--menu-style[Style descriptor for menu text]:file:_files'
	'--menu-border[Set menu background border]:integer: '
	'--menu-ctrl-mask[Use Ctrl+Button to display menu]'
	'--no-rotate-ctrl-mask[Don'\''t require Ctrl for the rotate button]'
	'--no-blur-ctrl-mask[Don'\''t require Ctrl for the blur button]'
	'--no-xinerama[Disable xinerama support]'
	'--screen-clip[Toggle window clipping]'
	'--hide-pointer[Hide mouse pointer in fullscreen mode]'
	'*--fontpath[index mode: directory to search for fonts]:directory:_path_files -/'
	'--index-name[Show image name in index/thumbnail mode]:bool:(0 1)'
	'--index-size[Show image size in index/thumbnail mode]:bool:(0 1)'
	'--index-dim[Show image dimensions in index/thumbnail mode]:bool:(0 1)'
	'--no-jump-on-resort[Stay at current image after resorting the filelist]'
	'--cycle-once[Quit after one loop through the slideshow]'
	'--draw-actions[Draw defined actions]'
	'--cache-thumbnails[Enable thumbnail caching]'
	'--menu-bg[Background image in menus]: :_feh_background'
	'--thumb-redraw[Set thumbnail image redraw frequency]:digit'
	'--xinerama-screen[Set xinerama screen to work on]:digit'
	'*:file:_files'
)

for arg in ${(k)argument_pairs}; {
	arguments+='(--'${arg}')-'${argument_pairs[$arg]}${argument_postfix[$arg]}
	arguments+='(-'${argument_pairs[$arg]}[1]')--'${arg}${argument_postfix[$arg]}
}

function _feh_theme {
	if [[ -r ~/.fehrc ]]; then
		typeset -a themes tmp
		typeset theme IFS=$'\n'
		for theme in $(grep "\w" ~/.fehrc | grep -v "^#"); do
			tmp=(${(s: :)theme})
			theme=${tmp[1]}
			shift tmp
			themes+=${theme}:${(j: :)tmp}
		done
		_describe 'theme' themes
	fi
}

function _feh_button {
	typeset expl
	_wanted button expl button \
	compadd {0..5}
}

function _feh_background {
	_alternative \
	'file:file:_files' \
	'mode:mode:(trans)'
}

_arguments -s ${arguments}