diff --git a/.codex/skills/linux-game-manager-dev/references/core-map.md b/.codex/skills/linux-game-manager-dev/references/core-map.md index 75d0c85..49bb12f 100644 --- a/.codex/skills/linux-game-manager-dev/references/core-map.md +++ b/.codex/skills/linux-game-manager-dev/references/core-map.md @@ -39,6 +39,7 @@ python3 .codex/skills/linux-game-manager-dev/scripts/audit_game_catalog.py - `game_launcher` enumerates `.launch/*.sh` entries. - Entries with first line `#//` are skipped. - Selected launcher is sourced/executed. +- Text-terminal launchers can fall back to `xterm`, which inherits the requested working directory before executing the game command. 3. **Removal flow** - `game_removal` resolves launcher entry to real script. @@ -57,7 +58,7 @@ python3 .codex/skills/linux-game-manager-dev/scripts/audit_game_catalog.py - `-u`: update game - `-t`: show number of available games - `-C`: clear cache -- `-D`: create desktop launcher +- `-D`: create desktop launcher; terminal discovery includes `xterm`, using its `-T` title option instead of `-t` - `-L`: show license - `-h`: show help - `-N`: enable no-cache mode diff --git a/linux-game-manager.sh b/linux-game-manager.sh index 1b99300..f33002f 100755 --- a/linux-game-manager.sh +++ b/linux-game-manager.sh @@ -381,13 +381,23 @@ terminal_emulator() { # Arguments workingDirectory, rest of arguments local workingDir="$1" shift - terminals=( + local -a terminals=( "lxterminal" "mate-terminal" "gnome-terminal" + "xterm" ) for i in "${terminals[@]}" ; do - if command $i --working-directory="${workingDir}" -e "$@" ; then + if ! command -v "$i" > /dev/null 2>&1 ; then + continue + fi + if [[ "$i" == "xterm" ]]; then + if (cd "${workingDir}" && command xterm -e "$@"); then + return + fi + continue + fi + if command "$i" --working-directory="${workingDir}" -e "$@" ; then return fi done @@ -415,14 +425,18 @@ desktop_launcher() { local launchDirectory local terminal # Try to find an accessible terminal - for i in mate-terminal lxterminal terminator gnome-terminal ; do + for i in mate-terminal lxterminal terminator gnome-terminal xterm ; do if command -v $i > /dev/null 2>&1 ; then terminal="$i" break fi done launchDirectory="${scriptRoot}" - printf -v execLine "Exec=%s -t \"Linux Game Manager\" -e \"/usr/bin/bash -c 'pushd %q;nohup ./%q 2> /dev/null'\"" "${terminal}" "${launchDirectory}" "${0##*/}" + if [[ "${terminal}" == "xterm" ]]; then + printf -v execLine "Exec=xterm -T \"Linux Game Manager\" -e /usr/bin/bash -c \"pushd %q;nohup ./%q 2> /dev/null\"" "${launchDirectory}" "${0##*/}" + else + printf -v execLine "Exec=%s -t \"Linux Game Manager\" -e \"/usr/bin/bash -c 'pushd %q;nohup ./%q 2> /dev/null'\"" "${terminal}" "${launchDirectory}" "${0##*/}" + fi dotDesktop=('[Desktop Entry]' 'Name=Linux game manager' 'GenericName=Linux game Manager'