From c88f1458618e6dd82ae04ea8e9dcad009488966a Mon Sep 17 00:00:00 2001 From: Peter Feerick Date: Mon, 22 Dec 2025 22:38:11 +0000 Subject: [PATCH 1/6] feat: allow launching simulator from appImage --- companion/src/CMakeLists.txt | 11 +++++++++++ companion/targets/linux/AppRun.in | 27 +++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 companion/targets/linux/AppRun.in diff --git a/companion/src/CMakeLists.txt b/companion/src/CMakeLists.txt index 2fdfedd2e8a..42604efbf33 100644 --- a/companion/src/CMakeLists.txt +++ b/companion/src/CMakeLists.txt @@ -325,6 +325,17 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux") install(TARGETS ${SIMULATOR_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}) + # configure custom AppRun script from template + configure_file(${COMPANION_TARGETS_DIR}/AppRun.in ${CMAKE_BINARY_DIR}/AppDir/AppRun @ONLY + ) + + # Make it executable + file(CHMOD ${CMAKE_BINARY_DIR}/AppDir/AppRun + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE + GROUP_READ GROUP_EXECUTE + WORLD_READ WORLD_EXECUTE + ) + # configure and set variables used by package script set(COMPANION_DESKTOP_FILE ${CMAKE_CURRENT_BINARY_DIR}/${COMPANION_NAME}.desktop) configure_file(${COMPANION_TARGETS_DIR}/companion.desktop.in ${COMPANION_DESKTOP_FILE} @ONLY) diff --git a/companion/targets/linux/AppRun.in b/companion/targets/linux/AppRun.in new file mode 100644 index 00000000000..1a20602320a --- /dev/null +++ b/companion/targets/linux/AppRun.in @@ -0,0 +1,27 @@ +#!/bin/bash + +APPDIR="$(dirname "$(readlink -f "$0")")" +CALLED_AS="$(basename "$0")" + +# Check if called via symlink with "simulator" in name +if [[ "$CALLED_AS" == *"simulator"* ]]; then + exec "${APPDIR}/usr/bin/@SIMULATOR_NAME@" "$@" +fi + +# Check for command-line parameter +case "$1" in + --simulator) + shift + exec "${APPDIR}/usr/bin/@SIMULATOR_NAME@" "$@" + ;; + --help) + echo "Usage: $0 [OPTIONS]" + echo " (no options) Launch Companion" + echo " --simulator Launch Simulator" + echo " Or create a symlink with 'simulator' in the name" + exit 0 + ;; + *) + exec "${APPDIR}/usr/bin/@COMPANION_NAME@" "$@" + ;; +esac From 01a34d84cf2190baa9ae6f0a242b91bcd33c3446 Mon Sep 17 00:00:00 2001 From: Peter Feerick Date: Tue, 23 Dec 2025 01:11:04 +0000 Subject: [PATCH 2/6] fix: use custom AppRun And hopefully also install simulator usable desktop icon if AppImage integration enabled --- companion/targets/linux/CPackLinuxDeploy.cmake.in | 2 +- companion/targets/linux/simulator.desktop.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/companion/targets/linux/CPackLinuxDeploy.cmake.in b/companion/targets/linux/CPackLinuxDeploy.cmake.in index af076ef4cf8..95cc9f52aca 100644 --- a/companion/targets/linux/CPackLinuxDeploy.cmake.in +++ b/companion/targets/linux/CPackLinuxDeploy.cmake.in @@ -4,5 +4,5 @@ execute_process(COMMAND @CMAKE_MAKE_PROGRAM@ DESTDIR=@APPIMAGE_DIR@ install # This is done by cmake install target # setup Companion application # add -v0 to linuxdeploy for debug info -execute_process(COMMAND env LDAI_NO_APPSTREAM=1 @LINUXDEPLOY_APP@ --appdir @APPIMAGE_DIR@ -e @COMPANION_NAME@ -d @COMPANION_DESKTOP_FILE@ --plugin qt --output appimage +execute_process(COMMAND env LDAI_NO_APPSTREAM=1 @LINUXDEPLOY_APP@ --appdir @APPIMAGE_DIR@ -e @COMPANION_NAME@ -d @COMPANION_DESKTOP_FILE@ -d @SIMULATOR_DESKTOP_FILE@ --custom-apprun @CMAKE_BINARY_DIR@/AppDir/AppRun --plugin qt --output appimage WORKING_DIRECTORY @CMAKE_BINARY_DIR@) diff --git a/companion/targets/linux/simulator.desktop.in b/companion/targets/linux/simulator.desktop.in index a86cb95765c..e37d18e82c1 100644 --- a/companion/targets/linux/simulator.desktop.in +++ b/companion/targets/linux/simulator.desktop.in @@ -4,7 +4,7 @@ Name=EdgeTX Simulator @VERSION@ GenericName=Transmitter Simulator App Comment=The Ultimate Transmitter Simulator Icon=@COMPANION_NAME@ -Exec=@SIMULATOR_NAME@ +Exec=@COMPANION_NAME@ --simulator Terminal=false StartupNotify=false Categories=Utility; From b2c85344a1bd44ccf71b0f082a5c079d39713bee Mon Sep 17 00:00:00 2001 From: Peter Feerick Date: Tue, 23 Dec 2025 01:19:19 +0000 Subject: [PATCH 3/6] chore: adding dependency check for simulator Probably not, but it should help more than it hurts if something changes in the future --- companion/targets/linux/CPackLinuxDeploy.cmake.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/companion/targets/linux/CPackLinuxDeploy.cmake.in b/companion/targets/linux/CPackLinuxDeploy.cmake.in index 95cc9f52aca..0a32e44bd4d 100644 --- a/companion/targets/linux/CPackLinuxDeploy.cmake.in +++ b/companion/targets/linux/CPackLinuxDeploy.cmake.in @@ -4,5 +4,5 @@ execute_process(COMMAND @CMAKE_MAKE_PROGRAM@ DESTDIR=@APPIMAGE_DIR@ install # This is done by cmake install target # setup Companion application # add -v0 to linuxdeploy for debug info -execute_process(COMMAND env LDAI_NO_APPSTREAM=1 @LINUXDEPLOY_APP@ --appdir @APPIMAGE_DIR@ -e @COMPANION_NAME@ -d @COMPANION_DESKTOP_FILE@ -d @SIMULATOR_DESKTOP_FILE@ --custom-apprun @CMAKE_BINARY_DIR@/AppDir/AppRun --plugin qt --output appimage +execute_process(COMMAND env LDAI_NO_APPSTREAM=1 @LINUXDEPLOY_APP@ --appdir @APPIMAGE_DIR@ -e @COMPANION_NAME@ -e @SIMULATOR_NAME@ -d @COMPANION_DESKTOP_FILE@ --custom-apprun @CMAKE_BINARY_DIR@/AppDir/AppRun --plugin qt --output appimage WORKING_DIRECTORY @CMAKE_BINARY_DIR@) From 293840f2d198f80c58545757ba34536e16183fd0 Mon Sep 17 00:00:00 2001 From: Peter Feerick Date: Tue, 23 Dec 2025 02:50:33 +0000 Subject: [PATCH 4/6] fix: detect symlink name properly Also make symlink processing case insensitive --- companion/targets/linux/AppRun.in | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/companion/targets/linux/AppRun.in b/companion/targets/linux/AppRun.in index 1a20602320a..89419b7027e 100644 --- a/companion/targets/linux/AppRun.in +++ b/companion/targets/linux/AppRun.in @@ -1,10 +1,13 @@ #!/bin/bash -APPDIR="$(dirname "$(readlink -f "$0")")" -CALLED_AS="$(basename "$0")" +# ARGV0 is what the AppImage was called as (includes symlink name) +# APPDIR is set by AppImage runtime to the mount point +CALLED_AS="$(basename "${ARGV0}")" + +CALLED_AS_LOWER="${CALLED_AS,,}" # converts to lowercase # Check if called via symlink with "simulator" in name -if [[ "$CALLED_AS" == *"simulator"* ]]; then +if [[ "$CALLED_AS_LOWER" == *"simulator"* ]]; then exec "${APPDIR}/usr/bin/@SIMULATOR_NAME@" "$@" fi From 8d7f954b393bf87c2fa60cac44bdc48f048e18a8 Mon Sep 17 00:00:00 2001 From: Peter Feerick Date: Tue, 23 Dec 2025 02:55:29 +0000 Subject: [PATCH 5/6] feat: add more help/routing info --- companion/targets/linux/AppRun.in | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/companion/targets/linux/AppRun.in b/companion/targets/linux/AppRun.in index 89419b7027e..e8bd5ba03b3 100644 --- a/companion/targets/linux/AppRun.in +++ b/companion/targets/linux/AppRun.in @@ -18,13 +18,36 @@ case "$1" in exec "${APPDIR}/usr/bin/@SIMULATOR_NAME@" "$@" ;; --help) - echo "Usage: $0 [OPTIONS]" + echo "EdgeTX Companion @VERSION@ AppImage" + echo "" + echo "AppImage Options:" + echo " --simulator Launch Simulator instead" + echo " --apprun-help Show AppImage routing help" + echo "" + echo "Companion Help:" + exec "${APPDIR}/usr/bin/@COMPANION_NAME@" --help + ;; + --apprun-help) + echo "EdgeTX Companion AppImage Usage: $0 [OPTIONS]" + echo "" + echo "Routing Options:" echo " (no options) Launch Companion" echo " --simulator Launch Simulator" - echo " Or create a symlink with 'simulator' in the name" + echo " --help Show Companion help (with AppImage options)" + echo " --apprun-help Show this AppImage routing help only" + echo "" + echo "Symlink Usage:" + echo " Create a symlink with 'simulator' in the name to launch Simulator:" + echo " ln -s @COMPANION_NAME@.AppImage @SIMULATOR_NAME@.AppImage" + echo " ./@SIMULATOR_NAME@.AppImage" + echo "" + echo "Examples:" + echo " $0 # Launch Companion" + echo " $0 --simulator # Launch Simulator" + echo " $0 --simulator --help # Show Simulator help" exit 0 ;; *) exec "${APPDIR}/usr/bin/@COMPANION_NAME@" "$@" ;; -esac +esac \ No newline at end of file From 236d6a6ba175b03b3fbc1d59e18bbc2eced63920 Mon Sep 17 00:00:00 2001 From: Peter Feerick Date: Tue, 23 Dec 2025 02:57:00 +0000 Subject: [PATCH 6/6] chore: formatting --- companion/targets/linux/AppRun.in | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/companion/targets/linux/AppRun.in b/companion/targets/linux/AppRun.in index e8bd5ba03b3..bf46d159d75 100644 --- a/companion/targets/linux/AppRun.in +++ b/companion/targets/linux/AppRun.in @@ -3,7 +3,6 @@ # ARGV0 is what the AppImage was called as (includes symlink name) # APPDIR is set by AppImage runtime to the mount point CALLED_AS="$(basename "${ARGV0}")" - CALLED_AS_LOWER="${CALLED_AS,,}" # converts to lowercase # Check if called via symlink with "simulator" in name @@ -50,4 +49,4 @@ case "$1" in *) exec "${APPDIR}/usr/bin/@COMPANION_NAME@" "$@" ;; -esac \ No newline at end of file +esac