Skip to content

Instantly share code, notes, and snippets.

@omgmog
Last active May 30, 2019 13:29
Show Gist options
  • Save omgmog/f1a0277bfa925e6c202680e1df14a7e4 to your computer and use it in GitHub Desktop.
Save omgmog/f1a0277bfa925e6c202680e1df14a7e4 to your computer and use it in GitHub Desktop.
Generate list of games for JWM menu (http://joewing.net/projects/jwm/) on PocketCHIP
<!-- Example Menu in .jwmrc config-->
<!-- ... -->
<Menu label="GBA Games" icon="gba.png">
<Include>exec:$HOME/.scripts/gen_menu_items.sh gba vba</Include>
</Menu>
<Menu label="NES Games" icon="nes.png">
<Include>exec:$HOME/.scripts/gen_menu_items.sh nes nestopia</Include>
</Menu>
#!/bin/sh
romtype=${1}
emulator=${2}
echo "<JWM>"
find $HOME/Roms -type f -name "*.$romtype" -print0 |
while IFS= read -r -d '' r; do
echo "<Program label=\"$(basename "${r%.*}")\">$emulator \"$r\"</Program>"
done
echo "</JWM>"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment