Skip to content

Commit

Permalink
Auto replace home path in launch arguments for custom home dirs
Browse files Browse the repository at this point in the history
  • Loading branch information
Kron4ek authored Dec 29, 2023
1 parent 269c899 commit f669dbf
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion conty-start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand All @@ -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
Expand Down Expand Up @@ -795,7 +807,7 @@ run_bwrap () {
"${unshare_net[@]}" \
"${set_vars[@]}" \
--setenv PATH "${CUSTOM_PATH}" \
"$@"
"${command_line[@]}"
}

exit_function () {
Expand Down

0 comments on commit f669dbf

Please sign in to comment.