added two scripts for zellij

This commit is contained in:
eeleater 2024-09-27 19:01:08 +02:00
parent 9d21258b7b
commit fd47b9e969
2 changed files with 18 additions and 0 deletions

View file

@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -euo pipefail
ZJ_LAYOUT_DIR=$(zellij setup --check | grep "LAYOUT DIR" - | grep -o '".*"' - | tr -d '"')
if [[ -d "${ZJ_LAYOUT_DIR}" ]]; then
ZJ_LAYOUT="$(fd --type file . "${ZJ_LAYOUT_DIR}" | sed 's|.*/||' | fzf || exit)"
zellij --layout "${ZJ_LAYOUT}"
fi

View file

@ -0,0 +1,10 @@
#!/usr/bin/env bash
ZJ_SESSIONS=$(zellij list-sessions)
NO_SESSIONS=$(echo "${ZJ_SESSIONS}" | wc -l)
if [ "${NO_SESSIONS}" -ge 2 ]; then
zellij attach \
"$(echo "${ZJ_SESSIONS}" | fzf)"
else
zellij attach -c
fi