about summary refs log tree commit diff
path: root/Completion/X/_x_window
blob: 65d2b72e201e44413b94f1303931f0bb710ee3fe (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#autoload

local list expl

list=( "${(@)${(M@)${(@f)$(xwininfo -root -tree)}:#[ 	]#0x[0-9a-f]# \"*}##[ 	]#}" )

if [[ "$1" = -n ]]; then
  shift

  _description expl 'window name'
  compadd "$@" "$expl[@]" -d list - "${(@)${(@)list#*\"}%%\"*}"
else
  [[ "$1" = - ]] && shift

  _description expl 'window ID'
  compadd "$@" "$expl[@]" -d list - "${(@)list%% *}"
fi