The package-installed paths live at /usr/share/omarchy; the script-install
paths live at ~/.local/share/omarchy. $OMARCHY_PATH is set by install.sh
during the install flow and by /etc/profile.d/omarchy.sh in package mode.
Scripts that hard-code the script-install path don't honour that and will
misbehave once shipped to /usr/bin.
16 files migrated via sed s|~/\.local/share/omarchy|$OMARCHY_PATH|g
and s|$HOME/\.local/share/omarchy|$OMARCHY_PATH|g:
bin/:
- omarchy-plymouth-{preview,reset,set}
- omarchy-refresh-{limine,plymouth}
- omarchy-reinstall-configs
- omarchy-show-logo
- omarchy-games-retro-install
- omarchy-install-gaming-battlenet
install/:
- config/branding.sh
- packaging/{fonts,icons}.sh
- post-install/{finished,pacman}.sh
- preflight/{migrations,pacman}.sh
Deliberately NOT migrated:
- bin/omarchy-dev-add-migration: uses 'cd ~/.local/share/omarchy' to
resolve a git repo for 'git log'. The packaged binary doesn't have a
git repo to read; this command only makes sense in dev mode where
the home path is the right one.
- bin/omarchy-install-browser:69: writes a string into a chromium
config file that chromium itself interprets; not a bash-resolved path.
- install/helpers/errors.sh:125: the boot.sh-style relaunch behaviour
needs a separate redesign.
77 lines
2.3 KiB
Bash
Executable File
77 lines
2.3 KiB
Bash
Executable File
#!/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 "$OMARCHY_PATH/applications/icons/Retro Gaming.png" "$icon_path"
|
|
|
|
cat >"$desktop_file" <<EOF
|
|
[Desktop Entry]
|
|
Version=1.0
|
|
Name=$desktop_name
|
|
Comment=Play $game_name with RetroArch
|
|
Exec=retroarch -L "$core_path" "$game_path"
|
|
Terminal=false
|
|
Type=Application
|
|
Icon=$icon_path
|
|
StartupNotify=true
|
|
Categories=Game;Emulator;
|
|
EOF
|
|
|
|
chmod +x "$desktop_file"
|
|
update-desktop-database "$desktop_dir" &>/dev/null || true
|
|
|
|
omarchy-notification-send -g "$game_name installed" "Start it with Super + Space"
|