-
-
Notifications
You must be signed in to change notification settings - Fork 666
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question: Is it possible to start a session with layout but detached immediately? #2090
Comments
This is a direly missing feature. Please prioritize its implementationas there is no other ways of achieving it. |
Came to Issues looking for exactly this. In my |
I'd like this too. My use-case is similar to @bnwa 's. My use-caseWith Tmux I use smug to have predefined layouts in YAML config files - one layout per-project. When I boot my computer I have a small tmux start-server
smug start logs --detach
smug start proxy --detach
smug start website --detach
smug start default-project --detach WorkaroundFor now I have a workaround of scripting my terminal app (wezterm) to process the right key-presses to start and then detach each session in series. My new #! /usr/bin/env bash
function start-session() {
local session_name="$1"
# Send Zellij cli to shell
wezterm cli send-text "zellij --layout $session_name --session $session_name"
# send Enter key
wezterm cli send-text --no-paste '^M'
# Wait a moment so Zellij has time to start
sleep 2
# send "detach" keybinding to Zellij
wezterm cli send-text --no-paste 'Ctrl-t d'
}
function attach-session() {
local session_name="$1"
wezterm cli send-text "zellij attach $session_name"
wezterm cli send-text --no-paste '^M'
}
start-session logs
start-session proxy
start-session website
start-session default-project
attach-session default-project Then run it with NB: the |
Since #3257 this behavior (or at least something similar) can be achieved by the following commands: zellij attach --create-background example-session
ZELLIJ_SESSION_NAME=example-session zellij action new-tab --layout example-layout.kdl This still leaves an extra empty tab open, which could be closed by something like: ZELLIJ_SESSION_NAME=example-session zellij action go-to-previous-tab
ZELLIJ_SESSION_NAME=example-session zellij action close-tab Ideally the first command would also allow you to specify the desired layout. I'll try to take a look into this to see if I can submit a PR to add that functionality. P.S.: Another possible workaround would be temporarily overriding the default layout before launching the background session. |
I came here to say that you could do |
Fixed in #3288 |
I have a layout that I would like to have run some servers or persistent tasks in the background but I don't want to attach to to the session immediately but just detached and then at some point later I can attach to it if needed. Kind of like running tmux in detached mode like
tmux new -s foo -d
.The text was updated successfully, but these errors were encountered: