#! /bin/zsh # # this file: # https://dataswamp.org/~incal/conf/.zsh/show [[ $(uname) == "Linux" ]] || return show () { [[ $DISPLAY ]] || return declare -Ua fs=($@) local error=0 for f in $fs; do if [[ ! -f $f && ! -d $f ]]; then no-file-msg $f error=1 fi done (( error )) && return 1 local pdfs=() local pics=() local pss=() local svgs=() local htmls=() local ext for f in $fs; do if [[ ! -d $f ]]; then ext=${f:e} case $ext in (eps|ps) pss+=($f) ;; (htm|html) htmls+=($f) ;; (bmp|gif|jpeg|jpg|png|pnm|webp) pics+=($f) ;; (BMP|GIF|JPEG|JPG|PNG|PNM|WEBP) pics+=($f) ;; (pdf) pdfs+=($f) ;; (svg) svgs+=($f) ;; (*) esac fi done for ps in $pss; do gv --widgetless --fullscreen $ps & done for html in $htmls; do ice $html done [[ ! -z $pics ]] && pic $pics > /dev/null & local pdf for pdf in $pdfs; do xpdf -rv -fullscreen $pdf & done [[ ! -z $svgs ]] && inkview $svgs & } alias sw=show