You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You've inspired me to implement a random game chooser myself... not in the Cartridges code, but as a "game" I've added to Cartridges. This isn't exactly what you want, because it goes right ahead and launches the game rather than just showing what it chose, but...
The command it runs:
eval$(grep -EL '"name": "!!! RANDOM !!!"|"(hidden|removed)": true'~/.var/app/hu.kramo.Cartridges/data/cartridges/games/*.json | sort -R | head -n 1 | xargs grep -oP '"executable": "\K.+(?=",$)'| sed s/'\\"'/'"'/g)
Well, I thought it was funny. Use it at your own risk, of course. It's probably wise to assume eval $(some command that returns a string) can be dangerous. This particular command is meant to be only as dangerous as commands already added to Cartridges, but I never guarantee that code I write is bug-free.
@michaelneverwins I have went ahead and reddid your command into a simple script that just shows a dmenu prompt saying which game it choose and whether you wan't to play it or not.
I'm also using jq instead of grep since it does better job than regex and can easily output for games that have executable set as an array.
#!/bin/sh
random=$(jq 'select(.hidden != true) | select(.removed != true) | select(.name | contains("Proton") | not) | select(.name | contains("Steam") | not) | input_filename' -r $HOME/.local/share/cartridges/games/*.json | sort -R | head -n 1)
name=$(jq '.name' -r "$random")
exec=$(jq '.executable | if type == "array" then .[] end' -r "$random")echo$nameecho$exec
answer=$(printf "yes\nno"| dmenu -p "Want to play $name?")
[ "$answer"="yes" ] &&eval$exec||exit
You can replace dmenu with any other program, like zenity probably for example.
So I'm the kind of gamer that can't decide what to play and just keeps on either not playing anything or downloads yet another game to play.
One way that I used to do to beat this is to use the random game picker like the one that playnite has built in.
So is there a way for there to be implemented a feature for cartridges to randomly choose a game, doesnt need to start it but just to choose.
The text was updated successfully, but these errors were encountered: