zellij icon indicating copy to clipboard operation
zellij copied to clipboard

Zellij run multiple panels in background

Open agreedSkiing opened this issue 5 months ago • 2 comments

Don't know how to word this, so. I would like to be able to start X amount of panes in the background and then attach to that session.

Example script:

#!/usr/bin/env bash
set -xeu
SLEEP_DURATION="1s"
ZELLIJ_SESSION="test-zellij"
COUNTER=0

zellij kill-session "${ZELLIJ_SESSION}" && zellij delete-session "${ZELLIJ_SESSION}"
sleep "$SLEEP_DURATION"
zellij attach -bc "${ZELLIJ_SESSION}"
sleep "$SLEEP_DURATION"

until [ "${COUNTER}" -gt 5 ]; do
    zellij -s "${ZELLIJ_SESSION}" run --name "panel ${COUNTER}" -- yes
    COUNTER=$((COUNTER + 1))
    sleep "${SLEEP_DURATION}"
done

zellij attach "${ZELLIJ_SESSION}"

Currently this results in

Image

agreedSkiing avatar Jun 10 '25 07:06 agreedSkiing

I'm not 100% sure what you're trying to do, but you might want to take a look at layouts: https://zellij.dev/documentation/layouts

imsnif avatar Jun 10 '25 13:06 imsnif

Message ID: @.***>Right, so I'm trying to spawn multiple processes with the run command whilst not being attached to the session. This currently fails if I'm not in the session. If I'm in the session and use the until loop then it starts all the yes processes. 

agreedSkiing avatar Jun 10 '25 14:06 agreedSkiing