#autoload local list expl _wanted windows || return 1 list=( "${(@)${(M@)${(@f)$(_call windows xwininfo -root -tree)}:#[ ]#0x[0-9a-f]# \"*}##[ ]#}" ) if [[ "$1" = -n ]]; then shift _loop windows expl 'window name' \ compadd "$@" -d list - "${(@)${(@)list#*\"}%%\"*}" else [[ "$1" = - ]] && shift _loop windows expl 'window ID' compadd "$@" -d list - "${(@)list%% *}" fi