Added a wrapper script...
... to the wrapp script around the ... binary For the purposes of allow me to add a nice shortcut for my window manager
This commit is contained in:
@@ -1,64 +1,4 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# Note to self in this... The whitespace seemed to fuck the ifs up. Not sure why.
|
SEARCH_STRING=$(rofi -dmenu)
|
||||||
# This is why it's all flat and ugly
|
/home/arthurr/code/mini_projects/scryfall_deser/scripts/search_with_rofi_with_args.sh $SEARCH_STRING
|
||||||
|
|
||||||
CARDS=$(/home/arthurr/code/mini_projects/scryfall_deser/target/debug/scryfall_deser $@)
|
|
||||||
RETURN=$?
|
|
||||||
echo $RETURN
|
|
||||||
|
|
||||||
#######################
|
|
||||||
## Cards to select from
|
|
||||||
#######################
|
|
||||||
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
|
|
||||||
|
|
||||||
##########################
|
|
||||||
## Not even one card that matched - try a close string
|
|
||||||
##########################
|
|
||||||
if [ $RETURN -eq 105 ]; then
|
|
||||||
|
|
||||||
# TODO do something different with no matching string at all - perhaps even a different ExitCode?
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
###############################
|
|
||||||
## No seach string input at all
|
|
||||||
###############################
|
|
||||||
if [ $RETURN -eq 101 ]; then
|
|
||||||
|
|
||||||
rofi -e "No search string found"
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|||||||
64
scryfall_deser/scripts/search_with_rofi_with_args.sh
Executable file
64
scryfall_deser/scripts/search_with_rofi_with_args.sh
Executable file
@@ -0,0 +1,64 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Note to self in this... The whitespace seemed to fuck the ifs up. Not sure why.
|
||||||
|
# This is why it's all flat and ugly
|
||||||
|
|
||||||
|
CARDS=$(/home/arthurr/code/mini_projects/scryfall_deser/target/debug/scryfall_deser $@)
|
||||||
|
RETURN=$?
|
||||||
|
echo $RETURN
|
||||||
|
|
||||||
|
#######################
|
||||||
|
## Cards to select from
|
||||||
|
#######################
|
||||||
|
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
|
||||||
|
|
||||||
|
##########################
|
||||||
|
## Not even one card that matched - try a close string
|
||||||
|
##########################
|
||||||
|
if [ $RETURN -eq 105 ]; then
|
||||||
|
|
||||||
|
# TODO do something different with no matching string at all - perhaps even a different ExitCode?
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
###############################
|
||||||
|
## No seach string input at all
|
||||||
|
###############################
|
||||||
|
if [ $RETURN -eq 101 ]; then
|
||||||
|
|
||||||
|
rofi -e "No search string found"
|
||||||
|
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user