-
-
Notifications
You must be signed in to change notification settings - Fork 72
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
feat: detect windows terminal #141
base: master
Are you sure you want to change the base?
Conversation
Co-authored-by: Ayman Bagabas <[email protected]>
@Delta456 could you please provide unit tests for this case? |
Done |
Looking more into this, I don't think we need to check for WSL, we only need to check if we are running Windows Terminal via the diff --git a/termenv_unix.go b/termenv_unix.go
index 24d519a5d3d5..3ccf13bd96b4 100644
--- a/termenv_unix.go
+++ b/termenv_unix.go
@@ -57,6 +57,10 @@ func (o *Output) ColorProfile() Profile {
}
if strings.Contains(term, "256color") {
+ // Check if we're running Windows Terminal
+ if os.Getenv("WT_SESSION") != "" {
+ return TrueColor
+ }
return ANSI256
}
if strings.Contains(term, "color") {
|
I think we should also check WSL just to be double-sure. |
And add test to look for WT_SESSION
d840af0
to
2fde0ed
Compare
This PR adds the functionality to detect WSL (1 and 2) while using Windows Terminal as it supports
TrueColor
color profile. It also closes the issue #124.