zellij-org / zellij

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

shell hooks not run in panes with commands/editor from a layout #3304

Open tcoopman opened 2 months ago

tcoopman commented 2 months ago

version: zellij 0.40.0

Issue: I'm using https://github.com/nix-community/nix-direnv to load flakes when I navigate in a folder with an .env file. This is loaded via a fish.config hook. When I use zellij normal without layouts, this always works fine. When I enter a directory, or when I open a new pane, the correct env file is loaded.

However, when I define a layout that has some commands or an edit pane, then env file is not loaded - this points to me that the fish hooks are not run for these panes.

The problem is that I use flake to setup the correct language/lsp/tools per project. But because zellij doesn't load these, using zellij -l welcome to set the session folder and use a layout are useless.

Steps to reproduce:

  1. make sure you have nix-direnv and a fish hook that sets up nix-direnv
  2. create a layout file that runs any command in a pane
  3. have a directory with an .env file that loads some flakes/nix files
  4. run zellij -l welcome point to the folder and use the layout
  5. notice that the .env file is not loaded for the panes that run a command/start an editor
  6. notice that the .env file is loaded for the normal panes.
rockboynton commented 2 months ago

I have this problem as well. In my case, I have a nix shell that has rust dependencies (cargo) with direnv as a hook to enter the nix shell. Everything works if I open a pane then run, e.g. cargo --version. But if I try to run it in a floating window, e.g. zellij run --floating -- cargo clippy it says cargo is not found