rendez-vous sur ArraKISS
Archives ContactATOM
whoami@ybad.name
# find . -iname

    dfm : lanceur de fichiers

    dfm permet de parcourir ses fichiers, puis d’en sélectionner un afin de l’ouvrir.

    Aperçu du code :

    #!/bin/sh
    # dmenu file launcher
    # Author:      prx <prx@ybad.name>
    # licence:     MIT
    
    test -s $HOME/.dmenurc && . $HOME/.dmenurc
    
    [ $# -eq 0 ] && curpath="$HOME"
    [ $# -eq 1 ] && curpath="$1"
    [ ! -e "${curpath}" ] && exit
    
    prompt="ls"
    case $LANG in
    	fr* ) openprompt="Ouvrir " ;;
    	* ) openprompt="Open " ;;
    esac
    
    selection=$(ls -ap "${curpath}" | dmenu \
    	-l ${l} \
    	-i \
    	-fn "${fn}" \
    	-nb "${nb}" \
    	-nf "${nf}" \
    	-sb "${sb}" \
    	-sf "${sf}" \
    	-p "${prompt}" \
    )
    [ -z "$selection" ] && exit
    
    case $selection in 
    	*/ ) ${0} "${curpath}/${selection}" ;;
    	*  ) 
    		if [ -x "${curpath}/${selection}" ]; then
    			exec "${curpath}/${selection}" 
    		else
    			run=$(dmenu_path | dmenu \
    				-l ${l} \
    				-fn "${fn}" \
    				-nb "${nb}" \
    				-nf "${nf}" \
    				-sb "${sb}" \
    				-sf "${sf}" \
    				-p "${openprompt} ${curpath}/${selection}" 
    				)
    			[ -z "$run" ] && exit
    			"${run}" "${curpath}/${selection}"
    		fi
    	;;
    esac