about summary refs log tree commit diff
path: root/Completion/X/Command/_x_utils
blob: 13c5572af06673f0fca12a0f128afb2de5f8adb6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
#compdef xdpyinfo xwininfo xkill xfontsel xfd xev xhost xon xsetroot xwd xwud xrdb xprop xlsatoms xlsclients

local curcontext="$curcontext" state state_descr line expl ret=1

case "$service" in
xdpyinfo)
  _x_arguments \
    -queryExtensions \
    '-ext:extension: _x_extension -a' \
    -version
  ;;
xwininfo)
  _x_arguments \
    -{help,int,children,tree,stats,bits,events,size,wm,shape,frame,all,english,metric} \
    '(-id -name)-root' \
    '(-id -root)-name:name: _x_window -n' \
    '(-name -root)-id:id: _x_window'
  ;;
xprop)
  _x_arguments -C \
    -{help,frame,notype,spy} \
    '-grammar[show grammar for command line options]' \
    '(-id -name)-root[use the root window as the target window]' \
    '(-id -root)-name[specify target window by name]:name: _x_window -n' \
    '(-name -root)-id[specify target window by window id]:id: _x_window' \
    '-font[display the properties of a font]:font: _x_font' \
    '-len[show at most n bytes of any property]:n' \
    '*-fs[read more property formats from file]:file: _files' \
    '*-remove[specify an atom to remove from the target window]:property atom:->atoms' \
    '*-set[specify an atom and a value to set on the target window]:property atom:->atoms:value' \
    '*-f:property atom:->atoms:format: ::dformat' \
    '*:property atoms:->atoms'
  ;;
xlsatoms)
  _x_arguments -C \
    '*-format[printf-style format to use]:format' \
    '*-range[atom values to list]:[num]-[num]' \
    '*-name[name of single atom to print]:atom:->atoms'
  ;;
xlsclients)
  _x_arguments -C \
    '-a[list all clients on all screens]' \
    '-l[long format adding window/icon names and class hints]' \
    '-m[maximum characters of command to include]:characters'
 ;;
xkill)
  _x_arguments \
    -version \
    -frame \
    '(-id)-all' \
    '(-all)-id:window: _x_window' \
    '-button:selection button:(any 1 2 3 4 5)'
  ;;
xfontsel)
  _xt_arguments \
    -{print,scaled} \
    '-pattern:font pattern:_x_font' \
    '-sample:sample text' \
    '-sample16:16-bit sample text' \
    '-sampleUCS:ISO10646 sample text'
  ;;
xfd)
  _xt_arguments \
    '-fn:font: _x_font' \
    '-fa:font: _xft_fonts' \
    -{box,center} \
    '-start:first character number' \
    '-bc:box border color:_x_color' \
    '-rows:number of rows' \
    '-columns:number of columns'
  ;;
xev)
  _x_arguments \
    '-bw:border width' \
    '-bs:type of backing store:(NotUseful WhenMapped Always)' \
    '-id:id:_x_window' \
    '-s[use save-under]' \
    '-name:window name' \
    '-rv' \
    '*-event:event mask:(keyboard mouse expose visibility structure substructure focus property colormap owner_grab_button randr)'
  ;;
xhost)
  local type tmp match

  if [[ -z $PREFIX ]]; then
    _describe prefixes '(-:disallow +:allow)' -S '' -r ''
  fi

  if compset -P '-'; then
    tmp=(${(f)"$(xhost)"})
    shift tmp
    tmp=(${tmp:#LOCAL:|<*>})
    if [[ "$tmp" = *:* ]]; then
      if compset -P 1 '(#b)(*):'; then
	type="$match[1]"
	_tags displays
	while _tags; do
          while _next_label displays expl 'disallow access'; do
	      { compadd "$expl[@]" -M 'm:{a-z}={A-Z} r:|[:.]=* r:|=*' - \
		        ${${(M)tmp:#(#i)$type:*}#(#i)$type:} ||
	            _hosts "$expl[@]" } && ret=0
	  done
	  (( ret )) || return 0
        done
      else
	_alternative \
	    'types:name family:compadd -S: ${(L)tmp%%:*}' \
	    'hosts:host:compadd ${(@)tmp#*:}' && ret=0
      fi
    else
      _tags displays
      while _tags; do
        while _next_label displays expl 'disallow access'; do
	  { compadd "$expl[@]" -M 'm:{a-z}={A-Z} r:|[:.]=* r:|=*' -a tmp ||
            _hosts "$expl[@]" } && ret=0
        done
	(( ret )) || return 0
      done
    fi
  else
    compset -P +

    if [[ "$PREFIX" = *:* ]]; then
      type="${(L)PREFIX%%:*}"
      compset -P 1 '*:'

      case "$type" in
      inet) _hosts && ret=0;;
      dnet) _message -e decnet-hosts 'DECnet host';;
      nis)  _message -e network-names 'Secure RPC network name';;
      krb)  _message -e principals 'Kerberos V5 principal';;
      esac
    else
      _alternative \
          'types:name family:compadd -S: - inet dnet nis krb' \
	  'hosts:: _hosts' && ret=0
    fi
  fi
  return ret
  ;;
xon)
  _arguments \
    -{access,debug,nols} \
    '-name:window name' \
    '-screen:screen number' \
    '-user:remote user name:_users' \
    ':remote host:_hosts' \
    '(-):command: _command_names -e' \
    '*:command: _normal'
  ;;
xsetroot)
  _x_arguments \
    -{help,def,gray,grey,rv} \
    '-cursor:cursor file:_files -g \*.\(\#i\)\(xbm\|curs\(\|or\)\):mask file:_files -g \*.\(\#i\)\(xbm\|curs\(\|or\)\|mask\)\(-.\)' \
    '-cursor_name:cursor name:_x_cursor' \
    '-bitmap:bitmap file:_files -g \*.\(\#i\)xbm\(-.\)' \
    '-mod:x grid distance (1-16): :y grid distance (1-16)' \
    '-fg:foreground color:_x_color' \
    '-bg:background color:_x_color' \
    '-solid:screen solid color:_x_color' \
    '-name:root window name'
  ;;
xwd)
  _x_arguments \
    -{debug,help,nobdrs,xy,frame,root,icmap,screen,silent} \
    '-out:output file:_files' \
    '-add:pixel change value' \
    '-id:id: _x_window' \
    '-name:name: _x_window -n'
  ;;
xwud)
  _x_arguments \
    -{help,new,noclick,raw,rv,scale} \
    '-bg:background color:_x_color' \
    '-fg:foreground color:_x_color' \
    '-in:input file:_files -g \*.\(\#i\)xwd\(-.\)' \
    '-plane:image plane to display' \
    '-std:standard colormap:(best default gray red blue green)' \
    '-vis:visual:_x_visual'
  ;;
xrdb)
  _x_arguments \
    -{help,quiet,symbols,retain,version} \
    '(-all -screen -screens)-global' \
    '(-global -screen -screens)-all' \
    '(-global -all -screens)-screen' \
    '(-global -all -screen)-screens' \
    '-n[only display on stdout]' \
    '(-nocpp)-cpp:preprocessor program:_files -g \*\(-\*\)' \
    '(-cpp)-nocpp' \
    '(-load -override -merge -remove)-query' \
    '(-query -override -merge -remove)-load' \
    '(-query -load -merge -remove)-override' \
    '(-query -load -override -remove)-merge' \
    '(-query -load -override -merge)-remove' \
    '-edit:output file:_files' \
    '-backup:backup extension' \
    '*-D-:symbol to define' \
    '*-U-:symbol to undefine' \
    '*-I-:include directory:_files -/' \
    '*:defaults file:_files'
  ;;
esac && ret=0

if [[ $state == atoms ]]; then
  _wanted atoms expl "$state_descr" compadd ${${(f)"$(_call_program atoms xlsatoms 2> /dev/null)"}#*$'\t'} && ret=0
fi

return ret