zellij-org / zellij

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

autostart breaks Desktop environment Login #3327

Open tsia opened 4 months ago

tsia commented 4 months ago

2. Issues with the Zellij UI / behavior / crash

Issue description

after setting up zellij autostart i can't login anymore.

Minimal reproduction

added eval "$(zellij setup --generate-auto-start bash)" to ~/.bashrc.d/zellij. .bashrc loads it like that:

# User specific aliases and functions
if [ -d ~/.bashrc.d ]; then
    for rc in ~/.bashrc.d/*; do
        if [ -f "$rc" ]; then
            . "$rc"
        fi
    done
fi
unset rc

so i guess something in the KDE login process causes zellij to be started.

changing it to [[ $- == *i* ]] && eval "$(zellij setup --generate-auto-start bash) seemed to have fixed it

Other relevant information

suhaibkn commented 1 month ago

Facing the same issue on standard Ubuntu 24.04 (Gnome). If I add the default autostart script, I cannot login anymore.

It looks like the autostart script does not differentiate between normal terminal (gnome-terminal, konsole, kitty, etc) and virtual desktop terminals (Ctrl + Alt + 1-7). The Zellij autostart command is triggered in the virtual terminals as well, and for some reasons that is breaking the login.

Sadly [[ $- == *i* ]] didn't work for me. I ended up checking the value of tty and adding a simple check for that.

if [[ -z "$ZELLIJ" && -z "$TERM_PROGRAM" && $(tty) == /dev/pts/* ]]; then
  zellij --config=/home/user/.config/zellij/autostart.kdl attach -c default
fi