blob: 6cf4da8e1e6bbfe08725f9dc5a7375298cb0d1ad (
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
|
#compdef xset
local word=$'[^\0]#\0'
local nul=$'\0'
local guard='-_xset_guard ${match[1]%?}'
_xset_guard () {
local opt="$1" o
(( no[$opt]-- ))
for o in ${=eo[$opt]}; do
no[$o]=0
done
:
}
_xset_compopts () {
local expl
local opt tmp
tmp=()
for opt in ${(k)no[(R)*~0]}
do
if (( $+desc[$opt] )); then
tmp=("$tmp[@]" "$opt:$desc[$opt]")
else
tmp=("$tmp[@]" "$opt")
fi
done
_describe -o options tmp -- ||
_describe -o options allopts --
}
_xset_compfpadd () {
_wanted directories expl directory _files -/
}
_xset_compfpdel () {
_wanted directories expl directory compadd - ${(s:,:)${"$(xset q)"##*
Font Path:
#}%%
*}
}
_regex_arguments _xset_parse \
"/$word/" \
\( "/-d(isplay|)$nul/" "$guard" "/$word/" ":_x_display" \
\| "/-c$nul/" "$guard" \
\| "/c$nul/" "$guard" \
\( "/(on|off)$nul/" ':_wanted values expl click compadd on off' \
\| "/[0-9]##$nul/" ':_message volume' \
\| \) \
\| "/-b$nul/" "$guard" \
\| "/b$nul/" "$guard" \
\( "/(on|off)$nul/" ':_wanted values expl bell compadd on off' \
\| "/[0-9]##$nul/" ':_message volume' \
\( "/[0-9]##$nul/" ':_message pitch' \
\( "/[0-9]##$nul/" ':_message duration' \
\| \) \
\| \) \
\| \) \
\| "/bc$nul/" "$guard" \
\| "/-bc$nul/" "$guard" \
\| "/fp$nul/" "$guard" "/$word/" ':_wanted values expl "font path" compadd default rehash' \
\| "/(fp[+=]|[+]fp)$nul/" "$guard" "/$word/" ':compset -P "*,"; _xset_compfpadd' \
\| "/(fp-|-fp)$nul/" "$guard" "/$word/" ':compset -P "*,"; _xset_compfpdel' \
\| "/-led$nul/" "$guard" \
\( "/[0-9]##$nul/" ':_message integer' \
\| \) \
\| "/led$nul/" "$guard" \
\( "/(on|off)$nul/" ':_wanted values expl led compadd on off' \
\| "/[0-9]##$nul/" ':_message integer' \
\| \) \
\| "/m(ouse|)$nul/" "$guard" \
\( "/default$nul/" ':_wanted values expl "mouse parameter" compadd default' \
\| "/[0-9]##(/[0-9]##|)$nul/" ':_message accel_mult/accel_div' \
\( "/[0-9]##$nul/" ':_message threshold' \
\| \) \
\| \) \
\| "/[-+]dpms$nul/" "$guard" \
\| "/dpms$nul/" "$guard" \
\( "/[0-9]##$nul/" ':_message "standby timeout"' \
\( "/[0-9]##$nul/" ':_message "suspend timeout"' \
\( "/[0-9]##$nul/" ':_message "off timeout"' \
\| \) \
\| \) \
\| "/(on|standby|suspend|off)$nul/" ':_wanted values expl DPMS compadd on standby suspend off' \
\) \
\| "/s$nul/" "$guard" \
\( "/(blank|noblank|expose|noexpose|default|on|activate|reset)$nul/" \
':_wanted values expl "screen saver" compadd blank noblank expose noexpose default on activate reset off' \
\| "/off$nul/" \( "/off$nul/" ':compadd off' \| \) \
\| "/[0-9]##$nul/" ':_message length' \
\( "/[0-9]##$nul/" ':_message period' \
\| \) \
\| \) \
\| "/-r$nul/" "$guard" \
\( "/[0-9]##$nul/" ':_message keycode' \
\| \) \
\| "/r$nul/" "$guard" \
\( "/(on|off)$nul/" ':_wanted values expl autorepeat compadd on off' \
\| "/[0-9]##$nul/" ':_message keycode' \
\| \) \
\| "/p$nul/" "$guard" \
"/[0-9]##$nul/" ':_message pixel' \
"/$word/" ':_x_color' \
\| "/(-|)k$nul/" "$guard" \
\| "/(-|)q$nul/" "$guard" \
\| "/[]/" ':_xset_compopts' \
\) \#
_xset () {
local expl allopts
typeset -A desc no eo
desc=(
b 'specify bell parameters'
-b 'disable bell'
bc 'enable bug compatibility'
-bc 'disable bug compatibility'
c 'control key click'
-c 'disable key click'
-dpms 'disable DPMS'
+dpms 'enable DPMS'
dpms 'specify DPMS parameter'
fp\= 'set font path'
fp 'control font path'
-fp 'remove font path elements'
fp- 'remove font path elements'
+fp 'prepend font path elements'
fp+ 'append font path elements'
led 'control keyboard LEDs'
-led 'turn off all LEDs'
m 'specify mouse parameters'
mouse 'specify mouse parameters'
p 'specify pixel color values'
r 'enable autorepeat'
-r 'disable autorepeat'
s 'specify screen saver parameters'
q 'query current information'
k 'enable lock'
-k 'disable lock'
-display 'display'
)
no=(
-display 1 -d 0
-c 1 c 1
-b 1 b 1
-bc 1 bc 1
fp 1 fp= 1 +fp 1 fp+ 1 -fp 1 fp- 1
-led 1 led 1
mouse 1 m 0
+dpms 1 -dpms 1 dpms 1
s 1
-r 1 r 1
p 1
-k 1 k 1
-q 0 q 1
)
allopts=()
for opt in ${(k)no}
do
if (( $+desc[$opt] )); then
allopts=("$allopts[@]" "$opt:$desc[$opt]")
else
allopts=("$allopts[@]" "$opt")
fi
done
eo=(
-display '-display -d'
-d '-display -d'
-c '-c c'
c '-c c'
-b '-b b'
b '-b b'
-bc '-bc bc'
bc '-bc bc'
fp+ 'fp fp='
fp- 'fp fp='
+fp 'fp fp='
-fp 'fp fp='
m 'm mouse'
mouse 'm mouse'
-dpms '+dpms -dpms dpms'
+dpms '+dpms -dpms dpms'
dpms '+dpms -dpms dpms'
-k '-k k'
k '-k k'
)
_xset_parse
}
[[ -o kshautoload ]] || _xset "$@"
|