Updated README and starting on more complex rofi script
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
# TO BE NAMED
|
# TO BE NAMED
|
||||||
|
|
||||||
A quicker way to search up Magic the Gathering (TM) cards (no images).
|
A quick way to search up Magic the Gathering (TM) cards for Linux (maybe MacOS? Don't have one, so haven't tried).
|
||||||
|
|
||||||
|
Currently, no images are displayed - so don't go into this expecting that.
|
||||||
|
|
||||||
## The Components
|
## The Components
|
||||||
|
|
||||||
@@ -25,13 +27,34 @@ Very annoyingly, the Ubuntu repos do *not* have this version. They have an earli
|
|||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
*TODO*
|
**TODO**
|
||||||
|
|
||||||
## Installation
|
## Installation, First Usage, and Updating
|
||||||
|
|
||||||
|
|
||||||
|
### Installation
|
||||||
I am sorry in advance, this is a bit of a pain becuase of my lack of knowledge on how to properly "package" scripts alongside a rust binary.
|
I am sorry in advance, this is a bit of a pain becuase of my lack of knowledge on how to properly "package" scripts alongside a rust binary.
|
||||||
|
|
||||||
*TODO*
|
**TODO - don't forget that I need to install sqlite3-lib/dev/something - or maybe I add the feature flag "bundled"**
|
||||||
|
|
||||||
|
## Before you use this
|
||||||
|
|
||||||
|
## Update
|
||||||
|
Basically the same as the "Before you use this" secion. Go to the [Scryfall Bulk Download](https://scryfall.com/docs/api/bulk-data) page and get the Oracle Cards download.
|
||||||
|
|
||||||
|
Then run the `update_with_rofi.sh` script, locate the downloaded file, and it should Just Work (TM). If not, try updating this repo. If it still doesn't work, log a ticket. It's probably going to something with Scryfall updating their schema that I haven't accounted for.
|
||||||
|
|
||||||
|
Alternatively, run `COMMAND --update <path to file>` where `<path to file>` is the full path to where you downloaded the file.
|
||||||
|
|
||||||
|
This will delete the previous db - that shouldn't be a problem though, because you shouldn't use that unless you really know what you're doing.
|
||||||
|
|
||||||
|
## Why this exists
|
||||||
|
|
||||||
|
I often watch Magic the Gathering (TM) videos while coding, working, writing, whatever, and, often, I don't know what card they're talking about. They'll often say the card name (sometimes a nickname - this doesn't help with that), and show it on the screen briefly (or in a tiny/obscured view), and I'll miss what it actually does. When this happens, I need to open a tab on my browser, go to [Scryfall](scryfall.com), type in the name, (sometimes) click the specific card, and the view it. This takes 2-3 page loads, changing my active window and just a bit of a pain.
|
||||||
|
|
||||||
|
This tool, especially using `rofi` enables me to hit `Ctrl+M`, type in the card name, navigate to the card (if needed) with my keyboard, and display the card. No browser, no HTTP, lower context switch, displayed right there, and goes away when I press anything else.
|
||||||
|
|
||||||
|
The idea is it's just easier and quicker than my normal process.
|
||||||
|
|
||||||
## How I Installed `rofi`
|
## How I Installed `rofi`
|
||||||
If you're smarter than me, just follow the official docs: https://github.com/davatorium/rofi/blob/next/INSTALL.md and don't bother reading this.
|
If you're smarter than me, just follow the official docs: https://github.com/davatorium/rofi/blob/next/INSTALL.md and don't bother reading this.
|
||||||
@@ -66,3 +89,17 @@ Fingers crossed that all compiled and stuff... then copy the bin
|
|||||||
```
|
```
|
||||||
cp build/rofi ~/bin
|
cp build/rofi ~/bin
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## TODO & Features That Could be Good
|
||||||
|
* Misspelled cards, if only 1 hit that makes sense, could just work
|
||||||
|
* Display the actual card image (probably won't do this)
|
||||||
|
* Some kind of auto-magic direct link between the return codes set out in `main.r`s and the `rofi` scripts. Currently I need to manually make sure they're the same between the `rust` code and the `sh` code.
|
||||||
|
I'm guessing would involve cargo build scripts (or just a find+replace?)
|
||||||
|
|
||||||
|
## Thanks
|
||||||
|
|
||||||
|
This project really is just 95% based on Scryfall. They're amazing. I don't know how or why they exist, but I think they're basically the best Magic the Gathering (TM) resource online.
|
||||||
|
|
||||||
|
Of course `rofi` for providing the quick, simple, low-weight, and well documented tool. Particularly the quickness and low-weight which made it really possible. The alternative was opening terminal windows, or using TKinter or something... surely not worth it.
|
||||||
|
|
||||||
|
Thanks to all the amazing `rust` packages I use.
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
CARDS=$(/home/arthurr/code/mini_projects/scryfall_deser/target/debug/scryfall_deser $@)
|
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
|
SELECTION=$(rofi -dmenu -i << EOF
|
||||||
$CARDS
|
$CARDS
|
||||||
@@ -15,3 +19,5 @@ CARD_OUTPUT=$(/home/arthurr/code/mini_projects/scryfall_deser/target/debug/scryf
|
|||||||
sleep 0.05
|
sleep 0.05
|
||||||
|
|
||||||
rofi -e "$CARD_OUTPUT"
|
rofi -e "$CARD_OUTPUT"
|
||||||
|
|
||||||
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user