load-zellij works with noexec /tmp

This commit is contained in:
Lockszmith (kateryna) 2024-05-20 07:10:58 -04:00
parent c386ab3ef7
commit b243ed34ff
1 changed files with 18 additions and 19 deletions

View File

@ -15,28 +15,26 @@ BASE_SHELL=$(basename "$SHELL")
if is_sourced; then
zellij() {
if [[ -x /tmp/zellij/bootstrap/zellij ]]; then
/tmp/zellij/bootstrap/zellij "${@}"
else
bash <(curl -sL zellij.dev/launch) "${@}"
if [[ ! -x ~/bin/zellij ]]; then
if [[ ! -x /tmp/zellij/bootstrap/zellij ]]; then
bash <(curl -sL zellij.dev/launch) "${@}" && return
fi
fi
if [[ -e /tmp/zellij/bootstrap/zellij ]]; then
mv /tmp/zellij/bootstrap/zellij ~/bin/zellij
fi
if [[ -x ~/bin/zellij ]]; then
~/bin/zellij "${@}"
fi
}
if [[ -z "$ZELLIJ_SESSION_NAME" ]]; then
# shellcheck disable=SC2210
#(zellij list-sessions 2&>1) > /dev/null || zellij attach -c "$USER@$(hostname)"
zellij attach -c "$USER@$(hostname)" || EXITCODE=$?
# shellcheck disable=SC2086 # EXITCODE might be empty
return $EXITCODE
fi
if [[ -z "$ZSH_VERSION" ]] || (type compdef > /dev/null 2>&1); then
# shellcheck disable=SC1090
. <( zellij setup --generate-completion "$BASE_SHELL" ) 2> /dev/null
}
. <( zellij setup --generate-completion "$BASE_SHELL" )
if [[ -z "$ZELLIJ_SESSION_NAME" ]]; then
(zellij list-sessions 2&>1) > /dev/null || zellij attach -c $USER@$(hostname)
fi
elif [[ "$1" == '-' ]]; then
echo "BASE_0=${BASE_0}"
cat "${0}"
cat "${BASH_SOURCE[0]}"
else
SCRIPT_NAME="$BASE_0"
printf '%s\n' \
@ -45,3 +43,4 @@ else
" $ . <( $SCRIPT_NAME - ) # Note the '-' after the script's name" \
''
fi