I have some settings in my .zshrc
file that should run in a regular terminal, but not when the terminal is called from IntelliJ.
I am currently using IntelliJ IDEA 2021.3.3 Ultimate Edition on Windows 11, and I am using wsl2 version 2.1.5.0.
Basically, I don't want tmux
to launch in an IntelliJ terminal, so I used the solution from this question.
In order to do that, on a normal Linux machine, I have added the following block to my rc file :
if ps -p $PPID | grep -iq java; then
#config for intelliJ execution
else
#config for regular execution
fi
However, the problem on wsl2 is that both commands ps -p $PPID
return the same output and that ps aux
doesn't show any java process on either terminals. This makes sense, as IntelliJ is a windows process, and wsl2 has no knowledge of its existence.
I also know that IntelliJ sets the variable TERMINAL_EMULATOR
to JetBrains-JediTerm
when invoking a new shell. However, for my version at least, the allocation does not work out of the box for wsl.
Here are the steps I tried to circumvent the issue :
- I set up my environment variables and updated WSLENV=TERMINAL_EMULATOR in my windows settings
- I can retrieve the value of the variable in my IntelliJ terminal. The problem is that the value is global to the system, so any new terminal I open will have the value defined.
- In the
Tools>Terminal
section of the IntelliJ settings, I tried updating theShell path
value towsl.exe --distribution Ubuntu-22.04 zsh -c "isIntellij=true zsh"
- This works with bash (when writing
wsl.exe --distribution Ubuntu-22.04 bash -c "isIntelliJ=true bash"
), but not with zsh for some reason. - I've also tried the following combinations with the same result :
zsh -c "export isIntellij=true; zsh"
,bash -c "export isIntellij=true; zsh"
, using the zsh-i
flag
- This works with bash (when writing
Is there any lead I've not explored ? Also, it should be noted that I can't update IntelliJ (this is my perpetual fallback license).