diff --git a/applications/icons/Retro Gaming.png b/applications/icons/Retro Gaming.png new file mode 100644 index 00000000..313172bc Binary files /dev/null and b/applications/icons/Retro Gaming.png differ diff --git a/bin/omarchy b/bin/omarchy index 28bca7fe..bcf820aa 100755 --- a/bin/omarchy +++ b/bin/omarchy @@ -40,6 +40,7 @@ GROUP_DESCRIPTIONS[default]="Default application selection" GROUP_DESCRIPTIONS[dev]="Omarchy development tools" GROUP_DESCRIPTIONS[drive]="Drive selection and encryption" GROUP_DESCRIPTIONS[font]="Font management" +GROUP_DESCRIPTIONS[games]="Game launchers and helpers" GROUP_DESCRIPTIONS[hibernation]="Hibernation setup and removal" GROUP_DESCRIPTIONS[hook]="User hook runner" GROUP_DESCRIPTIONS[hw]="Hardware detection and controls" diff --git a/bin/omarchy-games-retro-cores b/bin/omarchy-games-retro-cores new file mode 100755 index 00000000..a81e9bb0 --- /dev/null +++ b/bin/omarchy-games-retro-cores @@ -0,0 +1,39 @@ +#!/bin/bash + +# omarchy:summary=List installed RetroArch core names + +set -e + +core_dir="/usr/lib/libretro" +preferred_cores=( + "Amstrad CPC|cap32" + "Arcade FBNeo|fbneo" + "Arcade MAME|mame" + "Commodore Amiga|puae" + "Commodore C128|vice_x128" + "Commodore C64|vice_x64" + "Commodore VIC-20|vice_xvic" + "Nintendo DS|desmume" + "Nintendo Game Boy / Color|gambatte" + "Nintendo Game Boy Advance|mgba" + "Nintendo GameCube / Wii|dolphin" + "Nintendo NES / Famicom|mesen" + "Nintendo 64|parallel_n64" + "Nintendo SNES / SFC|snes9x" + "NEC PC Engine / TurboGrafx-16|mednafen_pce_fast" + "NEC PC Engine CD / TurboGrafx-CD|mednafen_pce" + "NEC PC Engine SuperGrafx|mednafen_supergrafx" + "Sega Dreamcast|flycast" + "Sega Mega Drive / Master System / Game Gear|genesis_plus_gx" + "Sega Saturn|kronos" + "Sony PlayStation|mednafen_psx_hw" + "Sony PlayStation Portable|ppsspp" +) + +[[ -d $core_dir ]] || exit 0 + +for preferred_core in "${preferred_cores[@]}"; do + label="${preferred_core%%|*}" + core="${preferred_core#*|}" + [[ -f $core_dir/${core}_libretro.so ]] && printf '%s (%s)\n' "$label" "$core" +done diff --git a/bin/omarchy-games-retro-install b/bin/omarchy-games-retro-install new file mode 100755 index 00000000..a5b0acb5 --- /dev/null +++ b/bin/omarchy-games-retro-install @@ -0,0 +1,76 @@ +#!/bin/bash + +# omarchy:summary=Create a desktop launcher for a RetroArch game +# 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 (( $# == 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 + +if [[ ! -f $game_path ]]; then + echo "Game not found: $game_path" + exit 1 +fi + +if [[ $core == */* ]]; then + core_path="$core" +else + core_path="/usr/lib/libretro/${core}_libretro.so" +fi + +if [[ ! -f $core_path ]]; then + echo "Core not found: $core_path" + exit 1 +fi + +game_name=$(printf '%s' "${game_path##*/}" | sed 's/\.[^.]*$//; s/[[:space:]]*([^)]*)//g; s/[[:space:]]\+/ /g; s/^ //; s/ $//' | perl -Mopen=locale -pe 's/(^|[[:space:]])([^[:space:]])/$1\U$2/g') +desktop_name="$game_name" +desktop_id=$(printf '%s' "$desktop_name" | tr '[:upper:]' '[:lower:]' | tr -cs '[:alnum:]' '-' | sed 's/^-//; s/-$//') +desktop_dir="$HOME/.local/share/applications" +desktop_file="$desktop_dir/$desktop_id.desktop" +icon_dir="$desktop_dir/icons" +icon_path="$icon_dir/Retro Gaming.png" + +mkdir -p "$desktop_dir" "$icon_dir" +[[ -f $icon_path ]] || cp "$HOME/.local/share/omarchy/applications/icons/Retro Gaming.png" "$icon_path" + +cat >"$desktop_file" </dev/null || true + +omarchy-notification-send -g "󰯉" "$game_name installed" "Start it with Super + Space" diff --git a/bin/omarchy-menu b/bin/omarchy-menu index d9583ec8..93908a5f 100755 --- a/bin/omarchy-menu +++ b/bin/omarchy-menu @@ -600,8 +600,9 @@ 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)") in + 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 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 ;;