Added zellij-toggle-autoload

This commit is contained in:
Lockszmith 2025-04-18 14:24:07 -04:00
parent 7f009ccadf
commit b988c72339
1 changed files with 18 additions and 3 deletions

View File

@ -32,7 +32,7 @@ if is_sourced; then
${SET_X-:} -x ${SET_X-:} -x
local bin_path=~/.local/bin/zellij local bin_path=~/.local/bin/zellij
local cached_path=~/.cache/chezmoi/tmp/zellij local cached_path=~/.cache/chezmoi/tmp/zellij
if [ -z "$(env which zellij)" ] && [ -x "${cached_path}" ]; then if [ -z "$(command -v zellij)" ] && [ -x "${cached_path}" ]; then
printf "Grabbing zellij from the web!\n" printf "Grabbing zellij from the web!\n"
cp "${cached_path}" "${bin_path}" cp "${cached_path}" "${bin_path}"
fi fi
@ -67,6 +67,20 @@ ${SET_X-:} -x
fi fi
} }
zellij-toggle-autoload() {
if [[ -n "$ZELLIJ_SESSION_NAME" ]]; then
if [[ "$ZELLIJ_SESSION_NAME" == "dont_load" ]]; then
unset ZELLIJ_SESSION_NAME
printf "ZELLIJ_SESSION_NAME was unset.\n"
else
printf "Seems like you're in a zellij session ('%s'), you must exit it first.\n" >&2
fi
else
export ZELLIJ_SESSION_NAME=dont_load
printf "ZELLIJ_SESSION_NAME was set, zellij will not start automatically.\n"
fi
}
zellij-mode() { zellij-mode() {
local BASE="config.kdl" ROOT=~/.config/zellij local BASE="config.kdl" ROOT=~/.config/zellij
local SRC="${BASE}.${1:?Mode missing}" local SRC="${BASE}.${1:?Mode missing}"
@ -104,3 +118,4 @@ else
fi fi
# vim: set ft=sh expandtab tabstop=4 shiftwidth=4: # vim: set ft=sh expandtab tabstop=4 shiftwidth=4: