zellij-org / zellij

A terminal workspace with batteries included
https://zellij.dev
MIT License
21.69k stars 657 forks source link

zellij with --layout and --session no longer works #3734

Open theherk opened 6 days ago

theherk commented 6 days ago

Issue description

I generally use this script to start or connect to sessions:

#!/usr/bin/env fish

if set -q ZELLIJ_SESSION_NAME
    echo "Already in zellij session."
else
    set -l p (basename (git root))
    if contains $p (zellij list-sessions -ns)
        if contains $p (zellij list-sessions -n | rg EXITED | cut -d' ' -f1 | cut -d':' -f2)
            zellij delete-session $p
            zellij -l editor -s $p
        else
            zellij attach $p
        end
    else
        zellij -l editor -s $p # no longer works
        # zellij -n editor -s $p # works now
    end
end

Since upgrading to 0.41.1 I can no longer start new sessions this way. That is just what tipped me off, but the behavior can been seen more simply.

Minimal reproduction

  1. Have zero configuration aside from a layout test.kdl that can be empty.
  2. Run zellij -l test -s test.

That's it. This now gives There is no active session!. You might say to use zellij --new-session-with-layout test -s test, and that does work. However, that behavior is a bit confusing. The documentation for --session says

-s, --session <SESSION>
       Specify name of a new session

Seems to me There is no active session! shouldn't be possible when using this option. Of course there isn't one; I asked to start one.

I'm of course fine with using -n in lieu of -s, but I'm a bit confused.

imsnif commented 6 days ago

Hey, this is mentioned in the breaking changes part of the release notes. --layout now works differently in and out of sessions. It either works on the current session if in one or starts a new session with this layout if not. --session is there to tell it to work on a different existing session instead of the current one. I agree the word "new" should probably be dropped from the --help of session.

The old behavior can be achieved, as you have found (but I'm writing here for others who might find this issue) with --new-session-with-layout.

brandondrew commented 4 days ago

if the help text contradicts the behavior, that's definitely a bug, even if the fix is to change the help text

brandondrew commented 4 days ago

Here's the change log for anyone looking... to save them a few seconds 😅 https://github.com/zellij-org/zellij/releases#release-v0.41.0

The changes look absolutely EPIC! 🎉