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

add wezterm detection/differentiation #1759

Closed
dankamongmen opened this issue Jun 12, 2021 · 8 comments
Closed

add wezterm detection/differentiation #1759

dankamongmen opened this issue Jun 12, 2021 · 8 comments
Assignees
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Milestone

Comments

@dankamongmen
Copy link
Owner

The wezterm FAQ explicitly disclaims any independent terminfo database, stating that xterm-256color ought be used. OK, that's fine. For advanced features beyond terminfo, however (see e.g. #1715 and #1758), we need be able to differentiate wezterm from the forty thousand other terminals claiming to be xterm.

I don't see any way to interrogate wezterm, but according to wez/wezterm#230 we can look for the `TERM_PROGRAM environment variable, and indeed:

declare -x TERM_PROGRAM="WezTerm"
declare -x TERM_PROGRAM_VERSION="20210610-204057-2e7dc70e"

alright, i guess we're using that.

@dankamongmen dankamongmen added documentation Improvements or additions to documentation enhancement New feature or request labels Jun 12, 2021
@wez
Copy link

wez commented Jun 12, 2021

The versioning scheme is based on the date of the commit + the commit hash, so you could check to see if you got 20210610-204057 or later.

In addition to the environment, CSI > q should cause wezterm to answerback with the terminal name, a space and then the version string: DCS >| WezTerm VERS

@wez
Copy link

wez commented Jun 12, 2021

re: terminfo, we do have a wezterm terminfo file, but it isn't installed by default and most users won't have enabled it.
https://wezfurlong.org/wezterm/faq.html?highlight=terminfo#how-do-i-enable-undercurl-curly-underlines has details on how to install and use it, but the other methods of detection are more definitive.

@dankamongmen
Copy link
Owner Author

WezTerm is now detected based off the TERM_PROGRAM environment variable. it must be WezTerm, and TERM must contain the string xterm.

2021-06-12-130628_960x650_scrot

though now I see that you have a DCS-based method, in which case that will trump everything, once i add it (that work is ongoing, and intended to land this weekend).

@wez
Copy link

wez commented Jun 12, 2021

FWIW, wezterm can also be running with TERM=wezterm for some users, I'd suggest removing the TERM constraint when inspecting the environment.

If you're into answerback stuff, I commented above with the sequence and answerback that also returns the wezterm version info.

@wez
Copy link

wez commented Jun 12, 2021

(ah I can see that you saw my comment as well--great!)

@dankamongmen
Copy link
Owner Author

If you're into answerback stuff, I commented above with the sequence and answerback that also returns the wezterm version info.

yep, that's what'll be going in; i've got a branch rihgt now for DCS-based identification. and actually, as a result of that, i'm seeing:

 2021-06-12T17:12:19.351Z WARN  wezterm_term::terminalstate    > unknown unspecified CSI: "=0c"
 2021-06-12T17:12:19.351Z WARN  mux::localpane                 > unknown DeviceControlMode::Enter EnterDeviceControlMode(params: [], intermediates: ['+' 0x2b, ], byte: 'q' 0x71, ignored_extra_intermediates=false)
 2021-06-12T17:12:19.351Z WARN  mux::localpane                 > unhandled DeviceControlMode::Data 35 5
 2021-06-12T17:12:19.351Z WARN  mux::localpane                 > unhandled DeviceControlMode::Data 34 4
 2021-06-12T17:12:19.351Z WARN  mux::localpane                 > unhandled DeviceControlMode::Data 34 4
 2021-06-12T17:12:19.351Z WARN  mux::localpane                 > unhandled DeviceControlMode::Data 65 e

i can go file a bug if you'd like with the respective queries etc

@wez
Copy link

wez commented Jun 12, 2021

Yes please file it!

@dankamongmen
Copy link
Owner Author

confirmed reply to CSI > q:

:>|WezTerm 20210610-204057-2e7dc70e^[\^[[?1;2S^[[?2;0;960;624S^[[?1;0;65536S^[[?65;4;6;18;22c

i'll integrate this into my great shitty state machine in the sky

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants