de now can force launch dmenu
This commit is contained in:
parent
f27e393c4b
commit
f9a44d7f5a
@ -4,17 +4,11 @@
|
|||||||
ppid () { ps -p ${1:-$$} -o ppid=; }
|
ppid () { ps -p ${1:-$$} -o ppid=; }
|
||||||
shell="$(ps aux | grep $( ppid ) | head -n1 | awk '{print $11}' )"
|
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/*"
|
||||||
|
#force launch dmenu via cmd
|
||||||
|
if [ "$1" = "launchdmenu" ]; then
|
||||||
|
file="$( du -a $document_dirs | awk '{for(i=2; i<NF; i++){printf("%s ", $i)}printf("%s\n", $NF)}'| dmenu -l 10 -p 'open what file?')"
|
||||||
#/bin/sh means it's probably from dmenu_run (it's ugly but works)
|
#/bin/sh means it's probably from dmenu_run (it's ugly but works)
|
||||||
if [ "$shell" = "/bin/sh" ]; then
|
elif [ ! "$shell" = "/bin/sh" ]; then
|
||||||
file="$( du -a $document_dirs | awk '{for(i=2; i<NF; i++){printf("%s ", $i)}printf("%s\n", $NF)}'| dmenu -l 10 -p 'open what file?' -it "$*" )"
|
|
||||||
[ -z "$file" ] && exit
|
|
||||||
cd "$( dirname "$file" )" || exit
|
|
||||||
if rifle -l "$file" | head -n1 | grep -q 'EDITOR';then
|
|
||||||
st rifle "$file"
|
|
||||||
else
|
|
||||||
rifle "$file"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
currentdir="$(pwd)"
|
currentdir="$(pwd)"
|
||||||
file="$( du -a $document_dirs | awk '{for(i=2; i<NF; i++){printf("%s ", $i)}printf("%s\n", $NF)}' | fzf -e --query="$*")"
|
file="$( du -a $document_dirs | awk '{for(i=2; i<NF; i++){printf("%s ", $i)}printf("%s\n", $NF)}' | fzf -e --query="$*")"
|
||||||
[ -z "$file" ] && exit
|
[ -z "$file" ] && exit
|
||||||
@ -25,4 +19,16 @@ else
|
|||||||
rifle "$file" & disown
|
rifle "$file" & disown
|
||||||
fi
|
fi
|
||||||
cd "$currentdir" || exit
|
cd "$currentdir" || exit
|
||||||
|
exit
|
||||||
|
#launch dmenu as it's probably in dmenu_run
|
||||||
|
else
|
||||||
|
file="$( du -a $document_dirs | awk '{for(i=2; i<NF; i++){printf("%s ", $i)}printf("%s\n", $NF)}'| dmenu -l 10 -p 'open what file?' -it "$*" )"
|
||||||
|
fi
|
||||||
|
#process selection if it's from dmenu
|
||||||
|
[ -z "$file" ] && exit
|
||||||
|
cd "$( dirname "$file" )" || exit
|
||||||
|
if rifle -l "$file" | head -n1 | grep -q 'EDITOR';then
|
||||||
|
st rifle "$file"
|
||||||
|
else
|
||||||
|
rifle "$file"
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user