zellij: more fix at opening terminal or connecting via ssh

This commit is contained in:
Tigor Hutasuhut 2024-07-26 14:36:44 +07:00
parent 5560bbb27f
commit 7742585d6e

View file

@ -18,10 +18,17 @@ in
ZELLIJ_AUTO_EXIT=true ZELLIJ_AUTO_EXIT=true
ZELLIJ_AUTO_ATTACH=${lib.boolToString cfg.autoAttach} ZELLIJ_AUTO_ATTACH=${lib.boolToString cfg.autoAttach}
if [[ -z "$ZELLIJ" ]]; then if [[ -z "$ZELLIJ" ]]; then
if [[ "$ZELLIJ_AUTO_ATTACH" == "true" ]]; then ZJ_SESSIONS=$(zellij list-sessions --no-formatting)
zellij attach -c default NO_SESSIONS=$(echo "$ZJ_SESSIONS" | wc -l)
if [ "$NO_SESSIONS" -ge 2 ]; then
SELECTED_SESSION=$(echo "$ZJ_SESSIONS" | ${pkgs.skim}/bin/sk | awk '{print $1}')
if [[ -n "''${SELECTED_SESSION// /}" ]]; then
zellij attach -c "$SELECTED_SESSION"
else else
zellij zellij attach -c --index 0
fi
else
zellij attach -c
fi fi
if [[ "$ZELLIJ_AUTO_EXIT" == "true" ]]; then if [[ "$ZELLIJ_AUTO_EXIT" == "true" ]]; then
@ -88,7 +95,7 @@ in
floating true floating true
move_to_focused_tab true move_to_focused_tab true
}; };
SwitchToMode "Normal" SwitchToMode "Normal";
} }
} }