update zellij auto init

This commit is contained in:
Tigor Hutasuhut 2024-07-29 12:50:05 +07:00
parent 09202966e0
commit 4169038393

View file

@ -24,9 +24,9 @@ in
# The lib.mkOrder is used to ensure zellij is
# autoloaded first after zshenv.
programs.zsh.initExtraFirst = lib.mkOrder 50 (
/*bash*/ ''
ZELLIJ_AUTO_EXIT=true
ZELLIJ_AUTO_ATTACH=${lib.boolToString cfg.autoAttach}
if cfg.autoAttach then
/*bash*/
''
if [[ -z "$ZELLIJ" ]]; then
ZJ_SESSIONS=$(zellij list-sessions --no-formatting)
NO_SESSIONS=$(echo "$ZJ_SESSIONS" | wc -l)
@ -40,10 +40,14 @@ in
else
zellij attach -c
fi
if [[ "$ZELLIJ_AUTO_EXIT" == "true" ]]; then
exit
fi
''
else
/*bash*/ ''
if [[ -z "$ZELLIJ" ]]; then
zellij attach -c default
exit
fi
''
);