diff --git a/bin/omarchy-games-retro-install b/bin/omarchy-games-retro-install index fa9ac87b..c312c35b 100755 --- a/bin/omarchy-games-retro-install +++ b/bin/omarchy-games-retro-install @@ -1,20 +1,35 @@ #!/bin/bash # omarchy:summary=Create a desktop launcher for a RetroArch game -# omarchy:args= +# omarchy:args=[core path-to-game] # omarchy:examples=omarchy games retro install snes9x ~/Games/roms/snes/game.sfc | omarchy-games-retro-install /usr/lib/libretro/mgba_libretro.so ~/Games/roms/gba/game.gba set -e -if (( $# != 2 )); then - echo "Usage: omarchy-games-retro-install " +if (( $# == 0 )); then + mapfile -t cores < <(omarchy-games-retro-cores) + + if (( ${#cores[@]} == 0 )); then + omarchy-notification-send -g "" "No RetroArch cores found" "/usr/lib/libretro" + exit 1 + fi + + core=$(omarchy-menu-select "RetroArch core" "${cores[@]}") || exit 0 + [[ -n $core ]] || exit 0 + core="${core##*(}" + core="${core%)}" + + game_path=$(omarchy-menu-file "Retro game" "$HOME/Games/roms" "7z bin ccd chd cue dmg elf fds gb gba gbc iso lha m3u md n64 nds nes pbp sfc smc swc zip z64") || exit 0 + [[ -n $game_path ]] || exit 0 +elif (( $# == 2 )); then + core="$1" + game_path="$2" +else + echo "Usage: omarchy-games-retro-install [core path-to-game]" echo "Example: omarchy-games-retro-install snes9x ~/Games/roms/snes/game.sfc" exit 1 fi -core="$1" -game_path="$2" - if [[ ! -f $game_path ]]; then echo "Game not found: $game_path" exit 1 diff --git a/bin/omarchy-menu b/bin/omarchy-menu index 5322232d..8935ec0c 100755 --- a/bin/omarchy-menu +++ b/bin/omarchy-menu @@ -602,7 +602,7 @@ show_install_ai_menu() { show_install_gaming_menu() { case $(menu "Install" " Steam\n RetroArch\n󰍳 Minecraft\n󰢹 NVIDIA GeForce NOW\n Xbox Cloud Gaming\n󰂯 Xbox Controller\n󰍹 Moonlight (GameStream)\n Lutris (Battle.net)\n󱓟 Heroic (Epic Games)\n RetroArch Game Launcher") in *Steam*) present_terminal omarchy-install-gaming-steam ;; - *"RetroArch Game"*) install_retro_game ;; + *"RetroArch Game Launcher"*) omarchy-games-retro-install ;; *RetroArch*) present_terminal omarchy-install-gaming-retroarch ;; *Minecraft*) install_and_launch "Minecraft" "minecraft-launcher" "minecraft-launcher" ;; *GeForce*) present_terminal omarchy-install-gaming-geforce-now ;; @@ -615,25 +615,6 @@ show_install_gaming_menu() { esac } -install_retro_game() { - mapfile -t cores < <(omarchy-games-retro-cores) - - if (( ${#cores[@]} == 0 )); then - omarchy-notification-send -g "" "No RetroArch cores found" "/usr/lib/libretro" - return - fi - - core=$(omarchy-menu-select "RetroArch core" "${cores[@]}") || return - [[ -n $core ]] || return - core="${core##*(}" - core="${core%)}" - - game=$(omarchy-menu-file "Retro game" "$HOME/Games/roms" "7z bin ccd chd cue dmg elf fds gb gba gbc iso lha m3u md n64 nds nes pbp sfc smc swc zip z64") || return - [[ -n $game ]] || return - - omarchy-games-retro-install "$core" "$game" -} - show_install_style_menu() { case $(menu "Install" "󰸌 Theme\n Background\n Font") in *Theme*) present_terminal omarchy-theme-install ;;