Comments (11)
I took a quick look at the git blame and it seems the -l
is needed to keep the current directory. I guess passing -f
to zsh is the way to go.
from alacritty.
This has nothing to do with alacritty, I recommend playing with your shell until it behaves as expected.
from alacritty.
This has nothing to do with alacritty, I recommend playing with your shell until it behaves as expected.
I respectfully disagree. This has something to do with alacritty as alacritty's choice to invoke the user login shell through zsh is what pollutes the environment. It's not expected behaviour that your terminal emulator runs an extra shell. Especially a shell that is not the login shell you picked with no recourse but to fork and compile your own.
from alacritty.
That’s not alacritty doing that, I believe this was a choice macOS made recently. Feel free to change your shell invocation in the alacritty config to get around it though, or write your own wrapper shell as your default shell.
from alacritty.
I even linked the line where alacritty starts the login shell through zsh -c
how is that a choice by macOS? The only reason alacritty uses zsh
there seems to be the fact that it needs exec -a
. zsh -fc
would be the correct way to abuse zsh
there without polluting the environment.
from alacritty.
Apologies. I forgot all about that logic and was assuming that something changed when macOS defaulted to ZSH somewhat recently.
from alacritty.
@Learath2 perhaps reading over #6426 will shed some light on this issue. I vaguely recall being a bit confused about this myself a while ago now that I’m thinking more about it. Though I assume you have at this point.
from alacritty.
So now I'm curious and I'm trying running the suggested change here:
diff --git a/alacritty_terminal/src/tty/unix.rs b/alacritty_terminal/src/tty/unix.rs
index a4b07b74..d559a4e4 100644
--- a/alacritty_terminal/src/tty/unix.rs
+++ b/alacritty_terminal/src/tty/unix.rs
@@ -162,21 +162,12 @@ fn default_shell_command(shell: &str, _user: &str) -> Command {
#[cfg(target_os = "macos")]
fn default_shell_command(shell: &str, user: &str) -> Command {
- let shell_name = shell.rsplit('/').next().unwrap();
-
// On macOS, use the `login` command so the shell will appear as a tty session.
let mut login_command = Command::new("/usr/bin/login");
- // Exec the shell with argv[0] prepended by '-' so it becomes a login shell.
- // `login` normally does this itself, but `-l` disables this.
- let exec = format!("exec -a -{} {}", shell_name, shell);
-
// -f: Bypasses authentication for the already-logged-in user.
- // -l: Skips changing directory to $HOME and prepending '-' to argv[0].
// -p: Preserves the environment.
- //
- // XXX: we use zsh here over sh due to `exec -a`.
- login_command.args(["-flp", user, "/bin/zsh", "-c", &exec]);
+ login_command.args(["-fp", user, shell]);
login_command
}
Seems to work for me, so I'm not sure why things are as they are. Also, it's worth noting that having your shell.program
set to something without the login
call also results in a terminal without a registered session, which I suspect many people have. I don't honestly know what the consequences of not being a registered session are, but all my alacritty instances don't show up when I call who
.
Hope this helps a bit.
from alacritty.
You can look into the git history
to figure out why the changes are like that, but most likely because of some macOS bug.
PR that added that is also relatively new thing.
Also, none of that triggers if you run the command on your own iirc.
from alacritty.
It just surprised me that all this special logic is skipped if you choose your own shell in the config. Shouldn’t it be applied to custom shells too?
from alacritty.
Careful. Removing the -l
isn't correct. It'll switch directories to home. I'm running with -f
added to the zsh invocation, and that has been working fine for me, albeit only tested for a week or so.
from alacritty.
Related Issues (20)
- Not tracking num lock or caps lock for progressive enhancement HOT 5
- It performs weirdly while I change focus between Alacritty and other windows HOT 2
- Unable to produce "C-x C-;" keybind instead gets "C-x ;" whilst control is held down the whole time HOT 6
- Alacritty not able to launch after updating from Fedora 39 to 40. HOT 3
- Opactiy not working HOT 1
- [macOS] Not rendering Korean characters in the file title properly if created with GUI apps HOT 2
- Alacritty/winit event loop stalls and delays keyboard events HOT 2
- -bash: complete: nosort: invalid option name sourcing alacritty.bash completion file on MacOS HOT 3
- Feature request: ship / provide default `alacritty.toml` HOT 1
- App crashes on start up with `shell.program` set but works from terminal HOT 6
- Alacritty can't be opened because Apple cannot check it for malicious software HOT 1
- Alacritty config error with bell command HOT 2
- Message Bar not Appearing on latest build
- Feature request: Vi copy mode: */# (star/pound) and visual mode's o
- OSC 52 Paste doesn't work on Windows HOT 3
- Dialing to send server error HOT 3
- macOS: alt/option key as meta HOT 5
- Vi copy mode: Reset cursor position after yank. At possibly ClearSelection or at action to be created? HOT 7
- Transparency: Not really a bug, but a curious observation HOT 3
- No transparency after last update HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from alacritty.