about summary refs log tree commit diff
path: root/Completion/X
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2011-01-09 16:57:01 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2011-01-09 16:57:01 +0000
commite72999c092b80b71c5913a52c411a1c7529971f4 (patch)
tree02974c6a4f7a4d73934481f731f12703a682fae7 /Completion/X
parenta89f0559c210def9a40bfeb9da6b38128a49cb55 (diff)
downloadzsh-e72999c092b80b71c5913a52c411a1c7529971f4.tar.gz
zsh-e72999c092b80b71c5913a52c411a1c7529971f4.tar.xz
zsh-e72999c092b80b71c5913a52c411a1c7529971f4.zip
gi1242+zsh@gmail.com: 28594:
Various new and improved completions
Diffstat (limited to 'Completion/X')
-rw-r--r--Completion/X/Command/.distfiles2
-rw-r--r--Completion/X/Command/_gv2
-rw-r--r--Completion/X/Command/_okular10
-rw-r--r--Completion/X/Command/_pdftk63
-rw-r--r--Completion/X/Command/_vnc1
-rw-r--r--Completion/X/Command/_xrandr59
6 files changed, 121 insertions, 16 deletions
diff --git a/Completion/X/Command/.distfiles b/Completion/X/Command/.distfiles
index 8ad17e1ac..d97ec8d3c 100644
--- a/Completion/X/Command/.distfiles
+++ b/Completion/X/Command/.distfiles
@@ -4,6 +4,8 @@ _acroread       _dcop
 _gnome-gv       _gqview         _gv             _kfmclient
 _mozilla        _mplayer        _nautilus
 _nedit          _netscape
+_okular
+_pdftk
 _qiv            
 _setxkbmap
 _urxvt          _vnc
diff --git a/Completion/X/Command/_gv b/Completion/X/Command/_gv
index 6075de508..d4dbed089 100644
--- a/Completion/X/Command/_gv
+++ b/Completion/X/Command/_gv
@@ -34,7 +34,7 @@ _arguments \
   '--arguments=:ghostscript arguments:' \
   '--page=:label of first page:' \
   '--media=:page size:(Letter Legal Statement Tabloid Ledger Folio Quarto 10x14 Executive A3 A4 A5 B4 B5)' \
-  '--orientation=:orientation:' \
+  '--orientation=:orientation:(landscape seascape upsidedown portrait)' \
   '--scale=:scale entry:' \
   '--scalebase=:scale base:' \
   '--ad=:resource file:_files' \
diff --git a/Completion/X/Command/_okular b/Completion/X/Command/_okular
new file mode 100644
index 000000000..0b81e2f9d
--- /dev/null
+++ b/Completion/X/Command/_okular
@@ -0,0 +1,10 @@
+#compdef okular
+local extns
+
+extns="{pdf,ps,eps,dvi}(.gz|.bz2)(#c,1)|djvu|tiff|chm|cbr|cbz"
+
+_arguments \
+  '(-p --page)'{-p,--page}'[Page of the document to be shown]:page: ' \
+  '--presentation[Start the document in presentation mode]' \
+  '--unique[Unique instance control]' \
+  "*:Okular documents:_files -g '*.(#i)($extns)(-.)'"
diff --git a/Completion/X/Command/_pdftk b/Completion/X/Command/_pdftk
new file mode 100644
index 000000000..b8c43f754
--- /dev/null
+++ b/Completion/X/Command/_pdftk
@@ -0,0 +1,63 @@
+#compdef pdftk
+
+_pdfwithhandle()
+{
+    compset -P '(#I)[A-Z]='
+    _files "$@" -g '(#i)*.pdf'
+}
+
+local expl
+local -a opts operations
+
+opts=(output encrypt_40bit encrypt_128bit allow owner_pw user_pw flatten
+	compress uncompress keep_first_id keep_final_id drop_xfa verbose
+	dont_ask do_ask)
+operations=(cat attach_files unpack_files burst fill_form background stamp
+	generate_fdf multibackground multistamp dump_data dump_data_fields
+	update_info)
+
+case $words[CURRENT-1] in
+    ((input|owner|user)_pw)
+	_message "password, or PROMPT"
+	;;
+
+    (allow)
+	#_description permissions expl "permission"
+	#compadd $expl \
+	_values -s , permissions \
+	    Printing DegradedPrinting ModifyContents Assembly CopyContents \
+	    ScreenReaders ModifyAnnotations FillIn AllFeatures
+	;;
+
+    (attach_files)
+	_files "$@"
+	;;
+
+    (fill_form)
+	_description files expl 'FDF and XFDF files'
+	_files "$@" $expl -g '(#i)*.(fdf|xfdf)'
+	;;
+
+    ((multibackground|background|stamp|multistamp|output))
+	_description files expl 'PDF files'
+	_files "$@" $expl -g '(#i)*.pdf'
+	;;
+
+    (update_info)
+	_files
+	;;
+
+    (*)
+	false
+	;;
+esac && return 0
+
+if [[ -n $words[(r)(${(j:|:)operations})] ]]; then
+    _description options expl "options"
+    compadd $@ $expl $opts
+else
+    _tags files operations
+    _alternative \
+	'files:PDF files:_pdfwithhandle' \
+	"operations:operations:($operations)"
+fi
diff --git a/Completion/X/Command/_vnc b/Completion/X/Command/_vnc
index 347eb8ef4..09923cd65 100644
--- a/Completion/X/Command/_vnc
+++ b/Completion/X/Command/_vnc
@@ -25,6 +25,7 @@ case $service in
       '-depth:depth' \
       '-passwd:file:_files' \
       '(1)-listen:display number' \
+      '-via:host:_hosts' \
       '(-listen)1::display:_x_display'
   ;;
 esac
diff --git a/Completion/X/Command/_xrandr b/Completion/X/Command/_xrandr
index 56d770e4d..2e51d0d23 100644
--- a/Completion/X/Command/_xrandr
+++ b/Completion/X/Command/_xrandr
@@ -1,4 +1,11 @@
 #compdef xrandr
+local context state line
+typeset -A opt_args
+local outputs modes expl
+
+# User configurable. TODO -- styles?
+outputs=(LVDS1 TV1 VGA1)
+modes=(1280x800 1024x768 800x600 640x480)
 
 _arguments \
   '(-d -display)'{-d,-display}':X display:_x_display' \
@@ -6,28 +13,50 @@ _arguments \
   '(-o --orientation)'{-o,--orientation}':rotation:(normal inverted left right 0 1 2 3)' \
   '(-q --query)'{-q,--query}'[display current state]' \
   '(-s --size)'{-s,--size}':size:' \
-  '(-r --rate --refresh)'{-r,--rate,--refresh}':target refresh rate:' \
+  '(-r --rate --refresh)'{*-r,*--rate,*--refresh}':target refresh rate:' \
   '(-v --version)'{-v,--version}'[display version]' \
   '-x[reflect across X axis]' \
   '-y[reflect across Y axis]' \
   '--screen:X screen number' \
   '--verbose[be more verbose]' \
   '--dryrun' \
+  '--nograb' \
   '(--prop --properties)'{--prop,--properties}'[display the contents of properties for each output]' \
   '--fb:size:' \
   '--fbmm:size:' \
   '--dpi:dpi:' \
-  '--output:output to reconfigure:' \
-  '--auto' \
-  '--mode:mode:' \
-  '--preferred' \
-  '--pos:position:' \
-  '--reflect:axes:(normal x y xy)' \
-  '--rotate:rotation:(normal inverted left right)' \
-  '--left-of:output' \
-  '--right-of:output' \
-  '--above:output' \
-  '--below:output' \
-  '--same-as:output' \
-  '--off[disable the output]' \
-  '--crtc:crtc to use:'
+  "*--output:output to reconfigure:($outputs)" \
+  '*--auto' \
+  "*--mode:mode:($modes)" \
+  '*--preferred' \
+  '*--pos:position:' \
+  '*--reflect:axes:(normal x y xy)' \
+  '*--rotate:rotation:(normal inverted left right)' \
+  "*--left-of:relative position to:($outputs)" \
+  "*--right-of:relative position to:($outputs)" \
+  "*--above:relative position to:($outputs)" \
+  "*--below:relative position to:($outputs)" \
+  "*--same-as:relative position to:($outputs)" \
+  '*--set:property:(Backlight scaling\ mode):value:->value' \
+  '*--scale:output scaling:' \
+  '*--transform:transformation matrix:' \
+  '*--off[disable the output]' \
+  '*--crtc:crtc to use:' \
+  '*--panning:panning:' \
+  '*--gamma:r\:g\:b:' \
+  '*--primary' \
+  '--noprimary' \
+  '*--newmode:name: :clock MHz: :hdisp: :hsync-start: :hsync-end: :htotal: :vdisp: :vsync-start: :vsync-end: :vtotal:' \
+  '*--rmmode:Mode name:' \
+  "*--addmode:output:($outputs):name:" \
+  "*--delmode:output:($outputs):name:" \
+  && return 0
+
+if [[ $state == value ]]; then
+    case $words[CURRENT-1] in
+	(scaling* mode)
+	    _description value expl "output property 'scaling mode'"
+	    compadd "$@" "$expl[@]" None Full Center Full\ aspect && return 0
+	    ;;
+    esac
+fi