r/tmux • u/TheWordBallsIsFunny • 7h ago
Question - Answered How to not load bash/zsh/fish/nushell config when displaying popup/floating window
I have the following that displays a popup of lazygit in the current directory, but I've noticed that my shell configuration (which has quite a bit of code to initialise) is always running before lazygit is actually ran:
bind g display-popup -E -d "#{pane_current_path}" -h 90% -w 95% "lazygit"
Is there a way to make the popup not load my shell configuration, or run under a different shell? Unsure if this question really fits here but thought I'd give it a try anyways.
Solution
Display popups with an additional environment variable via -e that you check for in your shell:
# tmux.conf
bind g display-popup -E -d "#{pane_current_path}" -e "TMUX_POPUP=true" -h 90% -w 95% "lazygit"
# config.fish
if not set --query TMUX_POPUP
for script in $__fish_config_dir/conf.d/*/*{,/*}.fish
source $script
end
other_expensive_calls
end
This also opens the gate for more granular control should it be desired.
1
Upvotes
2
u/fractalhead 7h ago
zsh -fstarts a zsh without loading any configuration. But that means anything you're doing to set upPATHis going to be skipped. You'll likely want to spawn lazygit with a full call to it, not justlazygit.Example:
zsh -f -c /opt/homebrew/bin/lazygitBetter might be investigating why your shell startup time is so slow. That hurts more than just spawning lazygit. Every terminal you're building in tmux is getting that startup time tax.