1
0
Fork 0
mirror of https://github.com/pnx/dotfiles synced 2026-06-16 11:24:55 +02:00
dotfiles/scripts/zs

20 lines
409 B
Bash
Executable file

#!/usr/bin/env bash
LAYOUT=code
if [[ $# -eq 1 ]]; then
selected=$(realpath $1)
else
DIRECTORIES=$(cat ~/.tmuxs | sed "s&^\~&${HOME}&g")
selected=$(find ${DIRECTORIES} -mindepth 1 -maxdepth 1 -type d | fzf)
fi
if [[ -z $selected ]]; then
exit 0
fi
selected_name=$(basename "$selected" | tr . _)
zellij --layout "$LAYOUT" \
attach -c "$selected_name" \
options --default-cwd "$selected"