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