zellij icon indicating copy to clipboard operation
zellij copied to clipboard

Feature request: setting environment variables in layout

Open Zstorm999 opened this issue 1 year ago • 6 comments

It would be nice if we could set environment variables in layout files, with their values being contained in a pane/tab.

This could look something like

pane {
    // here $TERM has its normal value
    pane {
        env "TERM=xterm-color"
        // we override $TERM in this pane (and all sub-panes)
    }
}

Zstorm999 avatar Dec 05 '23 17:12 Zstorm999

@Zstorm999 agree that it would be a great addition to the tool but till then, you can have this workaround:

pane name="hello" command="zsh" {
	args "-c" "export SOMETHING=123; zsh"
}

igorrizhyi avatar Feb 08 '24 20:02 igorrizhyi

seconding interest in this, would be very helpful to have for kiosk-like panes which run a program directly instead of starting a shell

astral-l avatar Mar 04 '24 21:03 astral-l

This would be nice to automate opening date-stamped files or sets of files with * wildcards. Would also greatly help if we could do sub command execution or use a command to provide a list of files to editors:

layout {
    pane borderless=true {
        name "report editor" 
        cwd "$HOME/folder"
        command "nvim"
        args "$(date '+%m_%B')*.md" "-c" ":NvimTreeOpen"
        focus true
    }
}

Load all date stamped files from this month and open the tree in case I want to look around :rofl:

optimizasean avatar Apr 15 '24 21:04 optimizasean

this might be of help, as an example

            pane name="sidebar"{
                command "env"
                args "YAZI_CONFIG_HOME=/home/lucca/.config/zellij/yazi/sidebar" "yazi"
                size "20%"
            }

this runs yazi with said environment variable, but you could just as well run bash or maybe just the env command

luccahuguet avatar Jun 25 '24 17:06 luccahuguet