Files
mini_projects/scryfall_deser/scripts/search_with_rofi.sh

45 lines
963 B
Bash
Executable File

#!/bin/sh
CARDS=$(/home/arthurr/code/mini_projects/scryfall_deser/target/debug/scryfall_deser $@)
RETURN=$?
echo $RETURN
if [ $RETURN -eq 0 ]; then
SELECTION=$(rofi -dmenu -i << EOF
$CARDS
EOF
)
CARD_OUTPUT=$(/home/arthurr/code/mini_projects/scryfall_deser/target/debug/scryfall_deser --exact $SELECTION)
# If you double check the first rofi selection it seems to prevent the error window from popping up
# I think this is because it registers the second click as a click outside the window which exits
# the rofi -e message
sleep 0.05
rofi -e "$CARD_OUTPUT"
fi
if [ $RETURN -eq 105 ]; then
SELECTION=$(rofi -dmenu -p "Did you mean?" -i << EOF
$CARDS
EOF
)
CARDS=$(/home/arthurr/code/mini_projects/scryfall_deser/target/debug/scryfall_deser $SELECTION)
SELECTION=$(rofi -dmenu -i << EOF
$CARDS
EOF
)
CARD_OUTPUT=$(/home/arthurr/code/mini_projects/scryfall_deser/target/debug/scryfall_deser --exact $SELECTION)
sleep 0.05
rofi -e "$CARD_OUTPUT"
fi