zellij icon indicating copy to clipboard operation
zellij copied to clipboard

Zellij on shell startup is very slow

Open SerJaimeLannister opened this issue 5 months ago • 0 comments

So I am using zsh when I start shell startup I am using foot terminal & archlinux

This is my default shell script

PS1='%B%F{red}[%F{yellow}%n%F{green}@%F{blue}%M %F{magenta}%~%F{red}]%f%b$ '


precmd_functions+=(_lazy_load_plugins)
_lazy_load_plugins() {
    lazy_load zsh-autosuggestions
    lazy_load zsh-syntax-highlighting
    unset -f _lazy_load_plugins
}
alias fastfetch='command fastfetch'

# History configuration
HISTFILE=~/.cache/zsh/history
HISTSIZE=10000
SAVEHIST=10000

# Completion system
zstyle ':completion:*' menu select
zmodload zsh/complist
autoload -Uz compinit
if [[ -n ~/.cache/zsh/zcompdump(#qN.mh+24) ]]; then
    compinit -d ~/.cache/zsh/zcompdump
else
    compinit -C -d ~/.cache/zsh/zcompdump
fi
_comp_options+=(globdots)

# Cursor shape
set_cursor_shape() { echo -ne '\e[5 q' }
precmd_functions+=(set_cursor_shape)

# Zoxide initialization (lazy-loaded)
zoxide_init() { eval "$(zoxide init zsh)" }
alias cd='zoxide_init && cd'

# Bun setup
export BUN_INSTALL="$HOME/.bun"
export PATH=$BUN_INSTALL/bin:$PATH

# Golang setup
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin

# Qt style override
export QT_STYLE_OVERRIDE=kvantum

# Lazy-load plugins
lazy_load() {
    local plugin="$1"
    local plugin_path="/usr/share/zsh/plugins/$plugin/$plugin.zsh"
    [ -f "$plugin_path" ] && source "$plugin_path" 2>/dev/null
}

# Aliases
alias ls='eza --icons=always -1'
alias ll='eza -al --group-directories-first'`

which runs pretty fast

but when I add this to the top of the zshrc

if [[ -z "$ZELLIJ" ]]; then
    if [[ "$ZELLIJ_AUTO_ATTACH" == "true" ]]; then
        zellij attach -c
    else
        zellij
    fi

    if [[ "$ZELLIJ_AUTO_EXIT" == "true" ]]; then
        exit
    fi
fi

which is the recommended way to start zsh on startup , it adds a lot of time to the terminal

when I first start terminal from a system shutdown , it can take as much as 30-40 seconds it progressively gets better but still stays as 4-5 second where the cursor just blinks and is waiting for zellij to start

Is there any way to fix this? I am more than willing to customize zshrc to fix this issue

SerJaimeLannister avatar Sep 21 '24 15:09 SerJaimeLannister