34 lines
888 B
Bash
34 lines
888 B
Bash
|
#!/usr/bin/env bash
|
||
|
|
||
|
SRC_BASE="/home/nate/source"
|
||
|
|
||
|
DIRECTORIES=$(fd -a -L -d 1 -t d . $SRC_BASE -x basename {};)
|
||
|
DIR=$(echo "$DIRECTORIES" | wofi --style="$HOME"/.config/wofi/style.widgets.css --conf="$HOME"/.config/wofi/config.screenshot 2>/dev/null)
|
||
|
FULL_DIR=$(eval echo "$SRC_BASE/$DIR")
|
||
|
|
||
|
# Check if a directory is non empty
|
||
|
if [[ $(basename "$FULL_DIR") == $(basename "$SRC_BASE") ]]; then
|
||
|
exit 0
|
||
|
fi
|
||
|
|
||
|
foot --working-directory="$FULL_DIR" >/dev/null 2>&1 &
|
||
|
sleep 0.2
|
||
|
|
||
|
FFLINKS_FILE="$FULL_DIR/.fflinks"
|
||
|
|
||
|
# If there is an .fflinks file
|
||
|
if [[ -f "$FFLINKS_FILE" ]]; then
|
||
|
swaymsg "splitv"
|
||
|
URLS=$(awk '{ printf "\"%s\" ", $0 }' $FFLINKS_FILE)
|
||
|
echo "$URLS" | xargs firefox &
|
||
|
sleep 0.2
|
||
|
# firefox $URLS
|
||
|
fi
|
||
|
|
||
|
swaymsg "focus parent; splith"
|
||
|
foot --working-directory="$FULL_DIR" >/dev/null 2>&1 &
|
||
|
|
||
|
# Convert the ~ to the full path
|
||
|
|
||
|
# Open two foot terminals in the specified directory
|