#compdef xwallpaper

local curcontext="$curcontext" state line expl
typeset -A opt_args

_arguments \
    '--clear[set background to black]' \
    '--daemon[enable daemon mode]' \
    '--debug[enable debug mode]' \
    '--no-atoms[no update of pseudo transparency atoms]' \
    '--no-randr[disable randr support]' \
    '--no-root[no update of root window background]' \
    '*--trim[trim box]:widthxheight+x+y' \
    '*--screen[X screen number]:X screen number' \
    '*--output[output device]:output device:->outputs' \
    '*--center[center input file on the screen]:filename:_files' \
    '*--focus[guarantee trim box to be visible on output]:filename:_files' \
    '*--maximize[maximize input file on the screen without cropping]:filename:_files' \
    '*--stretch[stretch input file to fill entire screen]:filename:_files' \
    '*--zoom[maximize input file on the screen with cropping]:filename:_files' \
    '*--tile[repeat image to fill screen]:filename:_files' \
    '--version[show version information]'

case $state in
	(outputs) _wanted outputs expl output compadd ${(uo)${(M)${(f)"$(_call_program outputs xrandr)"}:#* connected*}%% *} && return 0 ;;
esac
