From f669dbfb297f3a49031c92957e0299126024f2eb Mon Sep 17 00:00:00 2001 From: Kron4ek Date: Fri, 29 Dec 2023 15:24:44 +0300 Subject: [PATCH] Auto replace home path in launch arguments for custom home dirs --- conty-start.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/conty-start.sh b/conty-start.sh index 18e9d6f..9a30fd7 100755 --- a/conty-start.sh +++ b/conty-start.sh @@ -608,6 +608,9 @@ run_bwrap () { unset non_standard_home unset xsockets unset mount_opt + unset command_line + + command_line=("${@}") if [ -n "${WAYLAND_DISPLAY}" ]; then wayland_socket="${WAYLAND_DISPLAY}" @@ -634,6 +637,15 @@ run_bwrap () { --setenv "HOME" "${NEW_HOME}" \ --setenv "XDG_CONFIG_HOME" "${NEW_HOME}"/.config \ --setenv "XDG_DATA_HOME" "${NEW_HOME}"/.local/share) + + unset command_line + for arg in "$@"; do + if [[ "${arg}" == *"${HOME}"* ]]; then + arg="$(echo "${arg/"$HOME"/"$NEW_HOME"}")" + fi + + command_line+=("${arg}") + done ;; esac fi @@ -795,7 +807,7 @@ run_bwrap () { "${unshare_net[@]}" \ "${set_vars[@]}" \ --setenv PATH "${CUSTOM_PATH}" \ - "$@" + "${command_line[@]}" } exit_function () {