Skip to content
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

Windows: TERM variable doesn't work on WSL #2711

Closed
wight554 opened this issue Aug 10, 2019 · 13 comments
Closed

Windows: TERM variable doesn't work on WSL #2711

wight554 opened this issue Aug 10, 2019 · 13 comments

Comments

@wight554
Copy link

wight554 commented Aug 10, 2019

Which operating system does the issue occur on?
Windows 10

To reproduce:

  1. Set shell.program to wsl and TERM variable in alacritty.conf
  2. Open alacritty
  3. Check $TERM variable, still default

Tried with alacritty terminfo and xterm, default is xterm-256color

@chrisduerr
Copy link
Member

Have you checked that you're editing the correct config file? You can see where the loaded config is located by running alacritty -v.

Also please share your config to make sure you've set everything up properly.

@wight554
Copy link
Author

  1. I'm sure proper config file is in use and it's modified slightly so I would've noticed if it wasn't
  2. My config file https://del.dog/asiquliyuf.sh

@chrisduerr
Copy link
Member

When you start another WSL shell or Alacritty with -e wsl.whatever and prepend TERM=xterm, does that do the job?

It's possible that WSL is just setting this environment variable itself after startup, at which point there's nothing Alacritty can do and this needs to be resolved in the WSL config.

@wight554
Copy link
Author

Sorry, it's a bit unclear what to do to me
Tried running ./alacritty -e wsl TERM=xterm but it just crashes even with TERM=xterm256-color

@chrisduerr
Copy link
Member

chrisduerr commented Aug 10, 2019

You're supposed to put it before the command, to set the environment variable for that command.

So TERM=xterm alacritty -e wsl. Assuming that you're currently inside a shell which is bash compatible (to some degree at least).

@wight554
Copy link
Author

Nope, doesn't work as well, still default

@chrisduerr
Copy link
Member

Sounds like there's nothing Alacritty can do then and it's done by WSL itself at startup. You'll have to set the term variable in your shell config then, that should definitely work.

@wight554
Copy link
Author

wight554 commented Aug 26, 2019

Found the way to workaround this issue
WSL accepts WSLENV variable that can contain env variables divided by : (tested in cmd)
So it can be fixed by:
set TERM=alacritty
set WSLENV=TERM && wsl

@chrisduerr
Copy link
Member

That sounds like the proper way to do this with WSL then. Closing as resolved.

@wight554
Copy link
Author

Yeah it is but is there any possibility to simplify handling of this?
I can't find fancy way to do this via alacritty config now
And starting alacritty with WSLENV param won't work as well

@chrisduerr
Copy link
Member

I can't find fancy way to do this via alacritty config now

You should be able to put this in Alacritty's env section, right?

If WSL sets environment variables on startup, there's absolutely nothing Alacritty can do about it. Alacritty can only suggest environment variables to WSL, but if it ovrrides these that's up to WSL and you'd have to complain to them (they'd likely just tell you to set WSLENV though I'd assume).

@wight554
Copy link
Author

wight554 commented Aug 26, 2019

Couldn't try before, srry
Apparently it works this way:

env:
  TERM: alacritty
  HELLO: world
  WSLENV: TERM:HELLO

Idk maybe it can be stated somewhere just in case, but up to you

@runkelstein
Copy link

I tried that with WSL2 but it does not work for me

env: TERM: alacritty TEST: test WSLENV: TERM:TEST

I tried it also with appending /w as suffix to the WSLENV

Like described in this article: https://devblogs.microsoft.com/commandline/share-environment-vars-between-wsl-and-windows/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants