When I called open-wsl.exe to open a new terminal, an existing mintty window (if any) would also get activated for a moment before new window showing up, which was really annoying. But the "bug" failed to be reproduced on another machine of my friend.
After investigation of the source code and my personal config, it turns out that my custom shell prompt (PS1 variable) didn't set terminal title so the default title in wsl-terminal.conf was inherited.
Last part of open-wsl.ahk finds new terminal window by its title and activate it, which causes the buggy behaviour I mentioned:
I know little about Windows and AutoHotkey programming, but window title doesn't seem to be a reliable way to identify window uniquely. Also, I wonder why open-wsl.exe have to activate new mintty window itself. Should not the new window get focused automatically?
When I called open-wsl.exe to open a new terminal, an existing mintty window (if any) would also get activated for a moment before new window showing up, which was really annoying. But the "bug" failed to be reproduced on another machine of my friend.
After investigation of the source code and my personal config, it turns out that my custom shell prompt (
PS1
variable) didn't set terminal title so the default title in wsl-terminal.conf was inherited.Last part of
open-wsl.ahk
finds new terminal window by its title and activate it, which causes the buggy behaviour I mentioned:I know little about Windows and AutoHotkey programming, but window title doesn't seem to be a reliable way to identify window uniquely. Also, I wonder why open-wsl.exe have to activate new mintty window itself. Should not the new window get focused automatically?