2000-04-26 10:31:20 +02:00
|
|
|
#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 () {
|
2000-05-04 22:16:09 +02:00
|
|
|
_files "$expl[@]" -/
|
2000-04-26 10:31:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
_xset_compfpdel () {
|
2000-05-04 22:16:09 +02:00
|
|
|
compadd "$expl[@]" - ${(s:,:)${"$(xset q)"##*
|
2000-04-26 10:31:20 +02:00
|
|
|
Font Path:
|
|
|
|
#}%%
|
|
|
|
*}
|
|
|
|
}
|
|
|
|
|
|
|
|
_regex_arguments _xset_parse \
|
|
|
|
"/$word/" \
|
2000-05-06 09:59:52 +02:00
|
|
|
\( "/-d(isplay|)$nul/" "$guard" "/$word/" ':option-display:display:_x_display' \
|
2000-04-26 10:31:20 +02:00
|
|
|
\| "/-c$nul/" "$guard" \
|
|
|
|
\| "/c$nul/" "$guard" \
|
2000-05-06 09:59:52 +02:00
|
|
|
\( "/(on|off)$nul/" ':option-c-bool:click:(on off)' \
|
|
|
|
\| "/[0-9]##$nul/" ':option-c-volume:volume:' \
|
2000-04-26 10:31:20 +02:00
|
|
|
\| \) \
|
|
|
|
\| "/-b$nul/" "$guard" \
|
|
|
|
\| "/b$nul/" "$guard" \
|
2000-05-06 09:59:52 +02:00
|
|
|
\( "/(on|off)$nul/" ':option-b-bool:bell:(on off)' \
|
|
|
|
\| "/[0-9]##$nul/" ':option-b-volume:bell volume:' \
|
|
|
|
\( "/[0-9]##$nul/" ':option-b-pitch:bell pitch:' \
|
|
|
|
\( "/[0-9]##$nul/" ':option-b-duration:bell duration:' \
|
2000-04-26 10:31:20 +02:00
|
|
|
\| \) \
|
|
|
|
\| \) \
|
|
|
|
\| \) \
|
|
|
|
\| "/bc$nul/" "$guard" \
|
|
|
|
\| "/-bc$nul/" "$guard" \
|
2000-05-06 09:59:52 +02:00
|
|
|
\| "/fp$nul/" "$guard" "/$word/" ':option-fp:font path:(default rehash)' \
|
|
|
|
\| "/(fp[+=]|[+]fp)$nul/" "$guard" "/$word/" ':option-fp-add:font path:{compset -P "*,"; _xset_compfpadd}' \
|
|
|
|
\| "/(fp-|-fp)$nul/" "$guard" "/$word/" ':option-fp-del:font path:{compset -P "*,"; _xset_compfpdel}' \
|
2000-04-26 10:31:20 +02:00
|
|
|
\| "/-led$nul/" "$guard" \
|
2000-05-06 09:59:52 +02:00
|
|
|
\( "/[0-9]##$nul/" ':option-led-number:led number:' \
|
2000-04-26 10:31:20 +02:00
|
|
|
\| \) \
|
|
|
|
\| "/led$nul/" "$guard" \
|
2000-05-06 09:59:52 +02:00
|
|
|
\( "/(on|off)$nul/" ':option-led-bool:led:(on off)' \
|
|
|
|
\| "/[0-9]##$nul/" ':option-led-number:led number:' \
|
2000-04-26 10:31:20 +02:00
|
|
|
\| \) \
|
|
|
|
\| "/m(ouse|)$nul/" "$guard" \
|
2000-05-06 09:59:52 +02:00
|
|
|
\( "/default$nul/" ':option-mouse-default:mouse parameter:(default)' \
|
|
|
|
\| "/[0-9]##(/[0-9]##|)$nul/" ':option-mouse-mult-div:accel_mult/accel_div:' \
|
|
|
|
\( "/[0-9]##$nul/" ':option-mouse-threshold:threshold:' \
|
2000-04-26 10:31:20 +02:00
|
|
|
\| \) \
|
|
|
|
\| \) \
|
|
|
|
\| "/[-+]dpms$nul/" "$guard" \
|
|
|
|
\| "/dpms$nul/" "$guard" \
|
2000-05-06 09:59:52 +02:00
|
|
|
\( "/[0-9]##$nul/" ':option-dpms-standby:standby timeout:' \
|
|
|
|
\( "/[0-9]##$nul/" ':option-dpms-suspend:suspend timeout:' \
|
|
|
|
\( "/[0-9]##$nul/" ':option-dpms-off:off timeout:' \
|
2000-04-26 10:31:20 +02:00
|
|
|
\| \) \
|
|
|
|
\| \) \
|
2000-05-06 09:59:52 +02:00
|
|
|
\| "/force$nul/" ':option-dpms-force:force DPMS state:(force)' \
|
|
|
|
"/(on|standby|suspend|off)$nul/" ':option-dpms-state:DPMS state:(on standby suspend off)' \
|
2000-04-26 10:31:20 +02:00
|
|
|
\) \
|
|
|
|
\| "/s$nul/" "$guard" \
|
|
|
|
\( "/(blank|noblank|expose|noexpose|default|on|activate|reset)$nul/" \
|
2000-05-06 09:59:52 +02:00
|
|
|
':option-s:screen saver:(blank noblank expose noexpose default on activate reset off)' \
|
|
|
|
\| "/off$nul/" \( "/off$nul/" ':option-s-off-period:period off:(off)' \| \) \
|
|
|
|
\| "/[0-9]##$nul/" ':option-s-timeout:length:' \
|
|
|
|
\( "/[0-9]##$nul/" ':option-s-period:period:' \
|
2000-04-26 10:31:20 +02:00
|
|
|
\| \) \
|
|
|
|
\| \) \
|
|
|
|
\| "/-r$nul/" "$guard" \
|
2000-05-06 09:59:52 +02:00
|
|
|
\( "/[0-9]##$nul/" ':option-r-keycode:keycode:' \
|
2000-04-26 10:31:20 +02:00
|
|
|
\| \) \
|
|
|
|
\| "/r$nul/" "$guard" \
|
2000-05-06 09:59:52 +02:00
|
|
|
\( "/(on|off)$nul/" ':option-r-autorepeat:autorepeat:(on off)' \
|
|
|
|
\| "/[0-9]##$nul/" ':option-r-keycode:keycode:' \
|
2000-04-26 10:31:20 +02:00
|
|
|
\| \) \
|
|
|
|
\| "/p$nul/" "$guard" \
|
2000-05-06 09:59:52 +02:00
|
|
|
"/[0-9]##$nul/" ':option-p-pixel:pixel:' \
|
|
|
|
"/$word/" ':option-p-color:color:_x_color' \
|
2000-04-26 10:31:20 +02:00
|
|
|
\| "/(-|)k$nul/" "$guard" \
|
|
|
|
\| "/(-|)q$nul/" "$guard" \
|
2000-05-04 22:16:09 +02:00
|
|
|
\| "/[]/" ':options:options:_xset_compopts' \
|
2000-04-26 10:31:20 +02:00
|
|
|
\) \#
|
|
|
|
|
|
|
|
_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 "$@"
|