1#compdef vncserver vncviewer xvncviewer xtightvncviewer xvnc4viewer
2
3local displays args
4displays=( ~/.vnc/$HOST:<->.pid(N:r:t:s/$HOST//) )
5displays=( \\${^displays} ) 
6
7case $service in
8  vncserver)
9    # currently missing: bc, c, nologo, r, ttyxx, v
10    # Don't know values for -nolisten (other than tcp).
11    _arguments \
12      - start \
13	'-name:desktop name:_x_name' \
14	'-a[mouse acceleration (pixels)]:#:' \
15	'-ac[disable access control restrictions]' \
16	'-audit[set audit trail level]:int:' \
17	'-auth[select authorization file]:file:_files' \
18	'-bs[disable any backing store support]' \
19	'-c[turns off key-click]' \
20	'-cc[default color visual class]:int:' \
21	'-co[color database file]:file:_files' \
22	'-core[generate core dump on fatal error]' \
23	'-dpi[screen resolution in dots per inch]:int:' \
24	'-deferglyphs[defer loading of glyphs]:type:(none all 16)' \
25	'-f[bell base]:level (0-100):' \
26	'-fc[cursor font]:string:' \
27	'-fn[default font name]:string:' \
28	'-fp[default font path]:string:' \
29	'-help[prints message with these options]' \
30	'-I[ignore all remaining arguments]' \
31	'-ld[limit data space to N Kb]:int:' \
32	'-lf[limit number of open files to N]:int:' \
33	'-ls[limit stack space to N Kb]:int:' \
34	'-nolock[disable the locking mechanism]' \
35	'-logo[enable logo in screen saver]' \
36	'-nolisten[dont listen on protocol]:protocol:(tcp)' \
37	'-p[screen-saver pattern duration (minutes)]:time (minutes):' \
38	'-pn[accept failure to listen on all ports]' \
39	'-nopn[reject failure to listen on all ports]' \
40	'-r[turns off auto-repeat]' \
41	'-s[screen-saver timeout (minutes)]:timeout (minutes):' \
42	'-su[disable any save under support]' \
43	'-t[mouse threshold]:pixels:' \
44	'-terminate[terminate at server reset]' \
45	'-to[connection time out]:time:' \
46	'-tst[disable testing extensions]' \
47	'-v[screen-saver without video blanking]' \
48	'-wm[WhenMapped default backing-store]' \
49	'-x[loads named extension at init time ]:string:' \
50	'-query[contact named host for XDMCP]:host-name:_hosts' \
51	'-broadcast[broadcast for XDMCP]' \
52	'-indirect[contact named host for indirect XDMCP]:host-name:_hosts' \
53	'-port[UDP port number to send messages to]:port:' \
54	'-once[Terminate server after one session]' \
55	'-class[specify display class to send in manage]:display-class:' \
56	'-cookie[specify the magic cookie for XDMCP]:xdm-auth-bits:' \
57	'-displayID[manufacturer display ID for request]:display-id:' \
58	'-geometry:geometry:(1600x1200 1280x1024 1152x864 1024x768 800x600 640x480)' \
59	'-depth:pixel depth:(8 16 24 32)' \
60	'-pixelformat:pixel format' \
61	'-udpinputport[UDP port for keyboard/pointer data]:port:' \
62	'-rfbport[TCP port for RFB protocol]:port:' \
63	'-rfbwait[max time in ms to wait for RFB client]:time:' \
64	'-nocursor[dont put up a cursor]' \
65	'-rfbauth[use authentication on RFB protocol]:passwd-file:_files' \
66	'-httpd[serve files via HTTP from here]:dir:_files -/' \
67	'-httpport[port for HTTP]:port:' \
68	'-deferupdate[time in ms to defer updates (default 40)]:time (ms):' \
69	'-economictranslate[less memory-hungry translation]' \
70	'-lazytight[disable "gradient" filter in tight encoding]' \
71	'-desktop[VNC desktop name (default x11)]:name:' \
72	'-alwaysshared[always treat new clients as shared]' \
73	'-nevershared[never treat new clients as shared]' \
74	'-dontdisconnect[dont disconnect existing clients for new non-shared connections]' \
75	'-viewonly[let clients only to view the desktop]' \
76	'-localhost[only allow connections from localhost]' \
77	'-interface[only bind to specified interface address]:ipaddr:' \
78	'-inetd[Xvnc is launched by inetd]' \
79	'-compatiblekbd[set META key = ALT key as in the original VNC]' \
80	'-version[report Xvnc version on stderr]' \
81	'1:: :_guard "(|:[0-9]#)" "display number"' \
82      - kill \
83	"-kill:display number:($displays)" \
84      - help \
85	'-help'
86  ;;
87  *vncviewer) 
88    _xt_arguments -shared -viewonly -fullscreen -bgr233 -owncmap -truecolour \
89      '-encodings:encodings:_values -s " " encoding copyrect hextile corre rre raw' \
90      '-depth:depth' \
91      '-passwd:file:_files' \
92      '(1)-listen:display number' \
93      '-via:host:_hosts' \
94      '(-listen)1::display:_x_display'
95  ;;
96esac
97    
98