From 1704fe27fe3441a4a6bd924742669626cfe7d0ba Mon Sep 17 00:00:00 2001 From: Alexander Bocken Date: Mon, 4 Jan 2021 16:31:18 +0100 Subject: [PATCH] can open multiple files simultaneously now --- .local/bin/tools/de | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/.local/bin/tools/de b/.local/bin/tools/de index 9ab1f10..83dc4fd 100755 --- a/.local/bin/tools/de +++ b/.local/bin/tools/de @@ -3,10 +3,10 @@ #either via dmenu or fzf depending on the context ppid () { ps -p ${1:-$$} -o ppid=; } shell="$(ps aux | grep $( ppid ) | head -n1 | awk '{print $11}' )" -document_dirs="$HOME/bks/* $HOME/eth/* $HOME/dox/*" +document_dirs="$HOME/bks/* $HOME/eth/* $HOME/dox/* $HOME/dls/*" #force launch dmenu via cmd if [ "$1" = "launchdmenu" ]; then - file="$( find $document_dirs -type f | sed "s|$HOME|~|"| dmenu -l 10 -p 'open what file?')" + file="$( find $document_dirs -type f | sed "s|$HOME|~|"| dmenu -i -l 10 -p 'open what file?')" #/bin/sh means it's probably from dmenu_run (it's ugly but works) elif [ ! "$shell" = "/bin/sh" ]; then currentdir="$(pwd)" @@ -17,23 +17,21 @@ elif [ ! "$shell" = "/bin/sh" ]; then if rifle -l "$path" | head -n1 | grep -q 'EDITOR';then rifle "$path" else - rifle "$path" & disown + rifle "$path" & fi cd "$currentdir" || exit exit #launch dmenu as it's probably in dmenu_run else - file="$( find $document_dirs -type f | sed "s|$HOME|~|" | dmenu -l 10 -p 'open what file?' -it "$*" )" + file="$( find $document_dirs -type f | sed "s|$HOME|~|" | dmenu -i -l 10 -p 'open what file?' -it "$*" )" fi #process selection if it's from dmenu [ -z "$file" ] && exit -path="$(echo "$file" | sed "s|\~|$HOME|")" -echo "$path" | +echo "$file" | sed "s|\~|$HOME|" | while read -r pathfile; do - cd "$( dirname "$pathfile" )" || exit if rifle -l "$pathfile" | head -n1 | grep -q 'EDITOR';then - st rifle "$pathfile" + st rifle "$pathfile" & else - rifle "$pathfile" + rifle "$pathfile" & fi done