dotfiles/.local/bin/tools/ce

19 lines
837 B
Plaintext
Raw Normal View History

2020-07-04 14:23:27 +02:00
#!/bin/bash
currentdir="$(pwd)"
#file="$( du -a ~/.config/* ~/.local/src/* ~/.local/bin/* | awk '{print $2}' | fzf -e --query="$*")"
#[ "$file" = "" ] || ( cd "$( dirname "$file" )" && $EDITOR "$file" && cd "$currentdir" )
ppid () { ps -p ${1:-$$} -o ppid=; }
shell="$(ps aux | grep $( ppid ) | head -n1 | awk '{print $11}' )"
#/bin/sh probably means we're in dmenu_run
if [ "$shell" = "/bin/sh" ]; then
file="$( du -a ~/.config/* ~/.local/src/* ~/.local/bin/* | awk '{print $2}' | dmenu -l 10 -p 'open what file?' )"
[ -z "$file" ] && exit
## NEEDS TO BE WORKED ON
cd "$( dirname "$file" )" && st $EDITOR "$file"
else
currentdir="$(pwd)"
file="$( du -a ~/.config/* ~/.local/src/* ~/.local/bin/* | awk '{print $2}' | fzf -e --query="$*")"
[ -z "$file" ] && exit
cd "$( dirname "$file" )" && rifle "$file" && cd "$currentdir"
fi