-
Notifications
You must be signed in to change notification settings - Fork 63
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
Starting a Kitty terminal from an ITerm2 terminal causes mdcat to detect iterm2 instead of kitty #230
Comments
Well, this leaks environment variables from iterm2 down to kitty; no wonder this spoils terminal detection. In a way that's even documented; see the manpage which documents which environment variables mdcat looks at and in which order. I don't think we can fix this; if we changed the order of environment variables we just break different combinations of this 🤷🏿 If you've got an idea how to fix this solid, I welcome a pull request but meanwhile I tend to close this as won't fix, because there's only so much mdcat can do if environment variables of different terminals get mixed up. |
Maybe report a warning since there is an inconsistency between TERM and TERM_PROGRAM? Since TERM has the word kitty in it, the variable TERM_PROGRAM should be ignored. My understanding of TERM_PROGRAM is that it is additional information, so if TERM has sufficient information, then we do not need to look at TERM_PROGRAM. https://sw.kovidgoyal.net/kitty/conf/#opt-kitty.term Nothing solid, but I will look around to see if there are better ways. |
I think we could always check I'll refactor terminal detection to make this easier to implement and hopefully solve this issue. |
@norman-abramovitz You may want to test #232; it should fix this issue. |
Introduce a separate TerminalApp struct to abstract terminal detection separately from terminal capabilities. Check $TERM before all other environment variables; terminal emulators always set this variable and if it's something other than xterm-256colors it's definitely accurate. Closes GH-230
Starting a kitty terminal from an iterm2 terminal causes mdcat not to detect the kitty correctly.
From the Iterm2 terminal session
From the kitty terminal session
Unsetting the environment variable $TERM_PROGRAM makes the mdcat detect the kitty terminal correctly.
The text was updated successfully, but these errors were encountered: