-
-
Notifications
You must be signed in to change notification settings - Fork 619
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
zellij should launch the shell as a login shell #1434
Comments
I believe the shell is responsible for sourcing You could try sourcing |
After some research I found that the issue is whether the shell is run as a login shell or an interactive shell. It appears that tmux runs bash as a login shell, and that's why /etc/profile is sourced. zellij appears to run bash as an interactive shell. The consequence is surprising behavior as, for example, bash completion won't work when running zellij. |
Thanks for looking into this @hferreiro - I also agree this should be the behaviour (unless someone else is aware of a reason for this not to be?) Putting a |
By convention a login shell should by default be run once per login, unless explicitly specified by a user. If we break with this convention users could have performance problems, or other unintended behaviors. |
Hmm - I see your point @a-kenji - I'm just wondering about the definition of a "login shell". When I open a new terminal emulator window, is it considered a login shell? |
It depends on what you configured your shell to be. On most systems it wouldn't and shouldn't be a login shell, at least by default. Because the commands that are sourced are by convention supposed to be run once, at the start of the login and not every time a new instance of the shell is opened. If we ssh into a machine, then the login shell should be run exactly once - if the user wasn't logged in, but on opening a second pane it should open an interactive shell again. |
I see. This does check out with some local testing I've done. |
gnome-terminal launches a login shell. I guess probably most terminal emulators, otherwise shell completion wouldn't work. |
No, I couldn't figure that out yet. I have found this so far:
@hferreiro, Not everyone uses I know for a fact that foot and alacritty don't spawn shells as a login shell. Edit: It seems that gnome-terminal doesn't run a login shell by default: |
My bad, you're right. It appears the completion being missing is because the system I use zellij in is Debian where /etc/profile.d/* isn't sourced by interactive shells, while on Fedora they are, and that's why I assumed that gnome-terminal run login shells. |
Cool, thanks for setting us straight @a-kenji ! So can we close this? |
I think so? There are legitimate reasons to run the shell as a login shell, but I think the user should opt in to that. Maybe we can add a way to surface this setting easily to a user. |
I tried setting |
@hferreiro, |
There are some issues with using the GNU Stow `--dotfile` argument when the path to be stowed contains multiple levels of `dot-` style named files. This is the start of work to rename these files to be plain dotfiles. Additional Changes - Several additions to nvim, git, and bash configurations made over time. - Added .inputrc - Removed .bash_history (should never have been included) - Lines from .profile were copied to .bashrc to accomodate issues with loading .profile in zellij See: Zellij GH Issue <zellij-org/zellij#1434>
Sourcing ~/.bash_profile in ~/.bashrc is neccessary, because zellij doesn't launch a login shell. See zellij-org/zellij#1434 for reference
As a workaround I ended up writing this small #!/usr/bin/env bash
exec /usr/bin/env -i HOME="$HOME" SHELL="$SHELL" PATH="$PATH" TERM="$TERM" USER="$USER" "$BASH" -il …and in
|
@a-kenji Just an upvote for this. I want my @imsnif Could this be worked around by adding a new CLI or config option to enable running command(s) on pane startup (in my case, |
I tried to work around this with pane commands but no luck, as the
Some UNIX commands were available, however, like
|
I spent a more time than I'd like to admit trying to make the concept of "login shell" useful on my system, and came to the conclusion that it's practically worthless, due to inconsistencies in how the user's SHELL is called by the various components that start it: https://gitlab.com/jokeyrhyme/dotfiles/-/issues/129#note_1575856312 This is in no way the fault of I'd recommend removing any assumption about login shells from your configuration completely, and coming up with an alternative mechanism for guaranteeing that something happens exactly once per user session Either that, or making such configuration idempotent so that it can be run every time your shell launches without breaking anything |
To be clear, what I'm going for is the option to use login shells in new panes/tabs in the manner of tmux, iTerm, et al. |
I got around this by sourcing my profile in |
I don't know if this is intended or not, but I noticed that when running tmux I have bash completions enabled, and with zellij they aren't. This looks to be enabled by loading /etc/profile at startup.
The text was updated successfully, but these errors were encountered: