diff --git a/rand-game b/rand-game new file mode 100755 index 0000000..9fe7b45 --- /dev/null +++ b/rand-game @@ -0,0 +1,9 @@ +#!/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") + +answer=$(printf "yes\nno" | dmenu -p "Want to play $name?") + +[ "$answer" = "yes" ] && eval "$exec" || exit