From 829052147b56e9f84860442cd36ce7158d77e5f8 Mon Sep 17 00:00:00 2001 From: CronyAkatsuki Date: Sun, 10 Dec 2023 18:54:28 +0100 Subject: [PATCH] random game from cartridges. --- rand-game | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100755 rand-game 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