#compdef feh ## completion for feh 1.16.1, based on feh(1) function _feh_theme { [[ -r ~/.config/feh/themes ]] || return typeset -a themes typeset -i cont=0 typeset cur_theme cur_desc while read theme_name theme_options; do if [[ ${theme_name} == '#'* ]] { continue } if (( ! ${#theme_name} && ! ${#theme_options} )) { continue } themes+="${theme_name}:${theme_options}" done < ~/.config/feh/themes _describe 'theme' themes } function _feh_button { typeset expl _wanted button expl button \ compadd {0..5} } function _feh_background { _alternative \ 'file:file:_files' \ 'mode:mode:(trans)' } function _feh { _arguments -s \ '(--action -A)'{-A,--action}'[action to perform on images]:shell' \ --action{1..9}'[additional action]:shell' \ '(--auto-zoom -Z)'{-Z,--auto-zoom}'[aoom pictures to screen]' \ '(--borderless -x)'{-x,--borderless}'[areate borderless windows]' \ '(--cache-thumbnails -P)'{--cache-thumbnails,-P}'[cache thumbnails]' \ '(--caption-path -K)'{--caption-path,-K+}'[enable caption mode]:caption directory:_files -/' \ '(--customlist -L)'{--customlist,-L}'[custom list mode]:feh format string' \ '--cycle-once[quit after one loop through slideshow]' \ '(--draw-actions -G)'{--draw-actions,-G}'[show defined actions]' \ '(--draw-filename -d)'{--draw-filename,-d}'[show filename]' \ '--draw-tinted[show overlay texts on tinted background]' \ '(--filelist -f)'{--filelist,-f}'[show images in filelist]' \ '(--font -e)'{--font,-e+}'[set global font]:font' \ '(--fontpath -C)'{--fontpath,-C+}'[set font path]:font path:_files -/' \ '--force-aliasing[disable antialiasing]' \ '(--fullindex -I)'{--fullindex,-I}'[index mode with additional information]' \ '(--fullscreen -F)'{--fullscreen,-F}'[enable fullscreen mode]' \ '(--geometry -g)'{--geometry,-g+}'[set window geometry]:WxH[+X+Y]' \ '(--hide-pointer -Y)'{--hide-pointer,-Y}'[hide pointer]' \ '(--image-bg -B)'{--image-bg,-B+}'[set image background]:background:(black white checks)' \ '(--index -i)'{--index,-i}'[index mode]' \ '--index-dim[toggle dimensions display in index mode]:bool:(0 1)' \ '--index-name[toggle filename display in index mode]:bool:(0 1)' \ '--index-size[toggle size display in index mode]:bool:(0 1)' \ '(--keep-http -k)'{--keep-http,-k}'[keep cached HTTP files]' \ '(--list -l)'{--list,-l}'[list mode]' \ '(--loadable -U)'{--loadable,-U}'[list loadable images]' \ '(--menu-font -M)'{--menu-font,-M+}'[set menu font]:menu font' \ '(--montage -m)'{--montage,-m}'[montage mode]' \ '(--multiwindow -w)'{--multiwindow,-w}'[multiwindow mode]' \ '--no-jump-on-resort[do not jump to first image after resorting]' \ '(--no-menus -N)'{--no-menus,-N}'[disable menus]' \ '--no-screen-clip[disable window size limitations]' \ '--no-xinerama[disable Xinerama support]' \ '(--output-dir -j)'{--output-dir,-j+}'[set temporary file location]:directory:_files -/' \ '(--preload -p)'{--preload,-p}'[eliminate unloadable images before starting]' \ '(--quiet -q)'{--quiet,-q}'[do not report non-fatal errors]' \ '(--randomize -z)'{--randomize,-z}'[randomize filelist]' \ '(--recursive -r)'{--recursive,-r}'[recurse into subdirectories]' \ '(--reload -R)'{--reload,-R+}'[reload filelist/current image]:seconds' \ '(--reverse -n)'{--reverse,-n}'[reverse sort order]' \ '(--scale-down -.)'{--scale-down,-.}'[scale down too large images]' \ '(--slideshow-delay -D)'{--slideshow-delay,-D+}'[set slideshow delay]:seconds' \ '(--sort -S)'{--sort,-S}'[sort images]:sort type:(name filename width height pixels size format)' \ '(--start-at -|)'{--start-at,-'|'+}'[start slideshow at file]:start file:_files' \ '(--theme -T)'{--theme,-T+}'[set theme]: :_feh_theme' \ '(--thumbnails -t)'{--thumbnails,-t}'[thumbnail mode]' \ '(--thumb-title -~)'{--thumb-title,-'~'+}'[set thumbnail window title]:feh format string' \ '(--title -^)'{--title,-'^'}'[set window title]:feh format string' \ '(--unloadable -u)'{--unloadable,-u}'[list unloadable images]' \ '(--verbose -V)'{--verbose,-V}'[verbose mode]' \ '--zoom[set zoom mode]:percent' \ \ '(-0 --reload-button)'{-0,--reload-button}'[set reload button]: :_feh_button' \ '(-1 --pan-button)'{-1,--pan-button}'[set pan button]: :_feh_button' \ '(-2 --zoom-button)'{-2,--zoom-button}'[set zoom button]: :_feh_button' \ '(-3 --menu-button)'{-3,--menu-button}'[set menu button]: :_feh_button' \ '(-4 --prev-button)'{-4,--prev-button}'[set prev button]: :_feh_button' \ '(-5 --next-button)'{-5,--next-button}'[set next button]: :_feh_button' \ '(-8 --rotate-button)'{-8,--rotate-button}'[set rotate button]: :_feh_button' \ '(-9 --blur-button)'{-9,--blur-button}'[set blur button]: :_feh_button' \ '--menu-ctrl-mask[require CTRL for menu button]' \ '--no-rotate-ctrl-mask[do not require CTRL for rotate button]' \ '--no-blur-ctrl-mask[do not require CTRL for blur button]' \ \ '(--alpha -a)'{--alpha,-a}'[set thumbnail transparency]:alpha level' \ '(--bg -b)'{--bg,-b}'[set montage background]: :_feh_background' \ '(--ignore-aspect -X)'{--ignore-aspect,-X}'[ignore aspect in montage mode]' \ '(--limit-height -H)'{--limit-height,-H}'[limit montage height]:pixels' \ '(--limit-width -W)'{--limit-width,-W}'[limit montage width]:pixels' \ '(--output -o)'{--output,-o}'[save created montage]:output file:_files' \ '(--output-only -O)'{--output-only,-O}'[only save created montage]:output file:_files' \ '(--stretch -s)'{--stretch,-s}'[enlarge too small images in montage mode]' \ '(--thumb-height -E)'{--thumb-height,-E}'[set montage mode thumbnail height]:pixels' \ '(--thumb-width -y)'{--thumb-width,-y}'[set montage mode thumbnail width]:pixels' \ '(--thumb-redraw -J)'{--thumb-redraw,-J}'[set thumbnail mode redraw interval]:interval' \ \ '(--title-font -@)'{--title-font,-'@'}'[set title font]:font' \ '*:image:_files' } _feh "$@"