From df2140e4cbb01b92776d7a1b42c72b5c9725ba8d Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Fri, 9 Dec 2011 15:58:35 +0000 Subject: 29409: Add xprop and xlsatoms completions. --- ChangeLog | 5 ++++- Completion/X/Command/_x_utils | 33 ++++++++++++++++++++++++++++++++- Completion/X/Type/_x_font | 2 +- 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2f5c9e1b9..dcc023f70 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,9 @@ * unposted: Doc/Zsh/compsys.yo: Remove duplicated 'the'. + * 29409: Completion/X/Command/_x_utils: Add completion for xprop and + xlsatoms. + 2011-12-09 Peter Stephenson * unposted: Completion/compinit: add NO_ignoreclosebraces to @@ -15696,5 +15699,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5526 $ +* $Revision: 1.5527 $ ***************************************************** diff --git a/Completion/X/Command/_x_utils b/Completion/X/Command/_x_utils index 2e672fdc0..0ff0cf268 100644 --- a/Completion/X/Command/_x_utils +++ b/Completion/X/Command/_x_utils @@ -1,4 +1,6 @@ -#compdef xdpyinfo xwininfo xkill xfontsel xfd xev xhost xon xsetroot xwd xwud xrdb +#compdef xdpyinfo xwininfo xkill xfontsel xfd xev xhost xon xsetroot xwd xwud xrdb xprop xlsatoms + +local ret=1 oret expl case "$service" in xdpyinfo) @@ -13,6 +15,27 @@ xwininfo) '(-id -root)-name:name: _x_window -n' \ '(-name -root)-id:id: _x_window' ;; +xprop) + _x_arguments \ + -{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]:atoms:->atoms' \ + '*-set[specify an atom and a value to set on the target window]:atoms:->atoms:value' \ + '*-f:atoms:->atoms:format: ::dformat' \ + '*:atoms:->atoms' && ret=0 + ;; +xlsatoms) + _x_arguments \ + '*-format[printf-style format to use]:format' \ + '*-range[atom values to list]:[num]-[num]' \ + '*-name[name of single atom to print]:atom:->atoms' + ;; xkill) _x_arguments \ -frame \ @@ -163,3 +186,11 @@ xrdb) '*:defaults file:_files' ;; esac + +oret=$? +if [[ $state == atoms ]]; then + _wanted atoms expl atoms compadd ${${(f)"$(_call_program atoms xlsatoms 2> /dev/null)"}#*$'\t'} && ret=0 +else + ret=$oret +fi +return ret diff --git a/Completion/X/Type/_x_font b/Completion/X/Type/_x_font index 134cfdf1c..a363b2775 100644 --- a/Completion/X/Type/_x_font +++ b/Completion/X/Type/_x_font @@ -9,7 +9,7 @@ _tags fonts || return 1 if (( ! $+_font_cache )); then typeset -gU _font_cache - _font_cache=( "${(@)^${(@f)$(_call_program fonts xlsfonts)}%%--*}--" ) + _font_cache=( "${(@)^${(@f)$(_call_program fonts xlsfonts 2> /dev/null)}%%--*}--" ) fi _wanted fonts expl font \ -- cgit 1.4.1