2022-09-13 01:06:55 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
# ***This script was made by Clay Gomera (Drake)***
|
2022-12-20 00:15:21 +00:00
|
|
|
# - Description: A simple script for file editing in dmenu
|
2023-09-04 17:36:18 +00:00
|
|
|
# - Dependencies: dmenu, fd
|
2022-09-13 01:06:55 +00:00
|
|
|
|
2023-09-04 17:36:18 +00:00
|
|
|
##########
|
|
|
|
## main ##
|
|
|
|
##########
|
2022-09-13 01:06:55 +00:00
|
|
|
cd "$HOME" || exit 0
|
|
|
|
file=1
|
|
|
|
while [ "$file" ]; do
|
2023-06-24 17:00:22 +00:00
|
|
|
file=$(fd -LHpd 1 | dmenu -i -l 10 -p " Open file in text editor $(basename "$(pwd)")")
|
2022-09-13 01:06:55 +00:00
|
|
|
if [ -e "$file" ]; then
|
|
|
|
owd=$(pwd)
|
|
|
|
if [ -d "$file" ]; then
|
|
|
|
cd "$file" || exit 0
|
|
|
|
else [ -f "$file" ]
|
|
|
|
if [ "$file" ]; then
|
2023-09-04 17:36:18 +00:00
|
|
|
$VISUAL "$owd/$file" & # $VISUAL reffers to a global variable set in .xinitrc/.bash_profile
|
2022-09-13 01:06:55 +00:00
|
|
|
exit 0
|
|
|
|
else
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|