about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--Completion/X/Type/_x_window18
1 files changed, 18 insertions, 0 deletions
diff --git a/Completion/X/Type/_x_window b/Completion/X/Type/_x_window
new file mode 100644
index 000000000..15bb87fcf
--- /dev/null
+++ b/Completion/X/Type/_x_window
@@ -0,0 +1,18 @@
+#autoload
+
+local list expl
+
+_tags windows || return 1
+
+list=( "${(@)${(M@)${(@f)$(_call_program windows xwininfo -root -tree)}:#[ 	]#0x[0-9a-f]# \"*}##[ 	]#}" )
+
+if [[ "$1" = -n ]]; then
+  shift
+
+  _wanted windows expl 'window name' \
+      compadd "$@" -d list - "${(@)${(@)list#*\"}%%\"*}"
+else
+  [[ "$1" = - ]] && shift
+
+  _wanted windows expl 'window ID' compadd "$@" -d list - "${(@)list%% *}"
+fi