helper-scripts/zellij-ps.fish

23 lines
577 B
Fish
Raw Normal View History

2024-03-20 05:57:37 +01:00
#!/usr/bin/env fish
# This is a small zellij project switcher
#
# Please add additiones folders to the folders variable
set folders ~/projects ~/Projekte
if count $argv > 1
set selected $argv[1]
else
set selected (fd --type d --max-depth 1 . $folders | fzf)
end
set selected_name (basename "$selected" | tr . _)
set zellij_running (pgrep -c zellij)
if test -n "$ZELLIJ_SESSION_NAME"
echo -e "You are in a Zellij Session!\nPlease use the session manager to switch sessions.">&2
else
cd $selected; zellij --layout prog attach -c $selected_name options
end